[webkit-changes] [WebKit/WebKit] d901ad: Wake Lock permission denied after visibilitychange

Chris Dumez noreply at github.com
Tue Apr 25 10:33:52 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d901ad78bdb6536b4c0bdcbf85b1c1e40b8bdfc4
      https://github.com/WebKit/WebKit/commit/d901ad78bdb6536b4c0bdcbf85b1c1e40b8bdfc4
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2023-04-25 (Tue, 25 Apr 2023)

  Changed paths:
    A LayoutTests/http/wpt/screen-wake-lock/sticky-permission-after-transient-activation-expected.txt
    A LayoutTests/http/wpt/screen-wake-lock/sticky-permission-after-transient-activation.html
    M Source/WebCore/Modules/screen-wake-lock/WakeLock.cpp
    M Source/WebCore/Modules/screen-wake-lock/WakeLock.h

  Log Message:
  -----------
  Wake Lock permission denied after visibilitychange
https://bugs.webkit.org/show_bug.cgi?id=255363
rdar://108279602

Reviewed by Geoffrey Garen.

Unlike other browser engines, WebKit requires a transient activation to acquire
a screen wake lock. While this is fine for the initial request, this seems a
bit restrictive for follow-up requests, especially considering that the screen
wake lock gets released when the document is no longer visible. It is also
common on the web to try and re-acquire the screen wake lock when the document
becomes visible again (in the visibilitychange event), in which case the JS
doesn't have transient activation.

To address this issue, we make the authorization from transient activation
sticky. If the page has previously acquired a screen wake lock with transient
activation, we will remember this permission for the lifetime of the document.

* LayoutTests/http/wpt/screen-wake-lock/sticky-permission-after-transient-activation-expected.txt: Added.
* LayoutTests/http/wpt/screen-wake-lock/sticky-permission-after-transient-activation.html: Added.
* Source/WebCore/Modules/screen-wake-lock/WakeLock.cpp:
(WebCore::WakeLock::request):
* Source/WebCore/Modules/screen-wake-lock/WakeLock.h:

Canonical link: https://commits.webkit.org/263382@main




More information about the webkit-changes mailing list