Skip to content

Commit 22ca612

Browse files
committed
Add Storage Access API testRunner support for test_driver.set_permission
https://bugs.webkit.org/show_bug.cgi?id=296783 rdar://157258859 Reviewed by Matthew Finkel. test_driver.set_permission must be able to set the same state that is set when a user accepts or denies a Storage Access API prompt. This patch adds testRunner support to change that state in the network process. * LayoutTests/imported/w3c/web-platform-tests/storage-access-api/requestStorageAccess-cross-site-fetch.sub.https.window-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/storage-access-api/requestStorageAccess-cross-site-sibling-iframes.sub.https.window-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/storage-access-api/requestStorageAccess-dedicated-worker.sub.https.window-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/storage-access-api/requestStorageAccess-nested-same-origin-iframe.sub.https.window-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/storage-access-api/requestStorageAccess-web-socket.sub.https.window-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/storage-access-api/requestStorageAccess.sub.https.window-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/storage-access-api/storage-access-beyond-cookies.BroadcastChannel.sub.https.window-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/storage-access-api/storage-access-beyond-cookies.SharedWorker.sub.https.window-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/storage-access-api/storage-access-beyond-cookies.blobStorage.sub.https.window-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/storage-access-api/storage-access-beyond-cookies.caches.sub.https.window-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/storage-access-api/storage-access-beyond-cookies.cookies.sub.https.window-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/storage-access-api/storage-access-beyond-cookies.estimate.sub.https.window-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/storage-access-api/storage-access-beyond-cookies.getDirectory.sub.https.window-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/storage-access-api/storage-access-beyond-cookies.indexedDB.sub.https.window-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/storage-access-api/storage-access-beyond-cookies.localStorage.sub.https.window-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/storage-access-api/storage-access-beyond-cookies.locks.sub.https.window-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/storage-access-api/storage-access-beyond-cookies.none.sub.https.window-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/storage-access-api/storage-access-beyond-cookies.sessionStorage.sub.https.window-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/storage-access-api/storage-access-beyond-cookies.unpartitioned.sub.https.window-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/storage-access-api/storage-access-headers.tentative.https.sub.window-expected.txt: * LayoutTests/resources/testdriver-vendor.js: (async switch): (window.test_driver_internal.set_permission): * Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp: (WebKit::ResourceLoadStatisticsStore::grantStorageAccessPermission): (WebKit::ResourceLoadStatisticsStore::revokeStorageAccessPermission): (WebKit::ResourceLoadStatisticsStore::grantStorageAccess): (WebKit::ResourceLoadStatisticsStore::clearUserInteraction): * Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: * Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::setStorageAccessPermissionForTesting): * Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: * Source/WebKit/NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::setStorageAccessPermissionForTesting): * Source/WebKit/NetworkProcess/NetworkProcess.h: * Source/WebKit/NetworkProcess/NetworkProcess.messages.in: * Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp: (WKWebsiteDataStoreSetStorageAccessPermissionForTesting): * Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h: * Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::setStorageAccessPermissionForTesting): * Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h: * Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: * Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::setStorageAccessPermission): * Tools/WebKitTestRunner/InjectedBundle/TestRunner.h: * Tools/WebKitTestRunner/TestController.cpp: (WTR::TestController::didReceiveAsyncMessageFromInjectedBundle): Canonical link: https://commits.webkit.org/298158@main
1 parent b287f82 commit 22ca612

File tree

36 files changed

+140
-116
lines changed

36 files changed

+140
-116
lines changed
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
CONSOLE MESSAGE: Unhandled Promise Rejection: Error: Unsupported permission name "storage-access".
21

3-
Harness Error (TIMEOUT), message = null
4-
5-
TIMEOUT Cross-site HTTP redirects from a frame with storage-access are not credentialed by default Test timed out
2+
FAIL Cross-site HTTP redirects from a frame with storage-access are not credentialed by default assert_true: requestStorageAccess resolves without requiring a gesture. expected true got false
63

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
CONSOLE MESSAGE: Unhandled Promise Rejection: Error: Unsupported permission name "storage-access".
1+
Blocked access to external URL https://www.localhost:9443/storage-access-api/resources/script-with-cookie-header.py?script=embedded_responder.js
22

33
Harness Error (TIMEOUT), message = null
44

5-
TIMEOUT Grants have per-frame scope Test timed out
6-
NOTRUN Cross-site sibling iframes should not be able to take advantage of the existing permission grant requested by others.
5+
FAIL Grants have per-frame scope assert_true: requestStorageAccess doesn't require a gesture since the permission has already been granted. expected true got false
6+
TIMEOUT Cross-site sibling iframes should not be able to take advantage of the existing permission grant requested by others. Test timed out
77

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
CONSOLE MESSAGE: Unhandled Promise Rejection: Error: Unsupported permission name "storage-access".
21

