Changeset 291726 in webkit
- Timestamp:
- Mar 22, 2022 4:53:16 PM (4 months ago)
- Location:
- trunk
- Files:
-
- 6 edited
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/file-system-access/opaque-origin.https.window-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/storage/opaque-origin.https.window-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/Modules/storage/StorageManager.cpp (modified) (1 diff)
-
Source/WebCore/page/SecurityOrigin.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r291690 r291726 1 2022-03-22 Sihui Liu <sihui_liu@apple.com> 2 3 Check if origin can access storage in Storage API 4 https://bugs.webkit.org/show_bug.cgi?id=238158 5 6 Reviewed by Chris Dumez. 7 8 * web-platform-tests/file-system-access/opaque-origin.https.window-expected.txt: 9 * web-platform-tests/storage/opaque-origin.https.window-expected.txt: 10 1 11 2022-03-22 Commit Queue <commit-queue@webkit.org> 2 12 -
trunk/LayoutTests/imported/w3c/web-platform-tests/file-system-access/opaque-origin.https.window-expected.txt
r283029 r291726 3 3 PASS FileSystemDirectoryHandle must be undefined for data URI iframes. 4 4 FAIL navigator.storage.getDirectory() and showDirectoryPicker() must reject in a sandboxed iframe. assert_equals: expected "showDirectoryPicker(): REJECTED: SecurityError" but got "showDirectoryPicker(): EXCEPTION: TypeError" 5 FAIL navigator.storage.getDirectory() and showDirectoryPicker() must reject in a sandboxed opened window. assert_equals: expected "showDirectoryPicker(): REJECTED: SecurityError" but got " showDirectoryPicker(): EXCEPTION: TypeError"5 FAIL navigator.storage.getDirectory() and showDirectoryPicker() must reject in a sandboxed opened window. assert_equals: expected "showDirectoryPicker(): REJECTED: SecurityError" but got "navigator.storage.getDirectory(): REJECTED: TypeError" 6 6 -
trunk/LayoutTests/imported/w3c/web-platform-tests/storage/opaque-origin.https.window-expected.txt
r282130 r291726 1 1 2 2 PASS navigator.storage.persisted() in non-sandboxed iframe should not reject 3 FAIL navigator.storage.persisted() in sandboxed iframe should reject with TypeError assert_equals: navigator.storage.persisted() should reject with TypeError expected "correct rejection" but got "no rejection" 3 PASS navigator.storage.persisted() in sandboxed iframe should reject with TypeError 4 4 FAIL navigator.storage.estimate() in non-sandboxed iframe should not reject assert_equals: navigator.storage.estimate() should not reject expected "no rejection" but got "API access threw" 5 5 FAIL navigator.storage.estimate() in sandboxed iframe should reject with TypeError assert_equals: navigator.storage.estimate() should reject with TypeError expected "correct rejection" but got "API access threw" 6 6 PASS navigator.storage.persist() in non-sandboxed iframe should not reject 7 FAIL navigator.storage.persist() in sandboxed iframe should reject with TypeError assert_equals: navigator.storage.persist() should reject with TypeError expected "correct rejection" but got "no rejection" 7 PASS navigator.storage.persist() in sandboxed iframe should reject with TypeError 8 8 -
trunk/Source/WebCore/ChangeLog
r291725 r291726 1 2022-03-22 Sihui Liu <sihui_liu@apple.com> 2 3 Check if origin can access storage in Storage API 4 https://bugs.webkit.org/show_bug.cgi?id=238158 5 6 Reviewed by Chris Dumez. 7 8 According to spec https://storage.spec.whatwg.org/#obtain-a-storage-key, origin should not access Storage API if 9 it's opaque. Also, origin should not access storage if it's blocked by storage policy, so we use 10 SecurityOrigin::canAccessStorage to perform the origin check, like what we do for the other storage APIs. 11 12 Updated expectation for imported tests. 13 14 * Modules/storage/StorageManager.cpp: 15 (WebCore::connectionInfo): 16 * page/SecurityOrigin.h: 17 (WebCore::SecurityOrigin::canAccessStorageManager const): 18 1 19 2022-03-22 Alan Bujtas <zalan@apple.com> 2 20 -
trunk/Source/WebCore/Modules/storage/StorageManager.cpp
r291123 r291726 71 71 if (!origin) 72 72 return Exception { InvalidStateError, "Origin is invalid"_s }; 73 73 74 if (!origin->canAccessStorageManager()) 75 return Exception { TypeError, "Origin should not access storage" }; 76 74 77 if (is<Document>(context)) { 75 78 if (auto* connection = downcast<Document>(context)->storageConnection()) -
trunk/Source/WebCore/page/SecurityOrigin.h
r290349 r291726 150 150 bool canAccessSessionStorage(const SecurityOrigin& topOrigin) const { return canAccessStorage(&topOrigin, AlwaysAllowFromThirdParty); } 151 151 bool canAccessLocalStorage(const SecurityOrigin* topOrigin) const { return canAccessStorage(topOrigin); }; 152 bool canAccessStorageManager() const { return canAccessStorage(nullptr); } 152 153 bool canAccessPluginStorage(const SecurityOrigin& topOrigin) const { return canAccessStorage(&topOrigin); } 153 154 bool canAccessApplicationCache(const SecurityOrigin& topOrigin) const { return canAccessStorage(&topOrigin); }
Note: See TracChangeset
for help on using the changeset viewer.