Skip to content

Commit df24f62

Browse files
committed
Add stubs for Permissions API
https://bugs.webkit.org/show_bug.cgi?id=229339 <rdar://problem/82442205> Reviewed by Chris Dumez. LayoutTests/imported/w3c: * web-platform-tests/permissions/idlharness.any-expected.txt: * web-platform-tests/permissions/idlharness.any.worker-expected.txt: * web-platform-tests/permissions/nfc-permission-expected.txt: * web-platform-tests/permissions/permissions-query-feature-policy-attribute.https.sub-expected.txt: * web-platform-tests/permissions/permissionsstatus-name-expected.txt: * web-platform-tests/permissions/screen-wake-lock-permission-expected.txt: * web-platform-tests/permissions/test-background-fetch-permission-expected.txt: * web-platform-tests/permissions/test-periodic-background-sync-permission-expected.txt: Source/WebCore: Add bindings code and a feature flag for Permissions API. Spec: https://w3c.github.io/permissions/ No new tests. Rebaseline existing tests. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Headers.cmake: * Modules/permissions/Navigator+Permissions.idl: Added. * Modules/permissions/NavigatorPermissions.cpp: Added. (WebCore::NavigatorPermissions::NavigatorPermissions): (WebCore::NavigatorPermissions::permissions): (WebCore::NavigatorPermissions::from): (WebCore::NavigatorPermissions::supplementName): * Modules/permissions/NavigatorPermissions.h: Added. * Modules/permissions/PermissionController.h: Added. * Modules/permissions/PermissionDescriptor.h: Added. (WebCore::PermissionDescriptor::operator== const): (WebCore::PermissionDescriptor::encode const): (WebCore::PermissionDescriptor::decode): * Modules/permissions/PermissionDescriptor.idl: Added. * Modules/permissions/PermissionName.h: Added. * Modules/permissions/PermissionName.idl: Added. * Modules/permissions/PermissionObserver.h: Added. * Modules/permissions/PermissionState.h: Added. * Modules/permissions/PermissionState.idl: Added. * Modules/permissions/PermissionStatus.cpp: Added. (WebCore::PermissionStatus::create): (WebCore::PermissionStatus::PermissionStatus): (WebCore::PermissionStatus::~PermissionStatus): (WebCore::PermissionStatus::stateChanged): (WebCore::PermissionStatus::activeDOMObjectName const): (WebCore::PermissionStatus::virtualHasPendingActivity const): (WebCore::PermissionStatus::eventListenersDidChange): * Modules/permissions/PermissionStatus.h: Added. * Modules/permissions/PermissionStatus.idl: Added. * Modules/permissions/Permissions.cpp: Added. (WebCore::Permissions::create): (WebCore::Permissions::Permissions): (WebCore::Permissions::navigator): (WebCore::Permissions::query): * Modules/permissions/Permissions.h: Added. * Modules/permissions/Permissions.idl: Added. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/WebCoreBuiltinNames.h: * dom/Document.cpp: (WebCore::Document::permissionController): * dom/Document.h: * dom/EventTargetFactory.in: * dom/ScriptExecutionContext.h: (WebCore::ScriptExecutionContext::permissionController): * dom/TaskSource.h: * loader/EmptyClients.cpp: (WebCore::pageConfigurationWithEmptyClients): * page/Page.cpp: (WebCore::m_permissionController): (WebCore::Page::permissionController): (WebCore::m_httpsUpgradeEnabled): Deleted. * page/Page.h: * page/PageConfiguration.cpp: (WebCore::PageConfiguration::PageConfiguration): * page/PageConfiguration.h: Source/WebKit: Set up basic infrastructure of permission getting and setting. * Sources.txt: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::requestPermission): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebPermissionController.cpp: Added. (WebKit::WebPermissionController::WebPermissionController): (WebKit::WebPermissionController::query): (WebKit::WebPermissionController::request): (WebKit::WebPermissionController::queryCache): (WebKit::WebPermissionController::updateCache): (WebKit::WebPermissionController::tryProcessingRequest): (WebKit::WebPermissionController::addObserver): (WebKit::WebPermissionController::removeObserver): (WebKit::WebPermissionController::permissionChanged): * WebProcess/WebCoreSupport/WebPermissionController.h: Added. * WebProcess/WebPage/WebPage.cpp: (WebKit::m_appHighlightsVisible): * WebProcess/WebPage/mac/DisplayRefreshMonitorMac.h: Source/WebKitLegacy/mac: * WebView/WebView.mm: (-[WebView _commonInitializationWithFrameName:groupName:]): (-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]): Source/WebKitLegacy/win: * WebView.cpp: (WebView::initWithFrame): Source/WTF: * Scripts/Preferences/WebPreferencesExperimental.yaml: LayoutTests: * TestExpectations: * platform/mac-wk1/fast/dom/navigator-detached-no-crash-expected.txt: * platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt: * platform/wk2/TestExpectations: Canonical link: https://commits.webkit.org/241108@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281771 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent e4bb8dd commit df24f62

