Bug 255363
| Summary: | Wake Lock permission denied after visibilitychange | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | siim <webkit> |
| Component: | New Bugs | Assignee: | Chris Dumez <cdumez> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | cdumez, cryze92, marcosc, tomac, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari 16 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| URL: | https://mdn.github.io/dom-examples/screen-wake-lock-api/ | ||
siim
Wake Lock releases when app is not visible. This is expected and is same in all platforms (iOS, Android, Windows)
document.visibilitychange event is used to aquire wake lock after user has started using app again.
In iOS Wake Lock does not work after "visibilitychange" event to re-aquire wake lock if user *goes to home screen*.
If apps are changed *without going to home screen*, then wake lock is re-aquired or stays active.
Error message: NotAllowedError: Permission was denied
Expected result:
There should be permission to re-aquire wake lock after going back to home screen & back to Safari.
There are no permission errors in Android or Windows.
Example:
https://mdn.github.io/dom-examples/screen-wake-lock-api/
Code:
https://github.com/mdn/dom-examples/blob/main/screen-wake-lock-api/script.js
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/108279602>
Chris Dumez
This is because we require transient activation to request the wake lock.
When you're calling request() from the visibility change handler, you don't have transient activation.
Chris Dumez
Pull request: https://github.com/WebKit/WebKit/pull/13104
EWS
Committed 263382@main (d901ad78bdb6): <https://commits.webkit.org/263382@main>
Reviewed commits have been landed. Closing PR #13104 and removing active labels.