Changeset 245025 in webkit
- Timestamp:
- May 7, 2019 12:55:29 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 7 added
- 44 edited
- 2 copied
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r245016 r245025 1 2019-05-07 John Wilander <wilander@apple.com> 2 3 Storage Access API: Make two changes requested by developers and complete refactoring and cleanup 4 https://bugs.webkit.org/show_bug.cgi?id=197648 5 <rdar://problem/50527493> 6 7 Reviewed by Chris Dumez. 8 9 The changed test cases have had calls to WebCore::Internals::setUserGrantsStorageAccess() removed 10 since it was dead code. 11 12 One of the new tests, deny-with-prompt-does-not-preserve-gesture.html, is marked [ Skip ] for now since 13 we lack the ability to click "Don't allow" in the prompt. I wanted to include the test anyway so that 14 we have it. I have done a manual test to make sure the code does the right thing for this case. 15 16 * http/tests/storageAccess/deny-with-prompt-does-not-preserve-gesture-expected.txt: Added. 17 * http/tests/storageAccess/deny-with-prompt-does-not-preserve-gesture.html: Copied from LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-pop-window.html. 18 * http/tests/storageAccess/deny-without-prompt-preserves-gesture-expected.txt: Added. 19 * http/tests/storageAccess/deny-without-prompt-preserves-gesture.html: Copied from LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-pop-window.html. 20 * http/tests/storageAccess/grant-with-prompt-preserves-gesture-expected.txt: Renamed from LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-pop-window-expected.txt. 21 * http/tests/storageAccess/grant-with-prompt-preserves-gesture.html: Renamed from LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-pop-window.html. 22 * http/tests/storageAccess/has-storage-access-true-if-feature-off-expected.txt: Added. 23 * http/tests/storageAccess/has-storage-access-true-if-feature-off.html: Added. 24 * http/tests/storageAccess/resources/request-storage-access-and-immediately-postmessage-iframe.html: 25 * http/tests/storageAccess/resources/request-storage-access-iframe-and-pop-window.html: 26 * http/tests/storageAccess/resources/request-storage-access-iframe.html: 27 * http/tests/storageAccess/resources/request-storage-access-without-user-gesture-iframe.html: 28 * http/tests/storageAccess/resources/self-navigating-frame-after-granted-access.html: 29 * platform/mac-wk2/TestExpectations: 30 Added expectations for the new tests. 31 1 32 2019-05-07 Antti Koivisto <antti@apple.com> 2 33 -
trunk/LayoutTests/http/tests/storageAccess/deny-with-prompt-does-not-preserve-gesture.html
r245024 r245025 6 6 <script src="/resourceLoadStatistics/resources/util.js"></script> 7 7 <script> 8 description("Tests that cross-origin iframe can display a window if storage access is granted.");8 description("Tests that a cross-origin iframe can not open a window if storage access is explicitly denied."); 9 9 jsTestIsAsync = true; 10 10 … … 19 19 testPassed(event.data.replace("PASS ", "")); 20 20 else 21 testFailed(event.data );21 testFailed(event.data.replace("FAIL ", "")); 22 22 } else 23 23 testFailed("Received a message from an unexpected origin: " + event.origin); … … 61 61 }; 62 62 iframeElement.id = "TheIframeThatRequestsStorageAccess"; 63 iframeElement.src = "http://localhost:8000/storageAccess/resources/request-storage-access-iframe-and-pop-window.html#userShould GrantAccess,userShouldBeConsulted,policyShouldGrantAccess,isNotSameOriginIframe";63 iframeElement.src = "http://localhost:8000/storageAccess/resources/request-storage-access-iframe-and-pop-window.html#userShouldNotGrantAccess,userShouldBeConsulted,policyShouldNotGrantAccess,isNotSameOriginIframe"; 64 64 document.body.appendChild(iframeElement); 65 66 65 }); 67 66 }); -
trunk/LayoutTests/http/tests/storageAccess/deny-without-prompt-preserves-gesture.html
r245024 r245025 6 6 <script src="/resourceLoadStatistics/resources/util.js"></script> 7 7 <script> 8 description("Tests that cross-origin iframe can display a window if storage access is granted.");8 description("Tests that a cross-origin iframe can open a window if storage access is denied without prompt."); 9 9 jsTestIsAsync = true; 10 10 … … 19 19 testPassed(event.data.replace("PASS ", "")); 20 20 else 21 testFailed(event.data );21 testFailed(event.data.replace("FAIL ", "")); 22 22 } else 23 23 testFailed("Received a message from an unexpected origin: " + event.origin); … … 52 52 if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) 53 53 testFailed("Host did not get set as prevalent resource."); 54 testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, true, function() {55 if ( !testRunner.isStatisticsHasHadUserInteraction(statisticsUrl))56 testFailed("Host did notget logged for user interaction.");54 testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, false, function() { 55 if (testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) 56 testFailed("Host did get logged for user interaction."); 57 57 testRunner.statisticsUpdateCookieBlocking(function() { 58 58 let iframeElement = document.createElement("iframe"); … … 61 61 }; 62 62 iframeElement.id = "TheIframeThatRequestsStorageAccess"; 63 iframeElement.src = "http://localhost:8000/storageAccess/resources/request-storage-access-iframe-and-pop-window.html#userShould GrantAccess,userShouldBeConsulted,policyShouldGrantAccess,isNotSameOriginIframe";63 iframeElement.src = "http://localhost:8000/storageAccess/resources/request-storage-access-iframe-and-pop-window.html#userShouldNotGrantAccess,userShouldNotBeConsulted,policyShouldNotGrantAccess,isNotSameOriginIframe"; 64 64 document.body.appendChild(iframeElement); 65 66 65 }); 67 66 }); -
trunk/LayoutTests/http/tests/storageAccess/grant-with-prompt-preserves-gesture.html
r245024 r245025 19 19 testPassed(event.data.replace("PASS ", "")); 20 20 else 21 testFailed(event.data );21 testFailed(event.data.replace("FAIL ", "")); 22 22 } else 23 23 testFailed("Received a message from an unexpected origin: " + event.origin); … … 63 63 iframeElement.src = "http://localhost:8000/storageAccess/resources/request-storage-access-iframe-and-pop-window.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess,isNotSameOriginIframe"; 64 64 document.body.appendChild(iframeElement); 65 66 65 }); 67 66 }); -
trunk/LayoutTests/http/tests/storageAccess/resources/request-storage-access-and-immediately-postmessage-iframe.html
r241743 r245025 2 2 <head> 3 3 <script> 4 if (internals)5 internals.setUserGrantsStorageAccess(true);6 7 4 function makeRequestWithUserGesture() { 8 5 document.requestStorageAccess(); -
trunk/LayoutTests/http/tests/storageAccess/resources/request-storage-access-iframe-and-pop-window.html
r231910 r245025 8 8 const isSameOriginIframe = hashArguments[3] === "isSameOriginIframe"; 9 9 const originIsNull = hashArguments[4] === "originIsNull"; 10 11 if (window.internals)12 internals.setUserGrantsStorageAccess(userShouldGrantAccess);13 10 14 11 if (window.testRunner) { … … 26 23 function windowWasOpened() 27 24 { 28 if (userShould GrantAccess)25 if (userShouldBeConsulted && userShouldGrantAccess) 29 26 messageToTop("PASS Window was successfully opened with user interaction."); 27 else if (userShouldBeConsulted && !userShouldGrantAccess) 28 messageToTop("FAIL Window was opened even though the user explicitly declined permission."); 29 else if (!userShouldBeConsulted && !userShouldGrantAccess) 30 messageToTop("PASS Window was successfully opened with user interaction since the user was never consulted/prompted."); 30 31 else 31 messageToTop(" Window was opened even though the user declined permission.");32 messageToTop("FAIL Conflicting instructions: !userShouldBeConsulted && userShouldGrantAccess ."); 32 33 } 33 34 … … 49 50 var win = window.open("request-storage-access-second-window.html", "test window"); 50 51 if (!win) { 51 if (userShouldGrantAccess) 52 messageToTop("Window was not opened even though the user granted permission."); 52 if (userShouldBeConsulted && userShouldGrantAccess) 53 messageToTop("FAIL Window was not opened even though the user explicitly granted permission."); 54 else if (userShouldBeConsulted && !userShouldGrantAccess) 55 messageToTop("PASS Window was blocked from opening."); 56 else if (!userShouldBeConsulted && !userShouldGrantAccess) 57 messageToTop("FAIL Window was blocked from opening even though the user was never consulted/prompted."); 53 58 else 54 messageToTop("PASS Window was blocked from opening."); 55 } else if (!userShouldGrantAccess) { 56 messageToTop("Window was opened even though the user did not grant permission."); 59 messageToTop("FAIL Conflicting instructions: !userShouldBeConsulted && userShouldGrantAccess ."); 57 60 } 58 61 } -
trunk/LayoutTests/http/tests/storageAccess/resources/request-storage-access-iframe.html
r226235 r245025 8 8 const isSameOriginIframe = hashArguments[3] === "isSameOriginIframe"; 9 9 const originIsNull = hashArguments[4] === "originIsNull"; 10 11 if (internals && userShouldGrantAccess)12 internals.setUserGrantsStorageAccess(true);13 10 14 11 var requestStorageAccessResolved; -
trunk/LayoutTests/http/tests/storageAccess/resources/request-storage-access-without-user-gesture-iframe.html
r225583 r245025 6 6 const userShouldBeConsulted = hashArguments[1] === "userShouldBeConsulted"; 7 7 const policyShouldGrantAccess = hashArguments[2] === "policyShouldGrantAccess"; 8 9 if (internals && userShouldGrantAccess)10 internals.setUserGrantsStorageAccess(true);11 8 12 9 var requestStorageAccessResolved; -
trunk/LayoutTests/http/tests/storageAccess/resources/self-navigating-frame-after-granted-access.html
r235569 r245025 7 7 const policyShouldGrantAccess = hashArguments[2] === "policyShouldGrantAccess"; 8 8 const sameSiteNavigation = hashArguments[3] === "sameSiteNavigation"; 9 10 if (internals && userShouldGrantAccess)11 internals.setUserGrantsStorageAccess(true);12 9 13 10 var requestStorageAccessResolved; -
trunk/LayoutTests/platform/mac-wk2/TestExpectations
r245010 r245025 727 727 [ HighSierra+ ] http/tests/storageAccess/deny-storage-access-under-opener.html [ Pass ] 728 728 [ HighSierra+ ] http/tests/storageAccess/deny-storage-access-under-opener-if-auto-dismiss.html [ Pass ] 729 [ HighSierra+ ] http/tests/storageAccess/grant-with-prompt-preserves-gesture.html [ Pass ] 730 [ HighSierra+ ] http/tests/storageAccess/deny-with-prompt-does-not-preserve-gesture.html [ Skip ] 731 [ HighSierra+ ] http/tests/storageAccess/deny-without-prompt-preserves-gesture.html [ Pass ] 729 732 730 733 # As of https://trac.webkit.org/changeset/227762 the timestampResolution is just 5 seconds which makes this test flaky -
trunk/Source/WebCore/ChangeLog
r245020 r245025 1 2019-05-07 John Wilander <wilander@apple.com> 2 3 Storage Access API: Make two changes requested by developers and complete refactoring and cleanup 4 https://bugs.webkit.org/show_bug.cgi?id=197648 5 <rdar://problem/50527493> 6 7 Reviewed by Chris Dumez. 8 9 Developers have requested two minor changes to the Storage Access API: 10 - Only consume the user gesture when the user explicitly denies access. 11 - Make document.hasStorageAccess() return true instead of false when the feature is off. 12 13 In addition to this, we have refactoring and cleanup to do. Namely: 14 - Make use of WebCore::RegistrableDomain all the way. 15 - Remove dead code in WebKit::NetworkProcess since the calls now go through NetworkConnectionToWebProcess. 16 - Introduce boolean enums for state handling. 17 - Break out the Storage Access API functionality into a supplement of WebCore::Document. 18 19 Reviewed by Chris Dumez. 20 21 Tests: http/tests/storageAccess/deny-with-prompt-does-not-preserve-gesture.html 22 http/tests/storageAccess/deny-without-prompt-preserves-gesture.html 23 http/tests/storageAccess/grant-with-prompt-preserves-gesture.html 24 http/tests/storageAccess/has-storage-access-true-if-feature-off.html 25 26 * DerivedSources-input.xcfilelist: 27 * DerivedSources-output.xcfilelist: 28 * DerivedSources.make: 29 * Headers.cmake: 30 * Sources.txt: 31 * WebCore.xcodeproj/project.pbxproj: 32 * dom/Document.cpp: 33 (WebCore::Document::hasStorageAccess): Deleted. 34 (WebCore::Document::requestStorageAccess): Deleted. 35 (WebCore::Document::enableTemporaryTimeUserGesture): Deleted. 36 (WebCore::Document::consumeTemporaryTimeUserGesture): Deleted. 37 (WebCore::Document::hasFrameSpecificStorageAccess const): Deleted. 38 (WebCore::Document::setHasFrameSpecificStorageAccess): Deleted. 39 * dom/Document.h: 40 (WebCore::Document::setUserGrantsStorageAccessOverride): Deleted. 41 All of this has been moved to the supplement WebCore::DocumentStorageAccess. 42 * dom/Document.idl: 43 The Storage Access API has been moved to DocumentStorageAccess.idl. 44 * dom/DocumentStorageAccess.cpp: Added. 45 (WebCore::DocumentStorageAccess::from): 46 (WebCore::DocumentStorageAccess::supplementName): 47 (WebCore::DocumentStorageAccess::hasStorageAccess): 48 (WebCore::DocumentStorageAccess::requestStorageAccess): 49 (WebCore::DocumentStorageAccess::enableTemporaryTimeUserGesture): 50 (WebCore::DocumentStorageAccess::consumeTemporaryTimeUserGesture): 51 (WebCore::DocumentStorageAccess::hasFrameSpecificStorageAccess const): 52 (WebCore::DocumentStorageAccess::setHasFrameSpecificStorageAccess): 53 * dom/DocumentStorageAccess.h: Added. 54 * dom/DocumentStorageAccess.idl: Added. 55 * page/ChromeClient.h: 56 * testing/Internals.cpp: 57 (WebCore::Internals::setUserGrantsStorageAccess): Deleted. 58 This was dead code. 59 * testing/Internals.h: 60 * testing/Internals.idl: 61 1 62 2019-05-07 Antoine Quint <graouts@apple.com> 2 63 -
trunk/Source/WebCore/DerivedSources-input.xcfilelist
r244782 r245025 563 563 $(PROJECT_DIR)/dom/DocumentFullscreen.idl 564 564 $(PROJECT_DIR)/dom/DocumentOrShadowRoot.idl 565 $(PROJECT_DIR)/dom/DocumentStorageAccess.idl 565 566 $(PROJECT_DIR)/dom/DocumentTouch.idl 566 567 $(PROJECT_DIR)/dom/DocumentType.idl -
trunk/Source/WebCore/DerivedSources-output.xcfilelist
r244782 r245025 474 474 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSDocumentOrShadowRoot.cpp 475 475 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSDocumentOrShadowRoot.h 476 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSDocumentStorageAccess.cpp 477 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSDocumentStorageAccess.h 476 478 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSDocumentTimeline.cpp 477 479 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSDocumentTimeline.h -
trunk/Source/WebCore/DerivedSources.make
r244777 r245025 585 585 $(WebCore)/dom/DocumentFragment.idl \ 586 586 $(WebCore)/dom/DocumentOrShadowRoot.idl \ 587 $(WebCore)/dom/DocumentStorageAccess.idl \ 587 588 $(WebCore)/dom/DocumentType.idl \ 588 589 $(WebCore)/dom/Element.idl \ -
trunk/Source/WebCore/Headers.cmake
r244445 r245025 369 369 dom/DocumentMarker.h 370 370 dom/DocumentMarkerController.h 371 dom/DocumentStorageAccess.h 371 372 dom/DocumentTiming.h 372 373 dom/DocumentType.h -
trunk/Source/WebCore/Sources.txt
r244977 r245025 845 845 dom/DocumentParser.cpp 846 846 dom/DocumentSharedObjectPool.cpp 847 dom/DocumentStorageAccess.cpp 847 848 dom/DocumentTouch.cpp @no-unify 848 849 dom/DocumentType.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r244980 r245025 1976 1976 6B4E8613221B713F0022F389 /* RegistrableDomain.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B4E8612221B713F0022F389 /* RegistrableDomain.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1977 1977 6B693A2E1C51A82E00B03BEF /* ResourceLoadObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B693A2D1C51A82E00B03BEF /* ResourceLoadObserver.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1978 6BDB5DC2227BD3B800919770 /* DocumentStorageAccess.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BDB5DC0227BD3B800919770 /* DocumentStorageAccess.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1978 1979 6C4C96DF1AD4483500363F64 /* JSReadableByteStreamController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C4C96DB1AD4483500363F64 /* JSReadableByteStreamController.h */; }; 1979 1980 6C4C96DF1AD4483500365672 /* JSReadableStreamBYOBRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C4C96DB1AD4483500365672 /* JSReadableStreamBYOBRequest.h */; }; … … 9038 9039 6B693A2D1C51A82E00B03BEF /* ResourceLoadObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadObserver.h; sourceTree = "<group>"; }; 9039 9040 6B693A331C51A95D00B03BEF /* ResourceLoadObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceLoadObserver.cpp; sourceTree = "<group>"; }; 9041 6BDB5DC0227BD3B800919770 /* DocumentStorageAccess.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DocumentStorageAccess.h; sourceTree = "<group>"; }; 9042 6BDB5DC1227BD3B800919770 /* DocumentStorageAccess.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentStorageAccess.cpp; sourceTree = "<group>"; }; 9043 6BDB5DC5227CA0EB00919770 /* DocumentStorageAccess.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = DocumentStorageAccess.idl; sourceTree = "<group>"; }; 9040 9044 6C4C96DA1AD4483500363F64 /* JSReadableByteStreamController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSReadableByteStreamController.cpp; sourceTree = "<group>"; }; 9041 9045 6C4C96DA1AD4483500365672 /* JSReadableStreamBYOBRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSReadableStreamBYOBRequest.cpp; sourceTree = "<group>"; }; … … 25922 25926 CD54A760180F9F7000B076C9 /* AudioTrackPrivateMediaSourceAVFObjC.cpp */, 25923 25927 CD54A761180F9F7000B076C9 /* AudioTrackPrivateMediaSourceAVFObjC.h */, 25928 07C8AD121D073D630087C5CE /* AVAssetMIMETypeCache.h */, 25929 07C8AD111D073D630087C5CE /* AVAssetMIMETypeCache.mm */, 25924 25930 CDECA8991EDF447D00DCB08B /* AVAssetTrackUtilities.h */, 25925 25931 CDECA8981EDF447D00DCB08B /* AVAssetTrackUtilities.mm */, 25926 07C8AD121D073D630087C5CE /* AVAssetMIMETypeCache.h */,25927 07C8AD111D073D630087C5CE /* AVAssetMIMETypeCache.mm */,25928 25932 CD11B3DF227CAAA90023AFC7 /* AVStreamDataParserMIMETypeCache.h */, 25929 25933 CD11B3E0227CAAA90023AFC7 /* AVStreamDataParserMIMETypeCache.mm */, … … 27228 27232 AD6E71AA1668899D00320C13 /* DocumentSharedObjectPool.cpp */, 27229 27233 AD6E71AB1668899D00320C13 /* DocumentSharedObjectPool.h */, 27234 6BDB5DC1227BD3B800919770 /* DocumentStorageAccess.cpp */, 27235 6BDB5DC0227BD3B800919770 /* DocumentStorageAccess.h */, 27236 6BDB5DC5227CA0EB00919770 /* DocumentStorageAccess.idl */, 27230 27237 86D982F6125C154000AD9E3D /* DocumentTiming.h */, 27231 27238 7CE7FA5B1EF882300060C9D6 /* DocumentTouch.cpp */, … … 28235 28242 45830D4E1679B4F800ACF8C3 /* AutoscrollController.h in Headers */, 28236 28243 A8CFF04E0A154F09000A4234 /* AutoTableLayout.h in Headers */, 28244 07F4E93320B3587F002E3803 /* AVAssetMIMETypeCache.h in Headers */, 28237 28245 CDECA89B1EDF447D00DCB08B /* AVAssetTrackUtilities.h in Headers */, 28238 28246 CDC675271EAEA9D400727C84 /* AVAudioSessionCaptureDevice.h in Headers */, 28239 28247 CDC675231EAEA9B700727C84 /* AVAudioSessionCaptureDeviceManager.h in Headers */, 28240 28248 070363E2181A1CDC00C074A5 /* AVCaptureDeviceManager.h in Headers */, 28241 07F4E93320B3587F002E3803 /* AVAssetMIMETypeCache.h in Headers */,28242 28249 CD336F6217F9F64700DDDCD0 /* AVTrackPrivateAVFObjCImpl.h in Headers */, 28243 28250 070363E6181A1CDC00C074A5 /* AVVideoCaptureSource.h in Headers */, … … 28796 28803 4A4F48AA16B0DFC000EDBB29 /* DocumentRuleSets.h in Headers */, 28797 28804 AD6E71AD1668899D00320C13 /* DocumentSharedObjectPool.h in Headers */, 28805 6BDB5DC2227BD3B800919770 /* DocumentStorageAccess.h in Headers */, 28798 28806 0B90561A0F2578BF0095FF6A /* DocumentThreadableLoader.h in Headers */, 28799 28807 71025ED01F99F0CE004A250C /* DocumentTimeline.h in Headers */, … … 32576 32584 CD54A762180F9F7000B076C9 /* AudioTrackPrivateMediaSourceAVFObjC.cpp in Sources */, 32577 32585 A5F6E16B132ED46E008EDAE3 /* Autocapitalize.cpp in Sources */, 32586 0719427F1D088F21002AA51D /* AVAssetMIMETypeCache.mm in Sources */, 32578 32587 CDECA89A1EDF447D00DCB08B /* AVAssetTrackUtilities.mm in Sources */, 32579 32588 CDC675221EAEA9B700727C84 /* AVAudioSessionCaptureDeviceManager.mm in Sources */, 32580 32589 070363E3181A1CDC00C074A5 /* AVCaptureDeviceManager.mm in Sources */, 32581 0719427F1D088F21002AA51D /* AVAssetMIMETypeCache.mm in Sources */,32590 CD11B3E1227CE6F30023AFC7 /* AVStreamDataParserMIMETypeCache.mm in Sources */, 32582 32591 CD336F6117F9F64700DDDCD0 /* AVTrackPrivateAVFObjCImpl.mm in Sources */, 32583 32592 070363E7181A1CDC00C074A5 /* AVVideoCaptureSource.mm in Sources */, … … 33022 33031 DECA803A1F9FED6A00E3B661 /* UnifiedSource249.cpp in Sources */, 33023 33032 DECA803B1F9FED6A00E3B661 /* UnifiedSource250.cpp in Sources */, 33024 CD11B3E1227CE6F30023AFC7 /* AVStreamDataParserMIMETypeCache.mm in Sources */,33025 33033 DECA803C1F9FED6A00E3B661 /* UnifiedSource251.cpp in Sources */, 33026 33034 DECA803D1F9FED6A00E3B661 /* UnifiedSource252.cpp in Sources */, -
trunk/Source/WebCore/dom/Document.cpp
r244998 r245025 113 113 #include "IntersectionObserver.h" 114 114 #include "JSCustomElementInterface.h" 115 #include "JSDOMPromiseDeferred.h"116 115 #include "JSLazyEventListener.h" 117 116 #include "KeyboardEvent.h" … … 7732 7731 } 7733 7732 7734 void Document::hasStorageAccess(Ref<DeferredPromise>&& promise)7735 {7736 ASSERT(settings().storageAccessAPIEnabled());7737 7738 #if ENABLE(RESOURCE_LOAD_STATISTICS)7739 if (m_frame && hasFrameSpecificStorageAccess()) {7740 promise->resolve<IDLBoolean>(true);7741 return;7742 }7743 7744 if (!m_frame || securityOrigin().isUnique()) {7745 promise->resolve<IDLBoolean>(false);7746 return;7747 }7748 7749 if (m_frame->isMainFrame()) {7750 promise->resolve<IDLBoolean>(true);7751 return;7752 }7753 7754 auto& securityOrigin = this->securityOrigin();7755 auto& topSecurityOrigin = topDocument().securityOrigin();7756 if (securityOrigin.equal(&topSecurityOrigin)) {7757 promise->resolve<IDLBoolean>(true);7758 return;7759 }7760 7761 auto frameID = m_frame->loader().client().frameID();7762 auto pageID = m_frame->loader().client().pageID();7763 if (!frameID || !pageID) {7764 promise->reject();7765 return;7766 }7767 7768 if (Page* page = this->page()) {7769 auto iframeHost = securityOrigin.host();7770 auto topHost = topSecurityOrigin.host();7771 page->chrome().client().hasStorageAccess(WTFMove(iframeHost), WTFMove(topHost), frameID.value(), pageID.value(), [documentReference = makeWeakPtr(*this), promise = WTFMove(promise)] (bool hasAccess) {7772 Document* document = documentReference.get();7773 if (!document)7774 return;7775 7776 promise->resolve<IDLBoolean>(hasAccess);7777 });7778 return;7779 }7780 #endif7781 7782 promise->reject();7783 }7784 7785 void Document::requestStorageAccess(Ref<DeferredPromise>&& promise)7786 {7787 ASSERT(settings().storageAccessAPIEnabled());7788 7789 #if ENABLE(RESOURCE_LOAD_STATISTICS)7790 if (m_frame && hasFrameSpecificStorageAccess()) {7791 promise->resolve();7792 return;7793 }7794 7795 if (!m_frame || securityOrigin().isUnique()) {7796 promise->reject();7797 return;7798 }7799 7800 if (m_frame->isMainFrame()) {7801 promise->resolve();7802 return;7803 }7804 7805 auto& topDocument = this->topDocument();7806 auto& topSecurityOrigin = topDocument.securityOrigin();7807 auto& securityOrigin = this->securityOrigin();7808 if (securityOrigin.equal(&topSecurityOrigin)) {7809 promise->resolve();7810 return;7811 }7812 7813 // If there is a sandbox, it has to allow the storage access API to be called.7814 if (sandboxFlags() != SandboxNone && isSandboxed(SandboxStorageAccessByUserActivation)) {7815 promise->reject();7816 return;7817 }7818 7819 // The iframe has to be a direct child of the top document.7820 if (&topDocument != parentDocument()) {7821 promise->reject();7822 return;7823 }7824 7825 if (!UserGestureIndicator::processingUserGesture()) {7826 promise->reject();7827 return;7828 }7829 7830 auto iframeHost = securityOrigin.host();7831 auto topHost = topSecurityOrigin.host();7832 7833 Page* page = this->page();7834 auto frameID = m_frame->loader().client().frameID();7835 auto pageID = m_frame->loader().client().pageID();7836 if (!page || !frameID || !pageID) {7837 promise->reject();7838 return;7839 }7840 7841 page->chrome().client().requestStorageAccess(WTFMove(iframeHost), WTFMove(topHost), frameID.value(), pageID.value(), [documentReference = makeWeakPtr(*this), promise = WTFMove(promise)] (bool wasGranted) mutable {7842 Document* document = documentReference.get();7843 if (!document)7844 return;7845 7846 if (wasGranted) {7847 document->setHasFrameSpecificStorageAccess(true);7848 MicrotaskQueue::mainThreadQueue().append(std::make_unique<VoidMicrotask>([documentReference = makeWeakPtr(*document)] () {7849 if (auto* document = documentReference.get())7850 document->enableTemporaryTimeUserGesture();7851 }));7852 promise->resolve();7853 MicrotaskQueue::mainThreadQueue().append(std::make_unique<VoidMicrotask>([documentReference = WTFMove(documentReference)] () {7854 if (auto* document = documentReference.get())7855 document->consumeTemporaryTimeUserGesture();7856 }));7857 } else7858 promise->reject();7859 });7860 #else7861 promise->reject();7862 #endif7863 }7864 7865 void Document::enableTemporaryTimeUserGesture()7866 {7867 m_temporaryUserGesture = std::make_unique<UserGestureIndicator>(ProcessingUserGesture, this);7868 }7869 7870 void Document::consumeTemporaryTimeUserGesture()7871 {7872 m_temporaryUserGesture = nullptr;7873 }7874 7875 7733 void Document::registerArticleElement(Element& article) 7876 7734 { … … 7940 7798 7941 7799 #if ENABLE(RESOURCE_LOAD_STATISTICS) 7942 bool Document::hasFrameSpecificStorageAccess() const7943 {7944 return m_frame && m_frame->loader().client().hasFrameSpecificStorageAccess();7945 }7946 7947 void Document::setHasFrameSpecificStorageAccess(bool value)7948 {7949 if (m_frame)7950 m_frame->loader().client().setHasFrameSpecificStorageAccess(value);7951 }7952 7953 7800 bool Document::hasRequestedPageSpecificStorageAccessWithUserInteraction(const RegistrableDomain& domain) 7954 7801 { -
trunk/Source/WebCore/dom/Document.h
r244998 r245025 109 109 class Database; 110 110 class DatabaseThread; 111 class DeferredPromise;112 111 class DocumentFragment; 113 112 class DocumentLoader; … … 1466 1465 Logger& logger(); 1467 1466 1468 void hasStorageAccess(Ref<DeferredPromise>&& passedPromise);1469 void requestStorageAccess(Ref<DeferredPromise>&& passedPromise);1470 void setUserGrantsStorageAccessOverride(bool value) { m_grantStorageAccessOverride = value; }1471 1472 1467 WEBCORE_EXPORT void setConsoleMessageListener(RefPtr<StringCallback>&&); // For testing. 1473 1468 … … 1503 1498 String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String& challengeString, const URL&); 1504 1499 1505 void consumeTemporaryTimeUserGesture();1506 1507 1500 void registerArticleElement(Element&); 1508 1501 void unregisterArticleElement(Element&); … … 1645 1638 1646 1639 void platformSuspendOrStopActiveDOMObjects(); 1647 1648 void enableTemporaryTimeUserGesture();1649 1640 1650 1641 bool isBodyPotentiallyScrollable(HTMLBodyElement&); … … 1852 1843 void didLogMessage(const WTFLogChannel&, WTFLogLevel, Vector<JSONLogValue>&&) final; 1853 1844 1854 #if ENABLE(RESOURCE_LOAD_STATISTICS)1855 bool hasFrameSpecificStorageAccess() const;1856 void setHasFrameSpecificStorageAccess(bool);1857 #endif1858 1859 1845 #if ENABLE(DEVICE_ORIENTATION) 1860 1846 #if PLATFORM(IOS_FAMILY) … … 2034 2020 static bool hasEverCreatedAnAXObjectCache; 2035 2021 2036 bool m_grantStorageAccessOverride { false };2037 2038 2022 RefPtr<DocumentTimeline> m_timeline; 2039 2023 DocumentIdentifier m_identifier; … … 2049 2033 #endif 2050 2034 2051 std::unique_ptr<UserGestureIndicator> m_temporaryUserGesture;2052 2053 2035 CSSRegisteredCustomPropertySet m_CSSRegisteredPropertySet; 2054 2036 -
trunk/Source/WebCore/dom/Document.idl
r244440 r245025 174 174 RenderingContext? getCSSCanvasContext(DOMString contextId, DOMString name, long width, long height); 175 175 176 // Non standard, to bring up with standards working group.177 [EnabledBySetting=StorageAccessAPI] Promise<bool> hasStorageAccess();178 [EnabledBySetting=StorageAccessAPI] Promise<void> requestStorageAccess();179 180 176 // Obsolete features from https://html.spec.whatwg.org/multipage/obsolete.html 181 177 -
trunk/Source/WebCore/page/ChromeClient.h
r244633 r245025 29 29 #include "DisabledAdaptations.h" 30 30 #include "DisplayRefreshMonitor.h" 31 #include "DocumentStorageAccess.h" 31 32 #include "FocusDirection.h" 32 33 #include "FrameLoader.h" … … 41 42 #include "PopupMenu.h" 42 43 #include "PopupMenuClient.h" 44 #include "RegistrableDomain.h" 43 45 #include "RenderEmbeddedObject.h" 44 46 #include "ScrollTypes.h" … … 484 486 virtual RefPtr<Icon> createIconForFiles(const Vector<String>& /* filenames */) = 0; 485 487 486 virtual void hasStorageAccess(String&& /*subFrameHost*/, String&& /*topFrameHost*/, uint64_t /*frameID*/, uint64_t /*pageID*/, WTF::CompletionHandler<void (bool)>&& callback) { callback(false); } 487 virtual void requestStorageAccess(String&& /*subFrameHost*/, String&& /*topFrameHost*/, uint64_t /*frameID*/, uint64_t /*pageID*/, WTF::CompletionHandler<void (bool)>&& callback) { callback(false); } 488 #if ENABLE(RESOURCE_LOAD_STATISTICS) 489 virtual void hasStorageAccess(RegistrableDomain&& /*subFrameDomain*/, RegistrableDomain&& /*topFrameDomain*/, uint64_t /*frameID*/, uint64_t /*pageID*/, WTF::CompletionHandler<void(bool)>&& completionHandler) { completionHandler(false); } 490 virtual void requestStorageAccess(RegistrableDomain&& /*subFrameDomain*/, RegistrableDomain&& /*topFrameDomain*/, uint64_t /*frameID*/, uint64_t /*pageID*/, WTF::CompletionHandler<void(StorageAccessWasGranted, StorageAccessPromptWasShown)>&& completionHandler) { completionHandler(StorageAccessWasGranted::No, StorageAccessPromptWasShown::No); } 491 #endif 488 492 489 493 #if ENABLE(DEVICE_ORIENTATION) -
trunk/Source/WebCore/testing/Internals.cpp
r244823 r245025 4378 4378 } 4379 4379 4380 void Internals::setUserGrantsStorageAccess(bool value)4381 {4382 Document* document = contextDocument();4383 if (!document)4384 return;4385 4386 document->setUserGrantsStorageAccessOverride(value);4387 }4388 4389 4380 String Internals::composedTreeAsText(Node& node) 4390 4381 { -
trunk/Source/WebCore/testing/Internals.h
r244823 r245025 640 640 String resourceLoadStatisticsForURL(const DOMURL&); 641 641 void setResourceLoadStatisticsEnabled(bool); 642 void setUserGrantsStorageAccess(bool);643 642 644 643 #if ENABLE(STREAMS_API) -
trunk/Source/WebCore/testing/Internals.idl
r244823 r245025 626 626 DOMString resourceLoadStatisticsForURL(DOMURL url); 627 627 void setResourceLoadStatisticsEnabled(boolean enable); 628 [EnabledBySetting=StorageAccessAPI] void setUserGrantsStorageAccess(boolean value);629 628 630 629 [MayThrowException] void setCanShowModalDialogOverride(boolean allow); -
trunk/Source/WebKit/ChangeLog
r245023 r245025 1 2019-05-07 John Wilander <wilander@apple.com> 2 3 Storage Access API: Make two changes requested by developers and complete refactoring and cleanup 4 https://bugs.webkit.org/show_bug.cgi?id=197648 5 <rdar://problem/50527493> 6 7 Reviewed by Chris Dumez. 8 9 Developers have requested two minor changes to the Storage Access API: 10 - Only consume the user gesture when the user explicitly denies access. 11 - Make document.hasStorageAccess() return true instead of false when the feature is off. 12 13 In addition to this, we have refactoring and cleanup to do. Namely: 14 - Make use of WebCore::RegistrableDomain all the way. 15 - Remove dead code in WebKit::NetworkProcess since the calls now go through NetworkConnectionToWebProcess. 16 - Introduce boolean enums for state handling. 17 - Break out the Storage Access API functionality into a supplement of WebCore::Document. 18 19 * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: 20 (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationships): 21 (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess): 22 (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener): 23 (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess): 24 (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal): 25 (WebKit::ResourceLoadStatisticsDatabaseStore::hasUserGrantedStorageAccessThroughPrompt const): 26 These changes are due to the new enums WebCore::StorageAccessWasGranted and 27 WebCore::StorageAccessPromptWasShown. 28 * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: 29 * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: 30 (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess): 31 (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener): 32 (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccess): 33 (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal): 34 (WebKit::ResourceLoadStatisticsMemoryStore::hasUserGrantedStorageAccessThroughPrompt): 35 These changes are due to the new enums WebCore::StorageAccessWasGranted and 36 WebCore::StorageAccessPromptWasShown. 37 * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: 38 * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: 39 These changes are due to the new enums WebCore::StorageAccessWasGranted and 40 WebCore::StorageAccessPromptWasShown. 41 * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: 42 (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess): 43 (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess): 44 (WebKit::WebResourceLoadStatisticsStore::callGrantStorageAccessHandler): 45 These changes are due to the new enums WebCore::StorageAccessWasGranted and 46 WebCore::StorageAccessPromptWasShown. 47 (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessGranted): Deleted. 48 This function is now no longer exposed and its functionality could be folded into 49 the existing WebResourceLoadStatisticsStore::requestStorageAccess() which is more 50 clearly named. 51 * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: 52 * NetworkProcess/NetworkConnectionToWebProcess.cpp: 53 (WebKit::NetworkConnectionToWebProcess::hasStorageAccess): 54 (WebKit::NetworkConnectionToWebProcess::requestStorageAccess): 55 These changes are due to the new enums WebCore::StorageAccessWasGranted and 56 WebCore::StorageAccessPromptWasShown. 57 * NetworkProcess/NetworkConnectionToWebProcess.h: 58 * NetworkProcess/NetworkConnectionToWebProcess.messages.in: 59 * NetworkProcess/NetworkProcess.cpp: 60 (WebKit::NetworkProcess::hasStorageAccessForFrame): Deleted. 61 (WebKit::NetworkProcess::hasStorageAccess): Deleted. 62 (WebKit::NetworkProcess::requestStorageAccess): Deleted. 63 (WebKit::NetworkProcess::requestStorageAccessGranted): Deleted. 64 (WebKit::NetworkProcess::grantStorageAccess): Deleted. 65 (WebKit::NetworkProcess::removeAllStorageAccess): Deleted. 66 These functions were left behind in the move of ITP to the network process. 67 This communication goes through WebKit::NetworkConnectionToWebProcess since a while back. 68 * NetworkProcess/NetworkProcess.h: 69 * NetworkProcess/NetworkProcess.messages.in: 70 * Scripts/webkit/messages.py: 71 Instructions for derived IPC code on how to include the new enums 72 WebCore::StorageAccessWasGranted and WebCore::StorageAccessPromptWasShown. 73 * UIProcess/Network/NetworkProcessProxy.cpp: 74 (WebKit::NetworkProcessProxy::hasStorageAccessForFrame): Deleted. 75 (WebKit::NetworkProcessProxy::hasStorageAccess): Deleted. 76 (WebKit::NetworkProcessProxy::requestStorageAccess): Deleted. 77 (WebKit::NetworkProcessProxy::grantStorageAccess): Deleted. 78 (WebKit::NetworkProcessProxy::removeAllStorageAccess): Deleted. 79 These functions were left behind in the move of ITP to the network process. 80 This communication goes through WebKit::NetworkConnectionToWebProcess since a while back. 81 * UIProcess/Network/NetworkProcessProxy.h: 82 * UIProcess/WebsiteData/WebsiteDataStore.cpp: 83 (WebKit::WebsiteDataStore::hasStorageAccess): Deleted. 84 (WebKit::WebsiteDataStore::requestStorageAccess): Deleted. 85 (WebKit::WebsiteDataStore::grantStorageAccess): Deleted. 86 These functions were left behind in the move of ITP to the network process. 87 This communication goes through WebKit::NetworkConnectionToWebProcess since a while back. 88 * UIProcess/WebsiteData/WebsiteDataStore.h: 89 * WebProcess/WebCoreSupport/WebChromeClient.cpp: 90 (WebKit::WebChromeClient::hasStorageAccess): 91 (WebKit::WebChromeClient::requestStorageAccess): 92 These changes are due to the new enums WebCore::StorageAccessWasGranted and 93 WebCore::StorageAccessPromptWasShown. They also receive WebCore::RegistrableDomain 94 objects instead of Strings now. 95 * WebProcess/WebCoreSupport/WebChromeClient.h: 96 * WebProcess/WebPage/WebPage.cpp: 97 (WebKit::WebPage::hasStorageAccess): 98 (WebKit::WebPage::requestStorageAccess): 99 These changes are due to the new enums WebCore::StorageAccessWasGranted and 100 WebCore::StorageAccessPromptWasShown. They also receive WebCore::RegistrableDomain 101 objects instead of Strings now. 102 * WebProcess/WebPage/WebPage.h: 103 1 104 2019-05-07 John Wilander <wilander@apple.com> 2 105 -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp
r243181 r245025 38 38 #include "WebResourceLoadStatisticsTelemetry.h" 39 39 #include "WebsiteDataStore.h" 40 #include <WebCore/DocumentStorageAccess.h> 40 41 #include <WebCore/KeyedCoding.h> 41 42 #include <WebCore/NetworkStorageSession.h> … … 454 455 } 455 456 456 void ResourceLoadStatisticsDatabaseStore::insertDomainRelationships(const WebCore::ResourceLoadStatistics& loadStatistics)457 void ResourceLoadStatisticsDatabaseStore::insertDomainRelationships(const ResourceLoadStatistics& loadStatistics) 457 458 { 458 459 ASSERT(!RunLoop::isMain()); … … 769 770 770 771 auto userWasPromptedEarlier = hasUserGrantedStorageAccessThroughPrompt(subFrameStatus.second, topFrameDomain); 771 if ( !userWasPromptedEarlier) {772 if (userWasPromptedEarlier == StorageAccessPromptWasShown::No) { 772 773 #if !RELEASE_LOG_DISABLED 773 774 RELEASE_LOG_INFO_IF(debugLoggingEnabled(), ResourceLoadStatisticsDebug, "About to ask the user whether they want to grant storage access to %{public}s under %{public}s or not.", subFrameDomain.string().utf8().data(), topFrameDomain.string().utf8().data()); … … 778 779 779 780 #if !RELEASE_LOG_DISABLED 780 if (userWasPromptedEarlier )781 if (userWasPromptedEarlier == StorageAccessPromptWasShown::Yes) 781 782 RELEASE_LOG_INFO_IF(debugLoggingEnabled(), ResourceLoadStatisticsDebug, "Storage access was granted to %{public}s under %{public}s.", subFrameDomain.string().utf8().data(), topFrameDomain.string().utf8().data()); 782 783 #endif … … 789 790 } 790 791 791 grantStorageAccessInternal(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, pageID, userWasPromptedEarlier, [completionHandler = WTFMove(completionHandler)] ( bool wasGrantedAccess) mutable {792 completionHandler(wasGranted Access ? StorageAccessStatus::HasAccess : StorageAccessStatus::CannotRequestAccess);792 grantStorageAccessInternal(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, pageID, userWasPromptedEarlier, [completionHandler = WTFMove(completionHandler)] (StorageAccessWasGranted wasGranted) mutable { 793 completionHandler(wasGranted == StorageAccessWasGranted::Yes ? StorageAccessStatus::HasAccess : StorageAccessStatus::CannotRequestAccess); 793 794 }); 794 795 } … … 810 811 RELEASE_LOG_INFO_IF(debugLoggingEnabled(), ResourceLoadStatisticsDebug, "[Temporary combatibility fix] Storage access was granted for %{public}s under opener page from %{public}s, with user interaction in the opened window.", domainInNeedOfStorageAccess.string().utf8().data(), openerDomain.string().utf8().data()); 811 812 #endif 812 grantStorageAccessInternal(WTFMove(domainInNeedOfStorageAccess), WTFMove(openerDomain), WTF::nullopt, openerPageID, false, [](bool) { });813 } 814 815 void ResourceLoadStatisticsDatabaseStore::grantStorageAccess(SubFrameDomain&& subFrameDomain, TopFrameDomain&& topFrameDomain, uint64_t frameID, uint64_t pageID, bool userWasPromptedNow, CompletionHandler<void(bool)>&& completionHandler)816 { 817 ASSERT(!RunLoop::isMain()); 818 819 if ( userWasPromptedNow) {813 grantStorageAccessInternal(WTFMove(domainInNeedOfStorageAccess), WTFMove(openerDomain), WTF::nullopt, openerPageID, StorageAccessPromptWasShown::No, [](StorageAccessWasGranted) { }); 814 } 815 816 void ResourceLoadStatisticsDatabaseStore::grantStorageAccess(SubFrameDomain&& subFrameDomain, TopFrameDomain&& topFrameDomain, uint64_t frameID, uint64_t pageID, StorageAccessPromptWasShown promptWasShown, CompletionHandler<void(StorageAccessWasGranted)>&& completionHandler) 817 { 818 ASSERT(!RunLoop::isMain()); 819 820 if (promptWasShown == StorageAccessPromptWasShown::Yes) { 820 821 auto subFrameStatus = ensureResourceStatisticsForRegistrableDomain(subFrameDomain); 821 822 ASSERT(subFrameStatus.first == AddedRecord::No); … … 824 825 } 825 826 826 grantStorageAccessInternal(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, pageID, userWasPromptedNow, WTFMove(completionHandler));827 } 828 829 void ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal(SubFrameDomain&& subFrameDomain, TopFrameDomain&& topFrameDomain, Optional<FrameID> frameID, PageID pageID, bool userWasPromptedNowOrEarlier, CompletionHandler<void(bool)>&& callback)827 grantStorageAccessInternal(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, pageID, promptWasShown, WTFMove(completionHandler)); 828 } 829 830 void ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal(SubFrameDomain&& subFrameDomain, TopFrameDomain&& topFrameDomain, Optional<FrameID> frameID, PageID pageID, StorageAccessPromptWasShown promptWasShownNowOrEarlier, CompletionHandler<void(StorageAccessWasGranted)>&& completionHandler) 830 831 { 831 832 ASSERT(!RunLoop::isMain()); 832 833 833 834 if (subFrameDomain == topFrameDomain) { 834 c allback(true);835 return; 836 } 837 838 if ( userWasPromptedNowOrEarlier) {835 completionHandler(StorageAccessWasGranted::Yes); 836 return; 837 } 838 839 if (promptWasShownNowOrEarlier == StorageAccessPromptWasShown::Yes) { 839 840 #ifndef NDEBUG 840 841 auto subFrameStatus = ensureResourceStatisticsForRegistrableDomain(subFrameDomain); 841 842 ASSERT(subFrameStatus.first == AddedRecord::No); 842 843 ASSERT(hasHadUserInteraction(subFrameDomain, OperatingDatesWindow::Long)); 843 ASSERT(hasUserGrantedStorageAccessThroughPrompt(subFrameStatus.second, topFrameDomain) );844 ASSERT(hasUserGrantedStorageAccessThroughPrompt(subFrameStatus.second, topFrameDomain) == StorageAccessPromptWasShown::Yes); 844 845 #endif 845 846 setUserInteraction(subFrameDomain, true, WallTime::now()); 846 847 } 847 848 848 RunLoop::main().dispatch([subFrameDomain = subFrameDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), frameID, pageID, store = makeRef(store()), c allback = WTFMove(callback)]() mutable {849 store->callGrantStorageAccessHandler(subFrameDomain, topFrameDomain, frameID, pageID, [c allback = WTFMove(callback), store = store.copyRef()](bool value) mutable {850 store->statisticsQueue().dispatch([ callback = WTFMove(callback), value] () mutable {851 c allback(value);849 RunLoop::main().dispatch([subFrameDomain = subFrameDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), frameID, pageID, store = makeRef(store()), completionHandler = WTFMove(completionHandler)]() mutable { 850 store->callGrantStorageAccessHandler(subFrameDomain, topFrameDomain, frameID, pageID, [completionHandler = WTFMove(completionHandler), store = store.copyRef()](StorageAccessWasGranted wasGranted) mutable { 851 store->statisticsQueue().dispatch([wasGranted, completionHandler = WTFMove(completionHandler)] () mutable { 852 completionHandler(wasGranted); 852 853 }); 853 854 }); … … 1350 1351 } 1351 1352 1352 boolResourceLoadStatisticsDatabaseStore::hasUserGrantedStorageAccessThroughPrompt(unsigned requestingDomainID, const RegistrableDomain& firstPartyDomain) const1353 StorageAccessPromptWasShown ResourceLoadStatisticsDatabaseStore::hasUserGrantedStorageAccessThroughPrompt(unsigned requestingDomainID, const RegistrableDomain& firstPartyDomain) const 1353 1354 { 1354 1355 ASSERT(!RunLoop::isMain()); … … 1359 1360 if (statement.prepare() != SQLITE_OK 1360 1361 || statement.step() != SQLITE_ROW) 1361 return false;1362 1363 return !statement.getColumnInt(0) ;1362 return StorageAccessPromptWasShown::No; 1363 1364 return !statement.getColumnInt(0) ? StorageAccessPromptWasShown::Yes : StorageAccessPromptWasShown::No; 1364 1365 } 1365 1366 -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h
r244225 r245025 40 40 class SQLiteDatabase; 41 41 class SQLiteStatement; 42 enum class StorageAccessPromptWasShown : bool; 43 enum class StorageAccessWasGranted : bool; 42 44 struct ResourceLoadStatistics; 43 45 } … … 92 94 void hasStorageAccess(const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, CompletionHandler<void(bool)>&&) override; 93 95 void requestStorageAccess(SubFrameDomain&&, TopFrameDomain&&, FrameID, PageID, CompletionHandler<void(StorageAccessStatus)>&&) override; 94 void grantStorageAccess(SubFrameDomain&&, TopFrameDomain&&, FrameID, PageID, bool userWasPromptedNow, CompletionHandler<void(bool)>&&) override;96 void grantStorageAccess(SubFrameDomain&&, TopFrameDomain&&, FrameID, PageID, WebCore::StorageAccessPromptWasShown, CompletionHandler<void(WebCore::StorageAccessWasGranted)>&&) override; 95 97 96 98 void logFrameNavigation(const NavigatedToDomain&, const TopFrameDomain&, const NavigatedFromDomain&, bool isRedirect, bool isMainFrame) override; … … 129 131 void clearExpiredUserInteractions(); 130 132 void clearGrandfathering(Vector<unsigned>&&); 131 boolhasUserGrantedStorageAccessThroughPrompt(unsigned domainID, const RegistrableDomain&) const;133 WebCore::StorageAccessPromptWasShown hasUserGrantedStorageAccessThroughPrompt(unsigned domainID, const RegistrableDomain&) const; 132 134 void incrementRecordsDeletedCountForDomains(HashSet<RegistrableDomain>&&) override; 133 135 … … 151 153 unsigned recursivelyFindNonPrevalentDomainsThatRedirectedToThisDomain(unsigned primaryDomainID, StdSet<unsigned>& nonPrevalentRedirectionSources, unsigned numberOfRecursiveCalls); 152 154 void setDomainsAsPrevalent(StdSet<unsigned>&&); 153 void grantStorageAccessInternal(SubFrameDomain&&, TopFrameDomain&&, Optional<FrameID>, PageID, bool userWasPromptedNowOrEarlier, CompletionHandler<void(bool)>&&);155 void grantStorageAccessInternal(SubFrameDomain&&, TopFrameDomain&&, Optional<FrameID>, PageID, WebCore::StorageAccessPromptWasShown, CompletionHandler<void(WebCore::StorageAccessWasGranted)>&&); 154 156 void markAsPrevalentIfHasRedirectedToPrevalent(); 155 157 Vector<RegistrableDomain> ensurePrevalentResourcesForDebugMode() override; -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp
r243181 r245025 38 38 #include "WebResourceLoadStatisticsTelemetry.h" 39 39 #include "WebsiteDataStore.h" 40 #include <WebCore/DocumentStorageAccess.h> 40 41 #include <WebCore/KeyedCoding.h> 41 42 #include <WebCore/NetworkStorageSession.h> … … 245 246 246 247 auto userWasPromptedEarlier = hasUserGrantedStorageAccessThroughPrompt(subFrameStatistic, topFrameDomain); 247 if ( !userWasPromptedEarlier) {248 if (userWasPromptedEarlier == StorageAccessPromptWasShown::No) { 248 249 #if !RELEASE_LOG_DISABLED 249 250 RELEASE_LOG_INFO_IF(debugLoggingEnabled(), ResourceLoadStatisticsDebug, "About to ask the user whether they want to grant storage access to %{public}s under %{public}s or not.", subFrameDomain.string().utf8().data(), topFrameDomain.string().utf8().data()); … … 254 255 255 256 #if !RELEASE_LOG_DISABLED 256 if (userWasPromptedEarlier )257 if (userWasPromptedEarlier == StorageAccessPromptWasShown::Yes) 257 258 RELEASE_LOG_INFO_IF(debugLoggingEnabled(), ResourceLoadStatisticsDebug, "Storage access was granted to %{public}s under %{public}s.", subFrameDomain.string().utf8().data(), topFrameDomain.string().utf8().data()); 258 259 #endif … … 260 261 subFrameStatistic.timesAccessedAsFirstPartyDueToStorageAccessAPI++; 261 262 262 grantStorageAccessInternal(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, pageID, userWasPromptedEarlier, [completionHandler = WTFMove(completionHandler)] ( bool wasGrantedAccess) mutable {263 completionHandler(wasGranted Access ? StorageAccessStatus::HasAccess : StorageAccessStatus::CannotRequestAccess);263 grantStorageAccessInternal(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, pageID, userWasPromptedEarlier, [completionHandler = WTFMove(completionHandler)] (StorageAccessWasGranted wasGranted) mutable { 264 completionHandler(wasGranted == StorageAccessWasGranted::Yes ? StorageAccessStatus::HasAccess : StorageAccessStatus::CannotRequestAccess); 264 265 }); 265 266 } … … 283 284 RELEASE_LOG_INFO_IF(debugLoggingEnabled(), ResourceLoadStatisticsDebug, "[Temporary combatibility fix] Storage access was granted for %{public}s under opener page from %{public}s, with user interaction in the opened window.", domainInNeedOfStorageAccess.string().utf8().data(), openerDomain.string().utf8().data()); 284 285 #endif 285 grantStorageAccessInternal(WTFMove(domainInNeedOfStorageAccess), WTFMove(openerDomain), WTF::nullopt, openerPageID, false, [](bool) { });286 } 287 288 void ResourceLoadStatisticsMemoryStore::grantStorageAccess(SubFrameDomain&& subFrameDomain, TopFrameDomain&& topFrameDomain, uint64_t frameID, uint64_t pageID, bool userWasPromptedNow, CompletionHandler<void(bool)>&& completionHandler)289 { 290 ASSERT(!RunLoop::isMain()); 291 292 if ( userWasPromptedNow) {286 grantStorageAccessInternal(WTFMove(domainInNeedOfStorageAccess), WTFMove(openerDomain), WTF::nullopt, openerPageID, StorageAccessPromptWasShown::No, [](StorageAccessWasGranted) { }); 287 } 288 289 void ResourceLoadStatisticsMemoryStore::grantStorageAccess(SubFrameDomain&& subFrameDomain, TopFrameDomain&& topFrameDomain, uint64_t frameID, uint64_t pageID, StorageAccessPromptWasShown promptWasShown, CompletionHandler<void(StorageAccessWasGranted)>&& completionHandler) 290 { 291 ASSERT(!RunLoop::isMain()); 292 293 if (promptWasShown == StorageAccessPromptWasShown::Yes) { 293 294 auto& subFrameStatistic = ensureResourceStatisticsForRegistrableDomain(subFrameDomain); 294 295 ASSERT(subFrameStatistic.hadUserInteraction); 295 296 subFrameStatistic.storageAccessUnderTopFrameDomains.add(topFrameDomain); 296 297 } 297 grantStorageAccessInternal(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, pageID, userWasPromptedNow, WTFMove(completionHandler));298 } 299 300 void ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal(SubFrameDomain&& subFrameDomain, TopFrameDomain&& topFrameDomain, Optional<FrameID> frameID, PageID pageID, bool userWasPromptedNowOrEarlier, CompletionHandler<void(bool)>&& callback)298 grantStorageAccessInternal(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, pageID, promptWasShown, WTFMove(completionHandler)); 299 } 300 301 void ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal(SubFrameDomain&& subFrameDomain, TopFrameDomain&& topFrameDomain, Optional<FrameID> frameID, PageID pageID, StorageAccessPromptWasShown promptWasShownNowOrEarlier, CompletionHandler<void(StorageAccessWasGranted)>&& completionHandler) 301 302 { 302 303 ASSERT(!RunLoop::isMain()); 303 304 304 305 if (subFrameDomain == topFrameDomain) { 305 c allback(true);306 return; 307 } 308 309 if ( userWasPromptedNowOrEarlier) {306 completionHandler(StorageAccessWasGranted::Yes); 307 return; 308 } 309 310 if (promptWasShownNowOrEarlier == StorageAccessPromptWasShown::Yes) { 310 311 auto& subFrameStatistic = ensureResourceStatisticsForRegistrableDomain(subFrameDomain); 311 312 ASSERT(subFrameStatistic.hadUserInteraction); … … 314 315 } 315 316 316 RunLoop::main().dispatch([subFrameDomain = subFrameDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), frameID, pageID, store = makeRef(store()), c allback = WTFMove(callback)]() mutable {317 store->callGrantStorageAccessHandler(subFrameDomain, topFrameDomain, frameID, pageID, [c allback = WTFMove(callback), store = store.copyRef()](bool value) mutable {318 store->statisticsQueue().dispatch([ callback = WTFMove(callback), value] () mutable {319 c allback(value);317 RunLoop::main().dispatch([subFrameDomain = subFrameDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), frameID, pageID, store = makeRef(store()), completionHandler = WTFMove(completionHandler)]() mutable { 318 store->callGrantStorageAccessHandler(subFrameDomain, topFrameDomain, frameID, pageID, [completionHandler = WTFMove(completionHandler), store = store.copyRef()](StorageAccessWasGranted wasGranted) mutable { 319 store->statisticsQueue().dispatch([wasGranted, completionHandler = WTFMove(completionHandler)] () mutable { 320 completionHandler(wasGranted); 320 321 }); 321 322 }); … … 742 743 } 743 744 744 boolResourceLoadStatisticsMemoryStore::hasUserGrantedStorageAccessThroughPrompt(const ResourceLoadStatistics& statistic, const RegistrableDomain& firstPartyDomain)745 { 746 return statistic.storageAccessUnderTopFrameDomains.contains(firstPartyDomain) ;745 StorageAccessPromptWasShown ResourceLoadStatisticsMemoryStore::hasUserGrantedStorageAccessThroughPrompt(const ResourceLoadStatistics& statistic, const RegistrableDomain& firstPartyDomain) 746 { 747 return statistic.storageAccessUnderTopFrameDomains.contains(firstPartyDomain) ? StorageAccessPromptWasShown::Yes : StorageAccessPromptWasShown::No; 747 748 } 748 749 -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h
r243181 r245025 38 38 class KeyedDecoder; 39 39 class KeyedEncoder; 40 enum class StorageAccessPromptWasShown : bool; 41 enum class StorageAccessWasGranted : bool; 40 42 struct ResourceLoadStatistics; 41 43 } … … 98 100 void hasStorageAccess(const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, CompletionHandler<void(bool)>&&) override; 99 101 void requestStorageAccess(SubFrameDomain&&, TopFrameDomain&&, FrameID, PageID, CompletionHandler<void(StorageAccessStatus)>&&) override; 100 void grantStorageAccess(SubFrameDomain&&, TopFrameDomain&&, FrameID, PageID, bool userWasPromptedNow, CompletionHandler<void(bool)>&&) override;102 void grantStorageAccess(SubFrameDomain&&, TopFrameDomain&&, FrameID, PageID, WebCore::StorageAccessPromptWasShown, CompletionHandler<void(WebCore::StorageAccessWasGranted)>&&) override; 101 103 102 104 void logFrameNavigation(const NavigatedToDomain&, const TopFrameDomain&, const NavigatedFromDomain&, bool isRedirect, bool isMainFrame) override; … … 114 116 static bool shouldBlockAndKeepCookies(const ResourceLoadStatistics&); 115 117 static bool shouldBlockAndPurgeCookies(const ResourceLoadStatistics&); 116 static boolhasUserGrantedStorageAccessThroughPrompt(const ResourceLoadStatistics&, const RegistrableDomain&);118 static WebCore::StorageAccessPromptWasShown hasUserGrantedStorageAccessThroughPrompt(const ResourceLoadStatistics&, const RegistrableDomain&); 117 119 bool hasHadUnexpiredRecentUserInteraction(ResourceLoadStatistics&, OperatingDatesWindow) const; 118 120 bool shouldRemoveAllWebsiteDataFor(ResourceLoadStatistics&, bool shouldCheckForGrandfathering) const; … … 122 124 void setPrevalentResource(ResourceLoadStatistics&, ResourceLoadPrevalence); 123 125 unsigned recursivelyGetAllDomainsThatHaveRedirectedToThisDomain(const ResourceLoadStatistics&, HashSet<RedirectedToDomain>&, unsigned numberOfRecursiveCalls) const; 124 void grantStorageAccessInternal(SubFrameDomain&&, TopFrameDomain&&, Optional<FrameID>, PageID, bool userWasPromptedNowOrEarlier, CompletionHandler<void(bool)>&&);126 void grantStorageAccessInternal(SubFrameDomain&&, TopFrameDomain&&, Optional<FrameID>, PageID, WebCore::StorageAccessPromptWasShown, CompletionHandler<void(WebCore::StorageAccessWasGranted)>&&); 125 127 void markAsPrevalentIfHasRedirectedToPrevalent(ResourceLoadStatistics&); 126 128 bool isPrevalentDueToDebugMode(ResourceLoadStatistics&); -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.h
r243181 r245025 42 42 class KeyedDecoder; 43 43 class KeyedEncoder; 44 enum class StorageAccessPromptWasShown : bool; 45 enum class StorageAccessWasGranted : bool; 44 46 struct ResourceLoadStatistics; 45 47 } … … 162 164 virtual void hasStorageAccess(const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, CompletionHandler<void(bool)>&&) = 0; 163 165 virtual void requestStorageAccess(SubFrameDomain&&, TopFrameDomain&&, FrameID, PageID, CompletionHandler<void(StorageAccessStatus)>&&) = 0; 164 virtual void grantStorageAccess(SubFrameDomain&&, TopFrameDomain&&, FrameID, PageID, bool userWasPromptedNow, CompletionHandler<void(bool)>&&) = 0;166 virtual void grantStorageAccess(SubFrameDomain&&, TopFrameDomain&&, FrameID, PageID, WebCore::StorageAccessPromptWasShown, CompletionHandler<void(WebCore::StorageAccessWasGranted)>&&) = 0; 165 167 166 168 virtual void logFrameNavigation(const NavigatedToDomain&, const TopFrameDomain&, const NavigatedFromDomain&, bool isRedirect, bool isMainFrame) = 0; -
trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp
r243671 r245025 48 48 #include <WebCore/DiagnosticLoggingClient.h> 49 49 #include <WebCore/DiagnosticLoggingKeys.h> 50 #include <WebCore/DocumentStorageAccess.h> 50 51 #include <WebCore/NetworkStorageSession.h> 51 52 #include <WebCore/ResourceLoadStatistics.h> … … 315 316 } 316 317 317 void WebResourceLoadStatisticsStore::requestStorageAccessGranted(const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler) 318 { 318 void WebResourceLoadStatisticsStore::requestStorageAccess(const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(StorageAccessWasGranted, StorageAccessPromptWasShown)>&& completionHandler) 319 { 320 if (subFrameDomain == topFrameDomain) { 321 completionHandler(StorageAccessWasGranted::Yes, StorageAccessPromptWasShown::No); 322 return; 323 } 324 319 325 auto statusHandler = [this, protectedThis = makeRef(*this), subFrameDomain = subFrameDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), frameID, pageID, completionHandler = WTFMove(completionHandler)](StorageAccessStatus status) mutable { 320 326 switch (status) { 321 327 case StorageAccessStatus::CannotRequestAccess: 322 completionHandler( false);328 completionHandler(StorageAccessWasGranted::No, StorageAccessPromptWasShown::No); 323 329 return; 324 330 case StorageAccessStatus::RequiresUserPrompt: … … 326 332 CompletionHandler<void(bool)> requestConfirmationCompletionHandler = [this, protectedThis = protectedThis.copyRef(), subFrameDomain, topFrameDomain, frameID, pageID, completionHandler = WTFMove(completionHandler)] (bool userDidGrantAccess) mutable { 327 333 if (userDidGrantAccess) 328 grantStorageAccess(subFrameDomain, topFrameDomain, frameID, pageID, userDidGrantAccess, WTFMove(completionHandler));334 grantStorageAccess(subFrameDomain, topFrameDomain, frameID, pageID, StorageAccessPromptWasShown::Yes, WTFMove(completionHandler)); 329 335 else 330 completionHandler( false);336 completionHandler(StorageAccessWasGranted::No, StorageAccessPromptWasShown::Yes); 331 337 }; 332 338 m_networkSession->networkProcess().parentProcessConnection()->sendWithAsyncReply(Messages::NetworkProcessProxy::RequestStorageAccessConfirm(pageID, frameID, subFrameDomain, topFrameDomain), WTFMove(requestConfirmationCompletionHandler)); … … 334 340 return; 335 341 case StorageAccessStatus::HasAccess: 336 completionHandler( true);342 completionHandler(StorageAccessWasGranted::Yes, StorageAccessPromptWasShown::No); 337 343 return; 338 344 } 339 345 }; 340 346 341 requestStorageAccess(subFrameDomain, topFrameDomain, frameID, pageID, WTFMove(statusHandler)); 342 } 343 344 void WebResourceLoadStatisticsStore::requestStorageAccess(const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(StorageAccessStatus)>&& completionHandler) 345 { 346 if (subFrameDomain == topFrameDomain) { 347 completionHandler(StorageAccessStatus::HasAccess); 348 return; 349 } 350 351 postTask([this, subFrameDomain = subFrameDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), frameID, pageID, completionHandler = WTFMove(completionHandler)]() mutable { 347 postTask([this, subFrameDomain = subFrameDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), frameID, pageID, statusHandler = WTFMove(statusHandler)]() mutable { 352 348 if (!m_statisticsStore) { 353 postTaskReply([ completionHandler = WTFMove(completionHandler)]() mutable {354 completionHandler(StorageAccessStatus::CannotRequestAccess);349 postTaskReply([statusHandler = WTFMove(statusHandler)]() mutable { 350 statusHandler(StorageAccessStatus::CannotRequestAccess); 355 351 }); 356 352 return; … … 358 354 359 355 if (m_statisticsStore) { 360 m_statisticsStore->requestStorageAccess(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID .value(), pageID, [completionHandler = WTFMove(completionHandler)](StorageAccessStatus status) mutable {361 postTaskReply([ completionHandler = WTFMove(completionHandler), status]() mutable {362 completionHandler(status);356 m_statisticsStore->requestStorageAccess(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, pageID, [statusHandler = WTFMove(statusHandler)](StorageAccessStatus status) mutable { 357 postTaskReply([statusHandler = WTFMove(statusHandler), status]() mutable { 358 statusHandler(status); 363 359 }); 364 360 }); … … 380 376 } 381 377 382 void WebResourceLoadStatisticsStore::grantStorageAccess(const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, bool userWasPromptedNow, CompletionHandler<void(bool)>&& completionHandler)383 { 384 ASSERT(RunLoop::isMain()); 385 postTask([this, subFrameDomain = subFrameDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), frameID, pageID, userWasPromptedNow, completionHandler = WTFMove(completionHandler)]() mutable {378 void WebResourceLoadStatisticsStore::grantStorageAccess(const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, StorageAccessPromptWasShown promptWasShown, CompletionHandler<void(StorageAccessWasGranted, StorageAccessPromptWasShown)>&& completionHandler) 379 { 380 ASSERT(RunLoop::isMain()); 381 postTask([this, subFrameDomain = subFrameDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), frameID, pageID, promptWasShown, completionHandler = WTFMove(completionHandler)]() mutable { 386 382 if (!m_statisticsStore) { 387 postTaskReply([ completionHandler = WTFMove(completionHandler)]() mutable {388 completionHandler( false);383 postTaskReply([promptWasShown, completionHandler = WTFMove(completionHandler)]() mutable { 384 completionHandler(StorageAccessWasGranted::No, promptWasShown); 389 385 }); 390 386 return; … … 392 388 393 389 if (m_statisticsStore) { 394 m_statisticsStore->grantStorageAccess(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, pageID, userWasPromptedNow, [completionHandler = WTFMove(completionHandler)](boolwasGrantedAccess) mutable {395 postTaskReply([ completionHandler = WTFMove(completionHandler), wasGrantedAccess]() mutable {396 completionHandler(wasGrantedAccess );390 m_statisticsStore->grantStorageAccess(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, pageID, promptWasShown, [promptWasShown, completionHandler = WTFMove(completionHandler)](StorageAccessWasGranted wasGrantedAccess) mutable { 391 postTaskReply([wasGrantedAccess, promptWasShown, completionHandler = WTFMove(completionHandler)]() mutable { 392 completionHandler(wasGrantedAccess, promptWasShown); 397 393 }); 398 394 }); … … 401 397 } 402 398 403 boolWebResourceLoadStatisticsStore::grantStorageAccess(const RegistrableDomain& resourceDomain, const RegistrableDomain& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID)399 StorageAccessWasGranted WebResourceLoadStatisticsStore::grantStorageAccess(const RegistrableDomain& resourceDomain, const RegistrableDomain& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID) 404 400 { 405 401 bool isStorageGranted = false; … … 411 407 } 412 408 413 return isStorageGranted ;414 } 415 416 void WebResourceLoadStatisticsStore::callGrantStorageAccessHandler(const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void( bool)>&& callback)417 { 418 ASSERT(RunLoop::isMain()); 419 420 c allback(grantStorageAccess(subFrameDomain, topFrameDomain, frameID, pageID));409 return isStorageGranted ? StorageAccessWasGranted::Yes : StorageAccessWasGranted::No; 410 } 411 412 void WebResourceLoadStatisticsStore::callGrantStorageAccessHandler(const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(StorageAccessWasGranted)>&& completionHandler) 413 { 414 ASSERT(RunLoop::isMain()); 415 416 completionHandler(grantStorageAccess(subFrameDomain, topFrameDomain, frameID, pageID)); 421 417 } 422 418 -
trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h
r243671 r245025 49 49 enum class ShouldSample : bool; 50 50 enum class IncludeHttpOnlyCookies : bool; 51 enum class StorageAccessPromptWasShown : bool; 52 enum class StorageAccessWasGranted : bool; 51 53 } 52 54 … … 84 86 using PageID = uint64_t; 85 87 using FrameID = uint64_t; 88 using StorageAccessWasGranted = WebCore::StorageAccessWasGranted; 89 using StorageAccessPromptWasShown = WebCore::StorageAccessPromptWasShown; 86 90 87 91 static Ref<WebResourceLoadStatisticsStore> create(NetworkSession& networkSession, const String& resourceLoadStatisticsDirectory, ShouldIncludeLocalhost shouldIncludeLocalhost) … … 101 105 void setShouldSubmitTelemetry(bool); 102 106 103 void grantStorageAccess(const SubFrameDomain&, const TopFrameDomain&, FrameID, PageID, bool userWasPromptedNow, CompletionHandler<void(bool)>&&);107 void grantStorageAccess(const SubFrameDomain&, const TopFrameDomain&, FrameID, PageID, StorageAccessPromptWasShown, CompletionHandler<void(StorageAccessWasGranted, StorageAccessPromptWasShown)>&&); 104 108 105 109 void applicationWillTerminate(); … … 115 119 void deleteWebsiteDataForRegistrableDomains(OptionSet<WebsiteDataType>, HashMap<RegistrableDomain, WebsiteDataToRemove>&&, bool shouldNotifyPage, CompletionHandler<void(const HashSet<RegistrableDomain>&)>&&); 116 120 void registrableDomainsWithWebsiteData(OptionSet<WebsiteDataType>, bool shouldNotifyPage, CompletionHandler<void(HashSet<RegistrableDomain>&&)>&&); 117 boolgrantStorageAccess(const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID);121 StorageAccessWasGranted grantStorageAccess(const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID); 118 122 void hasHadUserInteraction(const RegistrableDomain&, CompletionHandler<void(bool)>&&); 119 void hasStorageAccess(const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, CompletionHandler<void(bool)>&& callback);123 void hasStorageAccess(const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, CompletionHandler<void(bool)>&&); 120 124 bool hasStorageAccessForFrame(const SubFrameDomain&, const TopFrameDomain&, FrameID, PageID); 121 void requestStorageAccess(const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, CompletionHandler<void(StorageAccessStatus)>&&); 122 void requestStorageAccessGranted(const SubFrameDomain&, const TopFrameDomain&, FrameID, PageID, CompletionHandler<void(bool)>&&); 125 void requestStorageAccess(const SubFrameDomain&, const TopFrameDomain&, FrameID, PageID, CompletionHandler<void(StorageAccessWasGranted, StorageAccessPromptWasShown)>&&); 123 126 void setLastSeen(const RegistrableDomain&, Seconds, CompletionHandler<void()>&&); 124 127 void setPrevalentResource(const RegistrableDomain&, CompletionHandler<void()>&&); … … 163 166 164 167 void logTestingEvent(const String&); 165 void callGrantStorageAccessHandler(const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, CompletionHandler<void( bool)>&&);168 void callGrantStorageAccessHandler(const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, CompletionHandler<void(StorageAccessWasGranted)>&&); 166 169 void removeAllStorageAccess(CompletionHandler<void()>&&); 167 170 void callUpdatePrevalentDomainsToBlockCookiesForHandler(const Vector<RegistrableDomain>&, CompletionHandler<void()>&&); -
trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
r244700 r245025 58 58 #include "WebSWServerToContextConnectionMessages.h" 59 59 #include "WebsiteDataStoreParameters.h" 60 #include <WebCore/DocumentStorageAccess.h> 60 61 #include <WebCore/NetworkStorageSession.h> 61 62 #include <WebCore/ResourceLoadStatistics.h> … … 681 682 void NetworkConnectionToWebProcess::hasStorageAccess(PAL::SessionID sessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler) 682 683 { 683 networkProcess().hasStorageAccess(sessionID, subFrameDomain, topFrameDomain, frameID, pageID, WTFMove(completionHandler)); 684 } 685 686 void NetworkConnectionToWebProcess::requestStorageAccess(PAL::SessionID sessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler) 687 { 688 networkProcess().requestStorageAccessGranted(sessionID, subFrameDomain, topFrameDomain, frameID, pageID, WTFMove(completionHandler)); 684 if (auto networkSession = networkProcess().networkSession(sessionID)) { 685 if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics()) 686 resourceLoadStatistics->hasStorageAccess(subFrameDomain, topFrameDomain, frameID, pageID, WTFMove(completionHandler)); 687 } 688 } 689 690 void NetworkConnectionToWebProcess::requestStorageAccess(PAL::SessionID sessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(WebCore::StorageAccessWasGranted wasGranted, WebCore::StorageAccessPromptWasShown promptWasShown)>&& completionHandler) 691 { 692 if (auto networkSession = networkProcess().networkSession(sessionID)) { 693 if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics()) 694 resourceLoadStatistics->requestStorageAccess(subFrameDomain, topFrameDomain, frameID, pageID, WTFMove(completionHandler)); 695 } 689 696 } 690 697 -
trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h
r244700 r245025 49 49 class ResourceError; 50 50 class ResourceRequest; 51 enum class StorageAccessPromptWasShown : bool; 52 enum class StorageAccessWasGranted : bool; 51 53 struct SameSiteInfo; 52 54 … … 222 224 void resourceLoadStatisticsUpdated(Vector<WebCore::ResourceLoadStatistics>&&); 223 225 void hasStorageAccess(PAL::SessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&&); 224 void requestStorageAccess(PAL::SessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void( bool)>&&);226 void requestStorageAccess(PAL::SessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(WebCore::StorageAccessWasGranted, WebCore::StorageAccessPromptWasShown)>&&); 225 227 void requestStorageAccessUnderOpener(PAL::SessionID, WebCore::RegistrableDomain&& domainInNeedOfStorageAccess, uint64_t openerPageID, WebCore::RegistrableDomain&& openerDomain); 226 228 #endif -
trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in
r243671 r245025 65 65 ResourceLoadStatisticsUpdated(Vector<WebCore::ResourceLoadStatistics> statistics) 66 66 HasStorageAccess(PAL::SessionID sessionID, WebCore::RegistrableDomain subFrameDomain, WebCore::RegistrableDomain topFrameDomain, uint64_t frameID, uint64_t pageID) -> (bool hasStorageAccess) Async 67 RequestStorageAccess(PAL::SessionID sessionID, WebCore::RegistrableDomain subFrameDomain, WebCore::RegistrableDomain topFrameDomain, uint64_t frameID, uint64_t pageID) -> ( bool accessGranted) Async67 RequestStorageAccess(PAL::SessionID sessionID, WebCore::RegistrableDomain subFrameDomain, WebCore::RegistrableDomain topFrameDomain, uint64_t frameID, uint64_t pageID) -> (enum:bool WebCore::StorageAccessWasGranted wasGranted, enum:bool WebCore::StorageAccessPromptWasShown promptWasShown) Async 68 68 RequestStorageAccessUnderOpener(PAL::SessionID sessionID, WebCore::RegistrableDomain domainInNeedOfStorageAccess, uint64_t openerPageID, WebCore::RegistrableDomain openerDomain) 69 69 #endif -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp
r244988 r245025 951 951 } 952 952 953 void NetworkProcess::hasStorageAccessForFrame(PAL::SessionID sessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler)954 {955 bool hasStorageAccess = false;956 if (auto* networkStorageSession = storageSession(sessionID))957 hasStorageAccess = networkStorageSession->hasStorageAccess(subFrameDomain, topFrameDomain, frameID, pageID);958 else959 ASSERT_NOT_REACHED();960 961 completionHandler(hasStorageAccess);962 }963 964 953 void NetworkProcess::getAllStorageAccessEntries(PAL::SessionID sessionID, CompletionHandler<void(Vector<String> domains)>&& completionHandler) 965 954 { … … 972 961 } 973 962 974 void NetworkProcess::hasStorageAccess(PAL::SessionID sessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler)975 {976 if (auto* networkSession = this->networkSession(sessionID)) {977 if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())978 resourceLoadStatistics->hasStorageAccess(subFrameDomain, topFrameDomain, frameID, pageID, WTFMove(completionHandler));979 else980 completionHandler(false);981 } else {982 ASSERT_NOT_REACHED();983 completionHandler(false);984 }985 }986 987 void NetworkProcess::requestStorageAccess(PAL::SessionID sessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(StorageAccessStatus)>&& completionHandler)988 {989 if (auto* networkSession = this->networkSession(sessionID)) {990 if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())991 resourceLoadStatistics->requestStorageAccess(subFrameDomain, topFrameDomain, frameID.value(), pageID, WTFMove(completionHandler));992 else993 completionHandler(StorageAccessStatus::CannotRequestAccess);994 } else {995 ASSERT_NOT_REACHED();996 completionHandler(StorageAccessStatus::CannotRequestAccess);997 }998 }999 1000 void NetworkProcess::requestStorageAccessGranted(PAL::SessionID sessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler)1001 {1002 if (auto* networkSession = this->networkSession(sessionID)) {1003 if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())1004 resourceLoadStatistics->requestStorageAccessGranted(subFrameDomain, topFrameDomain, frameID, pageID, WTFMove(completionHandler));1005 else1006 completionHandler(false);1007 } else {1008 ASSERT_NOT_REACHED();1009 completionHandler(false);1010 }1011 }1012 1013 void NetworkProcess::grantStorageAccess(PAL::SessionID sessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID, bool userWasPrompted, CompletionHandler<void(bool)>&& completionHandler)1014 {1015 // FIXME: We should not accept an optional frame ID since we call frameID.value() unconditionally.1016 if (!frameID) {1017 completionHandler(false);1018 return;1019 }1020 1021 if (auto* networkSession = this->networkSession(sessionID)) {1022 if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())1023 resourceLoadStatistics->grantStorageAccess(subFrameDomain, topFrameDomain, frameID.value(), pageID, userWasPrompted, WTFMove(completionHandler));1024 else1025 completionHandler(false);1026 } else {1027 ASSERT_NOT_REACHED();1028 completionHandler(false);1029 }1030 }1031 1032 963 void NetworkProcess::logFrameNavigation(PAL::SessionID sessionID, const RegistrableDomain& targetDomain, const RegistrableDomain& topFrameDomain, const RegistrableDomain& sourceDomain, bool isRedirect, bool isMainFrame) 1033 964 { … … 1076 1007 completionHandler(); 1077 1008 } 1078 }1079 1080 void NetworkProcess::removeAllStorageAccess(PAL::SessionID sessionID, CompletionHandler<void()>&& completionHandler)1081 {1082 if (auto* networkStorageSession = storageSession(sessionID))1083 networkStorageSession->removeAllStorageAccess();1084 else1085 ASSERT_NOT_REACHED();1086 completionHandler();1087 1009 } 1088 1010 -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.h
r244883 r245025 80 80 enum class IncludeHttpOnlyCookies : bool; 81 81 enum class StoredCredentialsPolicy : uint8_t; 82 enum class StorageAccessPromptWasShown : bool; 83 enum class StorageAccessWasGranted : bool; 82 84 struct ClientOrigin; 83 85 struct MessageWithMessagePorts; … … 226 228 void setPruneEntriesDownTo(PAL::SessionID, uint64_t pruneTargetCount, CompletionHandler<void()>&&); 227 229 void hadUserInteraction(PAL::SessionID, const RegistrableDomain&, CompletionHandler<void(bool)>&&); 228 void hasStorageAccessForFrame(PAL::SessionID, const SubFrameDomain&, const TopFrameDomain&, FrameID, PageID, CompletionHandler<void(bool)>&&);229 230 void getAllStorageAccessEntries(PAL::SessionID, CompletionHandler<void(Vector<String> domains)>&&); 230 void grantStorageAccess(PAL::SessionID, const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, bool userWasPrompted, CompletionHandler<void(bool)>&&);231 void hasStorageAccess(PAL::SessionID, const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, CompletionHandler<void(bool)>&&);232 231 void logFrameNavigation(PAL::SessionID, const NavigatedToDomain&, const TopFrameDomain&, const NavigatedFromDomain&, bool isRedirect, bool isMainFrame); 233 232 void logUserInteraction(PAL::SessionID, const TopFrameDomain&, CompletionHandler<void()>&&); 234 void removeAllStorageAccess(PAL::SessionID, CompletionHandler<void()>&&);235 233 void removePrevalentDomains(PAL::SessionID, const Vector<RegistrableDomain>&); 236 void requestStorageAccess(PAL::SessionID, const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, CompletionHandler<void(StorageAccessStatus)>&&);237 void requestStorageAccessGranted(PAL::SessionID, const SubFrameDomain&, const TopFrameDomain&, FrameID, PageID, CompletionHandler<void(bool)>&&);238 234 void resetCacheMaxAgeCapForPrevalentResources(PAL::SessionID, CompletionHandler<void()>&&); 239 235 void resetParametersToDefaultValues(PAL::SessionID, CompletionHandler<void()>&&); -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in
r244883 r245025 99 99 SetPrevalentResourceForDebugMode(PAL::SessionID sessionID, WebCore::RegistrableDomain resourceDomain) -> () Async 100 100 HadUserInteraction(PAL::SessionID sessionID, WebCore::RegistrableDomain resourceDomain) -> (bool hadUserInteraction) Async 101 HasStorageAccessForFrame(PAL::SessionID sessionID, WebCore::RegistrableDomain subFrameDomain, WebCore::RegistrableDomain topFrameDomain, uint64_t frameID, uint64_t pageID) -> (bool hasStorageAccess) Async102 HasStorageAccess(PAL::SessionID sessionID, WebCore::RegistrableDomain resourceDomain, WebCore::RegistrableDomain topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID) -> (bool hasStorageAccess) Async103 101 GetAllStorageAccessEntries(PAL::SessionID sessionID) -> (Vector<String> domains) Async 104 GrantStorageAccess(PAL::SessionID sessionID, WebCore::RegistrableDomain subFrameDomain, WebCore::RegistrableDomain topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID, bool userWasPrompted) -> (bool accessGranted) Async105 102 IsRegisteredAsRedirectingTo(PAL::SessionID sessionID, WebCore::RegistrableDomain redirectedFromDomain, WebCore::RegistrableDomain redirectedToDomain) -> (bool isRedirectingTo) Async 106 103 IsRegisteredAsSubFrameUnder(PAL::SessionID sessionID, WebCore::RegistrableDomain subFrameDomain, WebCore::RegistrableDomain topFrameDomain) -> (bool isSubframeUnder) Async … … 108 105 LogFrameNavigation(PAL::SessionID sessionID, WebCore::RegistrableDomain targetDomain, WebCore::RegistrableDomain topFrameDomain, WebCore::RegistrableDomain sourceDomain, bool isRedirect, bool isMainFrame) 109 106 LogUserInteraction(PAL::SessionID sessionID, WebCore::RegistrableDomain topFrameDomain) -> () Async 110 RemoveAllStorageAccess(PAL::SessionID sessionID) -> () Async111 107 RemovePrevalentDomains(PAL::SessionID sessionID, Vector<WebCore::RegistrableDomain> domainsWithInteraction) 112 RequestStorageAccess(PAL::SessionID sessionID, WebCore::RegistrableDomain resourceDomain, WebCore::RegistrableDomain topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID) -> (enum:uint8_t WebKit::StorageAccessStatus storageAccessStatus) Async113 108 ResetParametersToDefaultValues(PAL::SessionID sessionID) -> () Async 114 109 ScheduleClearInMemoryAndPersistent(PAL::SessionID sessionID, Optional<WallTime> modifiedSince, enum:bool WebKit::ShouldGrandfatherStatistics shouldGrandfather) -> () Async -
trunk/Source/WebKit/Scripts/webkit/messages.py
r244540 r245025 457 457 'WebCore::ShouldNotifyWhenResolved': ['<WebCore/ServiceWorkerTypes.h>'], 458 458 'WebCore::ShouldSample': ['<WebCore/DiagnosticLoggingClient.h>'], 459 'WebCore::StorageAccessPromptWasShown': ['<WebCore/DocumentStorageAccess.h>'], 460 'WebCore::StorageAccessWasGranted': ['<WebCore/DocumentStorageAccess.h>'], 459 461 'WebCore::SupportedPluginIdentifier': ['<WebCore/PluginData.h>'], 460 462 'WebCore::TextCheckingRequestData': ['<WebCore/TextChecking.h>'], -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
r244288 r245025 727 727 } 728 728 729 void NetworkProcessProxy::hasStorageAccessForFrame(PAL::SessionID sessionID, const RegistrableDomain& resourceDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler)730 {731 if (!canSendMessage()) {732 completionHandler(false);733 return;734 }735 736 sendWithAsyncReply(Messages::NetworkProcess::HasStorageAccessForFrame(sessionID, resourceDomain, topFrameDomain, frameID, pageID), WTFMove(completionHandler));737 }738 739 void NetworkProcessProxy::hasStorageAccess(PAL::SessionID sessionID, const RegistrableDomain& resourceDomain, const RegistrableDomain& topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler)740 {741 if (!canSendMessage()) {742 completionHandler(false);743 return;744 }745 746 sendWithAsyncReply(Messages::NetworkProcess::HasStorageAccess(sessionID, resourceDomain, topFrameDomain, frameID, pageID), WTFMove(completionHandler));747 }748 749 void NetworkProcessProxy::requestStorageAccess(PAL::SessionID sessionID, const RegistrableDomain& resourceDomain, const RegistrableDomain& topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(StorageAccessStatus)>&& completionHandler)750 {751 if (!canSendMessage()) {752 completionHandler(StorageAccessStatus::CannotRequestAccess);753 return;754 }755 756 sendWithAsyncReply(Messages::NetworkProcess::RequestStorageAccess(sessionID, resourceDomain, topFrameDomain, frameID, pageID), WTFMove(completionHandler));757 }758 759 729 void NetworkProcessProxy::requestStorageAccessConfirm(uint64_t pageID, uint64_t frameID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, CompletionHandler<void(bool)>&& completionHandler) 760 730 { … … 766 736 767 737 page->requestStorageAccessConfirm(subFrameDomain, topFrameDomain, frameID, WTFMove(completionHandler)); 768 }769 770 void NetworkProcessProxy::grantStorageAccess(PAL::SessionID sessionID, const RegistrableDomain& resourceDomain, const RegistrableDomain& topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID, bool userWasPrompted, CompletionHandler<void(bool)>&& completionHandler)771 {772 if (!canSendMessage()) {773 completionHandler(false);774 return;775 }776 777 // FIXME: We should not accept an optional frame ID since we call frameID.value() unconditionally.778 if (!frameID) {779 completionHandler(false);780 return;781 }782 783 sendWithAsyncReply(Messages::NetworkProcess::GrantStorageAccess(sessionID, resourceDomain, topFrameDomain, frameID.value(), pageID, userWasPrompted), WTFMove(completionHandler));784 }785 786 void NetworkProcessProxy::removeAllStorageAccess(PAL::SessionID sessionID, CompletionHandler<void()>&& completionHandler)787 {788 if (!canSendMessage()) {789 completionHandler();790 return;791 }792 793 sendWithAsyncReply(Messages::NetworkProcess::RemoveAllStorageAccess(sessionID), WTFMove(completionHandler));794 738 } 795 739 -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
r244288 r245025 50 50 class ResourceRequest; 51 51 enum class ShouldSample : bool; 52 enum class StorageAccessPromptWasShown : bool; 53 enum class StorageAccessWasGranted : bool; 52 54 class SecurityOrigin; 53 55 struct SecurityOriginData; … … 126 128 void setPrevalentResourceForDebugMode(PAL::SessionID, const RegistrableDomain&, CompletionHandler<void()>&&); 127 129 void setVeryPrevalentResource(PAL::SessionID, const RegistrableDomain&, CompletionHandler<void()>&&); 128 void hasStorageAccessForFrame(PAL::SessionID, const RegistrableDomain&, const TopFrameDomain&, FrameID, PageID, CompletionHandler<void(bool)>&&);129 130 void getAllStorageAccessEntries(PAL::SessionID, CompletionHandler<void(Vector<String> domains)>&&); 130 void grantStorageAccess(PAL::SessionID, const RegistrableDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, bool userWasPrompted, CompletionHandler<void(bool)>&&);131 void hasStorageAccess(PAL::SessionID, const RegistrableDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, CompletionHandler<void(bool)>&&);132 void requestStorageAccess(PAL::SessionID, const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, CompletionHandler<void(StorageAccessStatus)>&&);133 131 void requestStorageAccessConfirm(PageID, FrameID, const SubFrameDomain&, const TopFrameDomain&, CompletionHandler<void(bool)>&&); 134 132 void resetParametersToDefaultValues(PAL::SessionID, CompletionHandler<void()>&&); 135 void removeAllStorageAccess(PAL::SessionID, CompletionHandler<void()>&&);136 133 void scheduleClearInMemoryAndPersistent(PAL::SessionID, ShouldGrandfatherStatistics, CompletionHandler<void()>&&); 137 134 void scheduleClearInMemoryAndPersistent(PAL::SessionID, Optional<WallTime> modifiedSince, ShouldGrandfatherStatistics, CompletionHandler<void()>&&); -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
r244883 r245025 1684 1684 } 1685 1685 1686 void WebsiteDataStore::hasStorageAccess(const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler)1687 {1688 if (!resourceLoadStatisticsEnabled()) {1689 completionHandler(false);1690 return;1691 }1692 1693 auto* webPage = WebProcessProxy::webPage(pageID);1694 if (!webPage) {1695 completionHandler(false);1696 return;1697 }1698 1699 if (auto networkProcess = webPage->process().processPool().networkProcess())1700 networkProcess->hasStorageAccess(m_sessionID, WebCore::RegistrableDomain::uncheckedCreateFromHost(subFrameHost), WebCore::RegistrableDomain::uncheckedCreateFromHost(topFrameHost), frameID, pageID, WTFMove(completionHandler));1701 }1702 1703 void WebsiteDataStore::requestStorageAccess(const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, CompletionHandler<void(StorageAccessStatus)>&& completionHandler)1704 {1705 if (!resourceLoadStatisticsEnabled()) {1706 completionHandler(StorageAccessStatus::CannotRequestAccess);1707 return;1708 }1709 1710 auto* webPage = WebProcessProxy::webPage(pageID);1711 if (!webPage) {1712 completionHandler(StorageAccessStatus::CannotRequestAccess);1713 return;1714 }1715 1716 if (auto networkProcess = webPage->process().processPool().networkProcess())1717 networkProcess->requestStorageAccess(m_sessionID, WebCore::RegistrableDomain::uncheckedCreateFromHost(subFrameHost), WebCore::RegistrableDomain::uncheckedCreateFromHost(topFrameHost), frameID, pageID, WTFMove(completionHandler));1718 }1719 1720 void WebsiteDataStore::grantStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool userWasPrompted, CompletionHandler<void(bool)>&& completionHandler)1721 {1722 if (!resourceLoadStatisticsEnabled()) {1723 completionHandler(false);1724 return;1725 }1726 1727 auto* webPage = WebProcessProxy::webPage(pageID);1728 if (!webPage) {1729 completionHandler(false);1730 return;1731 }1732 1733 if (auto networkProcess = webPage->process().processPool().networkProcess())1734 networkProcess->grantStorageAccess(m_sessionID, WebCore::RegistrableDomain::uncheckedCreateFromHost(subFrameHost), WebCore::RegistrableDomain::uncheckedCreateFromHost(topFrameHost), frameID, pageID, userWasPrompted, WTFMove(completionHandler));1735 }1736 1686 1737 1687 void WebsiteDataStore::setTimeToLiveUserInteraction(Seconds seconds, CompletionHandler<void()>&& completionHandler) -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
r244382 r245025 170 170 void setStatisticsTestingCallback(WTF::Function<void(const String&)>&& callback) { m_statisticsTestingCallback = WTFMove(callback); } 171 171 void setVeryPrevalentResource(const URL&, CompletionHandler<void()>&&); 172 void hasStorageAccess(const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&&);173 void requestStorageAccess(const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, CompletionHandler<void(StorageAccessStatus)>&&);174 void grantStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool userWasPrompted, CompletionHandler<void(bool)>&&);175 172 void setSubframeUnderTopFrameDomain(const URL& subframe, const URL& topFrame); 176 173 void setCrossSiteLoadWithLinkDecorationForTesting(const URL& fromURL, const URL& toURL, CompletionHandler<void()>&&); -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
r244633 r245025 63 63 #include <WebCore/DatabaseTracker.h> 64 64 #include <WebCore/DocumentLoader.h> 65 #include <WebCore/DocumentStorageAccess.h> 65 66 #include <WebCore/FileChooser.h> 66 67 #include <WebCore/FileIconLoader.h> … … 77 78 #include <WebCore/NotImplemented.h> 78 79 #include <WebCore/Page.h> 80 #include <WebCore/RegistrableDomain.h> 79 81 #include <WebCore/ScriptController.h> 80 82 #include <WebCore/SecurityOrigin.h> … … 1312 1314 1313 1315 #if ENABLE(RESOURCE_LOAD_STATISTICS) 1314 void WebChromeClient::hasStorageAccess( String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t, CompletionHandler<void(bool)>&& callback)1315 { 1316 m_page.hasStorageAccess(WTFMove(subFrame Host), WTFMove(topFrameHost), frameID, WTFMove(callback));1317 } 1318 1319 void WebChromeClient::requestStorageAccess( String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t, CompletionHandler<void(bool)>&& callback)1320 { 1321 m_page.requestStorageAccess(WTFMove(subFrame Host), WTFMove(topFrameHost), frameID, WTFMove(callback));1316 void WebChromeClient::hasStorageAccess(RegistrableDomain&& subFrameDomain, RegistrableDomain&& topFrameDomain, uint64_t frameID, uint64_t, CompletionHandler<void(bool)>&& completionHandler) 1317 { 1318 m_page.hasStorageAccess(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, WTFMove(completionHandler)); 1319 } 1320 1321 void WebChromeClient::requestStorageAccess(RegistrableDomain&& subFrameDomain, RegistrableDomain&& topFrameDomain, uint64_t frameID, uint64_t, CompletionHandler<void(StorageAccessWasGranted, StorageAccessPromptWasShown)>&& completionHandler) 1322 { 1323 m_page.requestStorageAccess(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, WTFMove(completionHandler)); 1322 1324 } 1323 1325 #endif -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
r244633 r245025 29 29 #include <WebCore/ChromeClient.h> 30 30 31 namespace WebCore { 32 class RegistrableDomain; 33 enum class StorageAccessPromptWasShown : bool; 34 enum class StorageAccessWasGranted : bool; 35 } 36 31 37 namespace WebKit { 32 38 … … 364 370 365 371 #if ENABLE(RESOURCE_LOAD_STATISTICS) 366 void hasStorageAccess( String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(bool)>&&) final;367 void requestStorageAccess( String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&&) final;372 void hasStorageAccess(WebCore::RegistrableDomain&& subFrameDomain, WebCore::RegistrableDomain&& topFrameDomain, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(bool)>&&) final; 373 void requestStorageAccess(WebCore::RegistrableDomain&& subFrameDomain, WebCore::RegistrableDomain&& topFrameDomain, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(WebCore::StorageAccessWasGranted, WebCore::StorageAccessPromptWasShown)>&&) final; 368 374 #endif 369 375 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r244993 r245025 148 148 #include <WebCore/DocumentLoader.h> 149 149 #include <WebCore/DocumentMarkerController.h> 150 #include <WebCore/DocumentStorageAccess.h> 150 151 #include <WebCore/DragController.h> 151 152 #include <WebCore/DragData.h> … … 6441 6442 6442 6443 #if ENABLE(RESOURCE_LOAD_STATISTICS) 6443 void WebPage::hasStorageAccess( String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& completionHandler)6444 { 6445 WebProcess::singleton().ensureNetworkProcessConnection().connection().sendWithAsyncReply(Messages::NetworkConnectionToWebProcess::HasStorageAccess(sessionID(), RegistrableDomain::uncheckedCreateFromHost(subFrameHost), RegistrableDomain::uncheckedCreateFromHost(topFrameHost), frameID, m_pageID), WTFMove(completionHandler));6446 } 6447 6448 void WebPage::requestStorageAccess( String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& completionHandler)6449 { 6450 WebProcess::singleton().ensureNetworkProcessConnection().connection().sendWithAsyncReply(Messages::NetworkConnectionToWebProcess::RequestStorageAccess(sessionID(), RegistrableDomain::uncheckedCreateFromHost(subFrameHost), RegistrableDomain::uncheckedCreateFromHost(topFrameHost), frameID, m_pageID), WTFMove(completionHandler));6444 void WebPage::hasStorageAccess(RegistrableDomain&& subFrameDomain, RegistrableDomain&& topFrameDomain, uint64_t frameID, CompletionHandler<void(bool)>&& completionHandler) 6445 { 6446 WebProcess::singleton().ensureNetworkProcessConnection().connection().sendWithAsyncReply(Messages::NetworkConnectionToWebProcess::HasStorageAccess(sessionID(), WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, m_pageID), WTFMove(completionHandler)); 6447 } 6448 6449 void WebPage::requestStorageAccess(RegistrableDomain&& subFrameDomain, RegistrableDomain&& topFrameDomain, uint64_t frameID, CompletionHandler<void(WebCore::StorageAccessWasGranted, WebCore::StorageAccessPromptWasShown)>&& completionHandler) 6450 { 6451 WebProcess::singleton().ensureNetworkProcessConnection().connection().sendWithAsyncReply(Messages::NetworkConnectionToWebProcess::RequestStorageAccess(sessionID(), WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, m_pageID), WTFMove(completionHandler)); 6451 6452 } 6452 6453 #endif -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r244944 r245025 178 178 enum class DragHandlingMethod : uint8_t; 179 179 enum class ShouldTreatAsContinuingLoad : bool; 180 enum class StorageAccessPromptWasShown : bool; 181 enum class StorageAccessWasGranted : bool; 180 182 enum class TextIndicatorPresentationTransition : uint8_t; 181 183 enum class WritingDirection : uint8_t; … … 1119 1121 1120 1122 #if ENABLE(RESOURCE_LOAD_STATISTICS) 1121 void hasStorageAccess( String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& callback);1122 void requestStorageAccess( String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& callback);1123 void hasStorageAccess(WebCore::RegistrableDomain&& subFrameDomain, WebCore::RegistrableDomain&& topFrameDomain, uint64_t frameID, CompletionHandler<void(bool)>&&); 1124 void requestStorageAccess(WebCore::RegistrableDomain&& subFrameDomain, WebCore::RegistrableDomain&& topFrameDomain, uint64_t frameID, CompletionHandler<void(WebCore::StorageAccessWasGranted, WebCore::StorageAccessPromptWasShown)>&&); 1123 1125 #endif 1124 1126
Note: See TracChangeset
for help on using the changeset viewer.