66 files changed

Lines changed: 1567 additions & 57 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

LayoutTests/ChangeLog

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
2021-08-30 Sihui Liu <sihui_liu@apple.com>
2+
3+
Add stubs for Permissions API
4+
https://bugs.webkit.org/show_bug.cgi?id=229339
5+
<rdar://problem/82442205>
6+
7+
Reviewed by Chris Dumez.
8+
9+
* TestExpectations:
10+
* platform/mac-wk1/fast/dom/navigator-detached-no-crash-expected.txt:
11+
* platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt:
12+
* platform/wk2/TestExpectations:
13+
114
2021-08-30 Chris Dumez <cdumez@apple.com>
215

316
SubmitEvent.submitter property isn't set for <button type="submit">

LayoutTests/TestExpectations

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ fast/speechrecognition/permission-error.html [ Skip ]
196196
fast/speechrecognition/start-recognition-then-stop.html [ Skip ]
197197
fast/speechrecognition/start-second-recognition.html [ Skip ]
198198
fast/speechrecognition/ios/ [ Skip ]
199+
imported/w3c/web-platform-tests/permissions/ [ Skip ]
199200

200201
# app-privacy-report tests rely on WebKitAdditions
201202
http/tests/app-privacy-report/ [ Skip ]

LayoutTests/imported/w3c/ChangeLog

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
2021-08-30 Sihui Liu <sihui_liu@apple.com>
2+
3+
Add stubs for Permissions API
4+
https://bugs.webkit.org/show_bug.cgi?id=229339
5+
<rdar://problem/82442205>
6+
7+
Reviewed by Chris Dumez.
8+
9+
* web-platform-tests/permissions/idlharness.any-expected.txt:
10+
* web-platform-tests/permissions/idlharness.any.worker-expected.txt:
11+
* web-platform-tests/permissions/nfc-permission-expected.txt:
12+
* web-platform-tests/permissions/permissions-query-feature-policy-attribute.https.sub-expected.txt:
13+
* web-platform-tests/permissions/permissionsstatus-name-expected.txt:
14+
* web-platform-tests/permissions/screen-wake-lock-permission-expected.txt:
15+
* web-platform-tests/permissions/test-background-fetch-permission-expected.txt:
16+
* web-platform-tests/permissions/test-periodic-background-sync-permission-expected.txt:
17+
118
2021-08-30 Sihui Liu <sihui_liu@apple.com>
219

320
Import file-system-access tests from WPT

