[webkit-changes] [WebKit/WebKit] 2df18f: navigator.userActivation API to query user activat...

Marcos Cáceres noreply at github.com
Fri Nov 11 09:09:58 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2df18f66ddd3a59cb6f0f32bac746137e95a8d0b
      https://github.com/WebKit/WebKit/commit/2df18f66ddd3a59cb6f0f32bac746137e95a8d0b
  Author: Marcos Caceres <marcos at marcosc.com>
  Date:   2022-11-11 (Fri, 11 Nov 2022)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/html/user-activation/activation-trigger-keyboard-enter.html
    M LayoutTests/imported/w3c/web-platform-tests/html/user-activation/activation-trigger-keyboard-escape.html
    M LayoutTests/imported/w3c/web-platform-tests/html/user-activation/activation-trigger-mouse-left.html
    M LayoutTests/imported/w3c/web-platform-tests/html/user-activation/activation-trigger-mouse-right.html
    M LayoutTests/imported/w3c/web-platform-tests/html/user-activation/activation-trigger-pointerevent.html
    A LayoutTests/imported/w3c/web-platform-tests/html/user-activation/chained-setTimeout-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/html/user-activation/chained-setTimeout.html
    R LayoutTests/imported/w3c/web-platform-tests/html/user-activation/chained-setTimeout.tentative-expected.txt
    R LayoutTests/imported/w3c/web-platform-tests/html/user-activation/chained-setTimeout.tentative.html
    A LayoutTests/imported/w3c/web-platform-tests/html/user-activation/consumption-crossorigin.sub-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/html/user-activation/consumption-crossorigin.sub.html
    R LayoutTests/imported/w3c/web-platform-tests/html/user-activation/consumption-crossorigin.sub.tentative-expected.txt
    R LayoutTests/imported/w3c/web-platform-tests/html/user-activation/consumption-crossorigin.sub.tentative.html
    A LayoutTests/imported/w3c/web-platform-tests/html/user-activation/consumption-sameorigin-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/html/user-activation/consumption-sameorigin.html
    R LayoutTests/imported/w3c/web-platform-tests/html/user-activation/consumption-sameorigin.tentative-expected.txt
    R LayoutTests/imported/w3c/web-platform-tests/html/user-activation/consumption-sameorigin.tentative.html
    A LayoutTests/imported/w3c/web-platform-tests/html/user-activation/detached-iframe-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/html/user-activation/detached-iframe.html
    M LayoutTests/imported/w3c/web-platform-tests/html/user-activation/message-event-activation-api-iframe-cross-origin.sub.tentative-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/html/user-activation/message-event-activation-api-iframe-cross-origin.sub.tentative.html
    M LayoutTests/imported/w3c/web-platform-tests/html/user-activation/message-event-init.tentative-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/html/user-activation/message-event-init.tentative.html
    A LayoutTests/imported/w3c/web-platform-tests/html/user-activation/navigation-state-reset-crossorigin.sub-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/html/user-activation/navigation-state-reset-crossorigin.sub.html
    R LayoutTests/imported/w3c/web-platform-tests/html/user-activation/navigation-state-reset-crossorigin.sub.tentative-expected.txt
    R LayoutTests/imported/w3c/web-platform-tests/html/user-activation/navigation-state-reset-crossorigin.sub.tentative.html
    A LayoutTests/imported/w3c/web-platform-tests/html/user-activation/navigation-state-reset-sameorigin-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/html/user-activation/navigation-state-reset-sameorigin.html
    R LayoutTests/imported/w3c/web-platform-tests/html/user-activation/navigation-state-reset-sameorigin.tentative-expected.txt
    R LayoutTests/imported/w3c/web-platform-tests/html/user-activation/navigation-state-reset-sameorigin.tentative.html
    M LayoutTests/imported/w3c/web-platform-tests/html/user-activation/no-activation-thru-escape-key-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/html/user-activation/no-activation-thru-escape-key.html
    A LayoutTests/imported/w3c/web-platform-tests/html/user-activation/propagation-crossorigin.sub-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/html/user-activation/propagation-crossorigin.sub.html
    R LayoutTests/imported/w3c/web-platform-tests/html/user-activation/propagation-crossorigin.sub.tentative-expected.txt
    R LayoutTests/imported/w3c/web-platform-tests/html/user-activation/propagation-crossorigin.sub.tentative.html
    A LayoutTests/imported/w3c/web-platform-tests/html/user-activation/propagation-sameorigin-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/html/user-activation/propagation-sameorigin.html
    R LayoutTests/imported/w3c/web-platform-tests/html/user-activation/propagation-sameorigin.tentative-expected.txt
    R LayoutTests/imported/w3c/web-platform-tests/html/user-activation/propagation-sameorigin.tentative.html
    A LayoutTests/imported/w3c/web-platform-tests/html/user-activation/user-activation-interface-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/html/user-activation/user-activation-interface.html
    M LayoutTests/platform/gtk/fast/dom/navigator-detached-no-crash-expected.txt
    M LayoutTests/platform/ios-wk2/TestExpectations
    R LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/user-activation/chained-setTimeout.tentative-expected.txt
    M LayoutTests/platform/mac-wk1/fast/dom/navigator-detached-no-crash-expected.txt
    M LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/user-activation/no-activation-thru-escape-key-expected.txt
    M LayoutTests/platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt
    M Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml
    M Source/WebCore/CMakeLists.txt
    M Source/WebCore/DerivedSources-input.xcfilelist
    M Source/WebCore/DerivedSources-output.xcfilelist
    M Source/WebCore/DerivedSources.make
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/bindings/js/WebCoreBuiltinNames.h
    A Source/WebCore/html/NavigatorUserActivation.cpp
    A Source/WebCore/html/NavigatorUserActivation.h
    M Source/WebCore/html/URLSearchParams.h
    A Source/WebCore/html/UserActivation.cpp
    A Source/WebCore/html/UserActivation.h
    A Source/WebCore/html/UserActivation.idl
    M Source/WebCore/page/DOMWindow.cpp
    M Source/WebCore/page/DOMWindow.h
    A Source/WebCore/page/Navigator+UserActivation.idl

  Log Message:
  -----------
  navigator.userActivation API to query user activation state