3-
Harness Error (TIMEOUT), message = null
4-
5-
TIMEOUT Workers don't inherit storage access Test timed out
6-
NOTRUN Workers don't observe parent's storage access
2+
FAIL Workers don't inherit storage access assert_true: requestStorageAccess resolves without requiring a gesture. expected true got false
3+
FAIL Workers don't observe parent's storage access assert_true: requestStorageAccess resolves without requiring a gesture. expected true got false
74

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

22
PASS [nested-same-origin-frame] document.requestStorageAccess() should exist on the document interface
33
PASS [nested-same-origin-frame] document.requestStorageAccess() should resolve in top-level frame or same-site iframe, otherwise reject with a NotAllowedError with no user gesture.
4-
FAIL [nested-same-origin-frame] document.requestStorageAccess() should be resolved with no user gesture when a permission grant exists, and should allow cookie access promise_test: Unhandled rejection with value: object "Error: Unsupported permission name "storage-access"."
4+
PASS [nested-same-origin-frame] document.requestStorageAccess() should be resolved with no user gesture when a permission grant exists, and should allow cookie access
55
PASS [nested-same-origin-frame] document.requestStorageAccess() should resolve without permission grant or user gesture
66

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
CONSOLE MESSAGE: Unhandled Promise Rejection: Error: Unsupported permission name "storage-access".
21

3-
Harness Error (TIMEOUT), message = null
4-
5-
TIMEOUT WebSocket inherits storage access Test timed out
6-
NOTRUN WebSocket omits unpartitioned cookies without storage access
2+
FAIL WebSocket inherits storage access assert_true: requestStorageAccess resolves without requiring a gesture. expected true got false
3+
PASS WebSocket omits unpartitioned cookies without storage access
74

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

22
PASS [top-level-context] document.requestStorageAccess() should exist on the document interface
33
PASS [top-level-context] document.requestStorageAccess() should resolve in top-level frame or same-site iframe, otherwise reject with a NotAllowedError with no user gesture.
4-
FAIL [top-level-context] document.requestStorageAccess() should be resolved with no user gesture when a permission grant exists, and should allow cookie access promise_test: Unhandled rejection with value: object "Error: Unsupported permission name "storage-access"."
4+
PASS [top-level-context] document.requestStorageAccess() should be resolved with no user gesture when a permission grant exists, and should allow cookie access
55
PASS [top-level-context] document.requestStorageAccess() should resolve without permission grant or user gesture
66

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
CONSOLE MESSAGE: Unhandled Promise Rejection: Error: Unsupported permission name "storage-access".
2-
CONSOLE MESSAGE: Unhandled Promise Rejection: Error: Unsupported permission name "storage-access".
31

4-
Harness Error (TIMEOUT), message = null
5-
6-
TIMEOUT Verify StorageAccessAPIBeyondCookies for Broadcast Channel Test timed out
2+
FAIL Verify StorageAccessAPIBeyondCookies for Broadcast Channel assert_equals: Storage Access API should be accessible and return first-party data expected "HasAccess for BroadcastChannel" but got "Unable to load handle in cross-site context for all"
73

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
CONSOLE MESSAGE: Unhandled Promise Rejection: Error: Unsupported permission name "storage-access".
2-
CONSOLE MESSAGE: Unhandled Promise Rejection: Error: Unsupported permission name "storage-access".
31

4-
Harness Error (TIMEOUT), message = null
5-
6-
TIMEOUT Verify StorageAccessAPIBeyondCookies for Shared Worker Test timed out
2+
FAIL Verify StorageAccessAPIBeyondCookies for Shared Worker assert_equals: Storage Access API should be accessible and return first-party data expected "HasAccess for SharedWorker" but got "Unable to load handle in cross-site context for all"
73

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
CONSOLE MESSAGE: Unhandled Promise Rejection: Error: Unsupported permission name "storage-access".
2-
CONSOLE MESSAGE: Unhandled Promise Rejection: Error: Unsupported permission name "storage-access".
31

4-
Harness Error (TIMEOUT), message = null
5-
6-
TIMEOUT Verify StorageAccessAPIBeyondCookies for Blob Storage Test timed out
2+
FAIL Verify StorageAccessAPIBeyondCookies for Blob Storage assert_equals: Storage Access API should be accessible and return first-party data expected "HasAccess for blobStorage" but got "Unable to load handle in cross-site context for all"
73

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
CONSOLE MESSAGE: Unhandled Promise Rejection: Error: Unsupported permission name "storage-access".
2-
CONSOLE MESSAGE: Unhandled Promise Rejection: Error: Unsupported permission name "storage-access".
31

4-
Harness Error (TIMEOUT), message = null
5-
6-
TIMEOUT Verify StorageAccessAPIBeyondCookies for Cache Storage Test timed out
2+
FAIL Verify StorageAccessAPIBeyondCookies for Cache Storage assert_equals: Storage Access API should be accessible and return first-party data expected "HasAccess for caches" but got "Unable to load handle in cross-site context for all"
73

0 commit comments

Comments
 (0)