LayoutTests/imported/w3c/web-platform-tests/permissions/idlharness.any-expected.txt

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,29 @@ PASS WorkerNavigator includes NavigatorID: member names are unique
1919
PASS WorkerNavigator includes NavigatorLanguage: member names are unique
2020
PASS WorkerNavigator includes NavigatorOnLine: member names are unique
2121
PASS WorkerNavigator includes NavigatorConcurrentHardware: member names are unique
22-
FAIL PermissionStatus interface: existence and properties of interface object assert_own_property: self does not have own property "PermissionStatus" expected property "PermissionStatus" missing
23-
FAIL PermissionStatus interface object length assert_own_property: self does not have own property "PermissionStatus" expected property "PermissionStatus" missing
24-
FAIL PermissionStatus interface object name assert_own_property: self does not have own property "PermissionStatus" expected property "PermissionStatus" missing
25-
FAIL PermissionStatus interface: existence and properties of interface prototype object assert_own_property: self does not have own property "PermissionStatus" expected property "PermissionStatus" missing
26-
FAIL PermissionStatus interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "PermissionStatus" expected property "PermissionStatus" missing
27-
FAIL PermissionStatus interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "PermissionStatus" expected property "PermissionStatus" missing
28-
FAIL PermissionStatus interface: attribute state assert_own_property: self does not have own property "PermissionStatus" expected property "PermissionStatus" missing
29-
FAIL PermissionStatus interface: attribute onchange assert_own_property: self does not have own property "PermissionStatus" expected property "PermissionStatus" missing
30-
FAIL PermissionStatus must be primary interface of permissionStatus assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: permissionStatus"
31-
FAIL Stringification of permissionStatus assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: permissionStatus"
32-
FAIL PermissionStatus interface: permissionStatus must inherit property "state" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: permissionStatus"
33-
FAIL PermissionStatus interface: permissionStatus must inherit property "onchange" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: permissionStatus"
34-
FAIL Permissions interface: existence and properties of interface object assert_own_property: self does not have own property "Permissions" expected property "Permissions" missing
35-
FAIL Permissions interface object length assert_own_property: self does not have own property "Permissions" expected property "Permissions" missing
36-
FAIL Permissions interface object name assert_own_property: self does not have own property "Permissions" expected property "Permissions" missing
37-
FAIL Permissions interface: existence and properties of interface prototype object assert_own_property: self does not have own property "Permissions" expected property "Permissions" missing
38-
FAIL Permissions interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "Permissions" expected property "Permissions" missing
39-
FAIL Permissions interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "Permissions" expected property "Permissions" missing
40-
FAIL Permissions interface: operation query(object) assert_own_property: self does not have own property "Permissions" expected property "Permissions" missing
41-
FAIL Permissions must be primary interface of navigator.permissions assert_equals: wrong typeof object expected "object" but got "undefined"
42-
FAIL Stringification of navigator.permissions assert_equals: wrong typeof object expected "object" but got "undefined"
43-
FAIL Permissions interface: navigator.permissions must inherit property "query(object)" with the proper type assert_equals: wrong typeof object expected "object" but got "undefined"
44-
FAIL Permissions interface: calling query(object) on navigator.permissions with too few arguments must throw TypeError assert_equals: wrong typeof object expected "object" but got "undefined"
45-
FAIL Navigator interface: attribute permissions assert_true: The prototype object must have a property "permissions" expected true got false
46-
FAIL Navigator interface: navigator must inherit property "permissions" with the proper type assert_inherits: property "permissions" not found in prototype chain
22+
PASS PermissionStatus interface: existence and properties of interface object
23+
PASS PermissionStatus interface object length
24+
PASS PermissionStatus interface object name
25+
PASS PermissionStatus interface: existence and properties of interface prototype object
26+
PASS PermissionStatus interface: existence and properties of interface prototype object's "constructor" property
27+
PASS PermissionStatus interface: existence and properties of interface prototype object's @@unscopables property
28+
PASS PermissionStatus interface: attribute state
29+
PASS PermissionStatus interface: attribute onchange
30+
PASS PermissionStatus must be primary interface of permissionStatus
31+
PASS Stringification of permissionStatus
32+
PASS PermissionStatus interface: permissionStatus must inherit property "state" with the proper type
33+
PASS PermissionStatus interface: permissionStatus must inherit property "onchange" with the proper type
34+
PASS Permissions interface: existence and properties of interface object
35+
PASS Permissions interface object length
36+
PASS Permissions interface object name
37+
PASS Permissions interface: existence and properties of interface prototype object
38+
PASS Permissions interface: existence and properties of interface prototype object's "constructor" property
39+
PASS Permissions interface: existence and properties of interface prototype object's @@unscopables property
40+
PASS Permissions interface: operation query(object)
41+
PASS Permissions must be primary interface of navigator.permissions
42+
PASS Stringification of navigator.permissions
43+
PASS Permissions interface: navigator.permissions must inherit property "query(object)" with the proper type
44+
PASS Permissions interface: calling query(object) on navigator.permissions with too few arguments must throw TypeError
45+
PASS Navigator interface: attribute permissions
46+
PASS Navigator interface: navigator must inherit property "permissions" with the proper type
4747