https://bugs.webkit.org/show_bug.cgi?id=245240

Reviewed by Youenn Fablet and Geoffrey Garen.

Implementation of the UserActivation interface:
https://html.spec.whatwg.org/#the-useractivation-interface

Which was added to HTML via:
https://github.com/whatwg/html/pull/8254/

The API provides web content a view into DOMWindow::hasTransientActivation()
and DOMWindow::hasStickyActivation(). This change excludes anything
related "MessageEvent", which has not yet been agreed to by the WHATWG.

The tests have been modified to work on WebKit infrastructure without
changing the intent of the original tests. In particular:

* `domains[www1]` and so on, so those are changed to `hosts[alt][]`
* Domains are differentiated by using different ports.
* Some of the tests are missing `await`.
* Some tests would run before the body was ready.

A PR has been sent to WPT to address these issues:
https://github.com/web-platform-tests/wpt/pull/36881

The tests are update to 1b73dcd.

Some test coming form WTP are non-standard. In particular, tests that
rely on `window.open()` and `.requestFullscreen()` are not spec'ed
to consume user activation. This is a known issue and will be addressed
as a followup in the specs and potentially as changes in WebKit.

* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/activation-trigger-keyboard-enter.html:
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/activation-trigger-keyboard-escape.html:
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/activation-trigger-mouse-left.html:
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/activation-trigger-mouse-right.html:
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/activation-trigger-pointerevent.html:
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/chained-setTimeout-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/chained-setTimeout.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/html/user-activation/chained-setTimeout.tentative.html.
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/chained-setTimeout.tentative-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/consumption-crossorigin.sub-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/consumption-crossorigin.sub.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/html/user-activation/consumption-crossorigin.sub.tentative.html.
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/consumption-crossorigin.sub.tentative-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/consumption-sameorigin-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/consumption-sameorigin.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/html/user-activation/consumption-sameorigin.tentative.html.
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/consumption-sameorigin.tentative-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/detached-iframe-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/detached-iframe.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/message-event-activation-api-iframe-cross-origin.sub.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/message-event-activation-api-iframe-cross-origin.sub.tentative.html:
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/message-event-init.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/message-event-init.tentative.html:
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/navigation-state-reset-crossorigin.sub-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/navigation-state-reset-crossorigin.sub.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/html/user-activation/navigation-state-reset-crossorigin.sub.tentative.html.
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/navigation-state-reset-crossorigin.sub.tentative-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/navigation-state-reset-sameorigin-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/navigation-state-reset-sameorigin.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/html/user-activation/navigation-state-reset-sameorigin.tentative.html.
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/navigation-state-reset-sameorigin.tentative-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/no-activation-thru-escape-key-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/no-activation-thru-escape-key.html:
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/propagation-crossorigin.sub-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/propagation-crossorigin.sub.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/html/user-activation/propagation-crossorigin.sub.tentative.html.
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/propagation-crossorigin.sub.tentative-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/propagation-sameorigin-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/propagation-sameorigin.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/html/user-activation/propagation-sameorigin.tentative.html.
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/propagation-sameorigin.tentative-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/user-activation-interface-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/user-activation/user-activation-interface.html: Added.
* LayoutTests/platform/gtk/fast/dom/navigator-detached-no-crash-expected.txt:
* LayoutTests/platform/ios-wk2/TestExpectations:
* LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/user-activation/chained-setTimeout.tentative-expected.txt: Removed.
* LayoutTests/platform/mac-wk1/fast/dom/navigator-detached-no-crash-expected.txt:
* LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/user-activation/no-activation-thru-escape-key-expected.txt:
* LayoutTests/platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt:
* Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml:
* Source/WebCore/CMakeLists.txt:
* Source/WebCore/DerivedSources-input.xcfilelist:
* Source/WebCore/DerivedSources-output.xcfilelist:
* Source/WebCore/DerivedSources.make:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/bindings/js/WebCoreBuiltinNames.h:
* Source/WebCore/html/NavigatorUserActivation.cpp: Added.
(WebCore::NavigatorUserActivation::NavigatorUserActivation):
(WebCore::NavigatorUserActivation::userActivation):
(WebCore::NavigatorUserActivation::from):
(WebCore::NavigatorUserActivation::supplementName):
* Source/WebCore/html/NavigatorUserActivation.h: Added.
* Source/WebCore/html/URLSearchParams.h:
* Source/WebCore/html/UserActivation.cpp: Added.
(WebCore::UserActivation::create):
(WebCore::UserActivation::UserActivation):
(WebCore::UserActivation::navigator):
(WebCore::UserActivation::window const):
(WebCore::UserActivation::hasBeenActive const):
(WebCore::UserActivation::isActive const):
* Source/WebCore/html/UserActivation.h: Added.
* Source/WebCore/html/UserActivation.idl: Added.
* Source/WebCore/page/DOMWindow.cpp:
(WebCore::DOMWindow::hasStickyActivation const):
* Source/WebCore/page/DOMWindow.h:
* Source/WebCore/page/Navigator+UserActivation.idl: Added.

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




More information about the webkit-changes mailing list