LayoutTests/imported/w3c/web-platform-tests/permissions/idlharness.any.worker-expected.txt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,25 @@ PASS WorkerNavigator includes NavigatorID: member names are unique
1919
PASS WorkerNavigator includes NavigatorLanguage: member names are unique
2020
PASS WorkerNavigator includes NavigatorOnLine: member names are unique
2121
PASS WorkerNavigator includes NavigatorConcurrentHardware: member names are unique
22-
FAIL PermissionStatus interface: existence and properties of interface object assert_own_property: self does not have own property "PermissionStatus" expected property "PermissionStatus" missing
23-
FAIL PermissionStatus interface object length assert_own_property: self does not have own property "PermissionStatus" expected property "PermissionStatus" missing
24-
FAIL PermissionStatus interface object name assert_own_property: self does not have own property "PermissionStatus" expected property "PermissionStatus" missing
25-
FAIL PermissionStatus interface: existence and properties of interface prototype object assert_own_property: self does not have own property "PermissionStatus" expected property "PermissionStatus" missing
26-
FAIL PermissionStatus interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "PermissionStatus" expected property "PermissionStatus" missing
27-
FAIL PermissionStatus interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "PermissionStatus" expected property "PermissionStatus" missing
28-
FAIL PermissionStatus interface: attribute state assert_own_property: self does not have own property "PermissionStatus" expected property "PermissionStatus" missing
29-
FAIL PermissionStatus interface: attribute onchange assert_own_property: self does not have own property "PermissionStatus" expected property "PermissionStatus" missing
22+
PASS PermissionStatus interface: existence and properties of interface object
23+
PASS PermissionStatus interface object length
24+
PASS PermissionStatus interface object name
25+
PASS PermissionStatus interface: existence and properties of interface prototype object
26+
PASS PermissionStatus interface: existence and properties of interface prototype object's "constructor" property
27+
PASS PermissionStatus interface: existence and properties of interface prototype object's @@unscopables property
28+
PASS PermissionStatus interface: attribute state
29+
PASS PermissionStatus interface: attribute onchange
3030
FAIL PermissionStatus must be primary interface of permissionStatus assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: permissionStatus"
3131
FAIL Stringification of permissionStatus assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: permissionStatus"
3232
FAIL PermissionStatus interface: permissionStatus must inherit property "state" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: permissionStatus"
3333
FAIL PermissionStatus interface: permissionStatus must inherit property "onchange" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: permissionStatus"
34-
FAIL Permissions interface: existence and properties of interface object assert_own_property: self does not have own property "Permissions" expected property "Permissions" missing
35-
FAIL Permissions interface object length assert_own_property: self does not have own property "Permissions" expected property "Permissions" missing
36-
FAIL Permissions interface object name assert_own_property: self does not have own property "Permissions" expected property "Permissions" missing
37-
FAIL Permissions interface: existence and properties of interface prototype object assert_own_property: self does not have own property "Permissions" expected property "Permissions" missing
38-
FAIL Permissions interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "Permissions" expected property "Permissions" missing
39-
FAIL Permissions interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "Permissions" expected property "Permissions" missing
40-
FAIL Permissions interface: operation query(object) assert_own_property: self does not have own property "Permissions" expected property "Permissions" missing
34+
PASS Permissions interface: existence and properties of interface object
35+
PASS Permissions interface object length
36+
PASS Permissions interface object name
37+
PASS Permissions interface: existence and properties of interface prototype object
38+
PASS Permissions interface: existence and properties of interface prototype object's "constructor" property
39+
PASS Permissions interface: existence and properties of interface prototype object's @@unscopables property
40+
PASS Permissions interface: operation query(object)
4141
FAIL Permissions must be primary interface of navigator.permissions assert_equals: wrong typeof object expected "object" but got "undefined"
4242
FAIL Stringification of navigator.permissions assert_equals: wrong typeof object expected "object" but got "undefined"
4343
FAIL Permissions interface: navigator.permissions must inherit property "query(object)" with the proper type assert_equals: wrong typeof object expected "object" but got "undefined"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

2-
FAIL Test Web NFC Permission. undefined is not an object (evaluating 'navigator.permissions.query')
2+
PASS Test Web NFC Permission.
33

Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

2-
FAIL Permissions.state is "prompt" with allow="geolocation" in same-origin iframes. assert_equals: navigator.permissions.query("geolocation") expected (string) "prompt" but got (object) null
3-
FAIL Permissions.state is "prompt" with allow="geolocation" in cross-origin iframes. assert_equals: navigator.permissions.query("geolocation") expected (string) "prompt" but got (object) null
4-
FAIL Permission.state is "prompt" in same-origin iframes. assert_equals: navigator.permissions.query("geolocation") expected (string) "prompt" but got (object) null
5-
FAIL Permission.state is "denied" in cross-origin iframes. assert_equals: navigator.permissions.query("geolocation") expected (string) "denied" but got (object) null
2+
PASS Permissions.state is "prompt" with allow="geolocation" in same-origin iframes.
3+
PASS Permissions.state is "prompt" with allow="geolocation" in cross-origin iframes.
4+
PASS Permission.state is "prompt" in same-origin iframes.
5+
FAIL Permission.state is "denied" in cross-origin iframes. assert_equals: navigator.permissions.query("geolocation") expected "denied" but got "prompt"
66

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

2-
FAIL Test PermissionStatus's name attribute. promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'navigator.permissions.query')"
2+
PASS Test PermissionStatus's name attribute.
33

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

2-
FAIL Test "screen-wake-lock" Permission. promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'navigator.permissions.query')"
2+
FAIL Test "screen-wake-lock" Permission. promise_test: Unhandled rejection with value: object "TypeError: Type error"
33

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

2-
FAIL Test Background Fetch Permission. undefined is not an object (evaluating 'navigator.permissions.query')
2+
PASS Test Background Fetch Permission.
33

0 commit comments

Comments
 (0)