WebKit Bugzilla
Attachment 369233 Details for
Bug 197648
: Storage Access API: Make two changes requested by developers and complete refactoring and cleanup
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-197648-20190506223231.patch (text/plain), 152.90 KB, created by
John Wilander
on 2019-05-06 22:32:31 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
John Wilander
Created:
2019-05-06 22:32:31 PDT
Size:
152.90 KB
patch
obsolete
>Subversion Revision: 245001 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 0424c9ec70e9c0a56068721f57896aeb2774aa97..75760ae29c4ee1664927f456309eeea4f996ea7c 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,64 @@ >+2019-05-06 John Wilander <wilander@apple.com> >+ >+ Storage Access API: Make two changes requested by developers and complete refactoring and cleanup >+ https://bugs.webkit.org/show_bug.cgi?id=197648 >+ <rdar://problem/50527493> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Developers have requested two minor changes to the Storage Access API: >+ - Only consume the user gesture when the user explicitly denies access. >+ - Make document.hasStorageAccess() return true instead of false when the feature is off. >+ >+ In addition to this, we have refactoring and cleanup to do. Namely: >+ - Make use of WebCore::RegistrableDomain all the way. >+ - Remove dead code in WebKit::NetworkProcess since the call now go through NetworkConnectionToWebProcess. >+ - Fix some weird naming. >+ - Introduce boolean enums for state handling. >+ - Break out the Storage Access API functionality into a supplement of WebCore::Document. >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Tests: http/tests/storageAccess/deny-with-prompt-does-not-preserve-gesture.html >+ http/tests/storageAccess/deny-without-prompt-preserves-gesture.html >+ http/tests/storageAccess/grant-with-prompt-preserves-gesture.html >+ http/tests/storageAccess/has-storage-access-true-if-feature-off.html >+ >+ * DerivedSources-input.xcfilelist: >+ * DerivedSources-output.xcfilelist: >+ * DerivedSources.make: >+ * Sources.txt: >+ * WebCore.xcodeproj/project.pbxproj: >+ * dom/Document.cpp: >+ (WebCore::Document::hasStorageAccess): Deleted. >+ (WebCore::Document::requestStorageAccess): Deleted. >+ (WebCore::Document::enableTemporaryTimeUserGesture): Deleted. >+ (WebCore::Document::consumeTemporaryTimeUserGesture): Deleted. >+ (WebCore::Document::hasFrameSpecificStorageAccess const): Deleted. >+ (WebCore::Document::setHasFrameSpecificStorageAccess): Deleted. >+ * dom/Document.h: >+ (WebCore::Document::setUserGrantsStorageAccessOverride): Deleted. >+ All of this has been moved to the supplement WebCore::DocumentStorageAccess. >+ * dom/Document.idl: >+ The Storage Access API has been moved to DocumentStorageAccess.idl. >+ * dom/DocumentStorageAccess.cpp: Added. >+ (WebCore::DocumentStorageAccess::from): >+ (WebCore::DocumentStorageAccess::supplementName): >+ (WebCore::DocumentStorageAccess::hasStorageAccess): >+ (WebCore::DocumentStorageAccess::requestStorageAccess): >+ (WebCore::DocumentStorageAccess::enableTemporaryTimeUserGesture): >+ (WebCore::DocumentStorageAccess::consumeTemporaryTimeUserGesture): >+ (WebCore::DocumentStorageAccess::hasFrameSpecificStorageAccess const): >+ (WebCore::DocumentStorageAccess::setHasFrameSpecificStorageAccess): >+ * dom/DocumentStorageAccess.h: Added. >+ * dom/DocumentStorageAccess.idl: Added. >+ * page/ChromeClient.h: >+ * testing/Internals.cpp: >+ (WebCore::Internals::setUserGrantsStorageAccess): Deleted. >+ This was dead code. >+ * testing/Internals.h: >+ * testing/Internals.idl: >+ > 2019-05-06 James Savage <james.savage@apple.com> > > Improve coordination for creating UIWindow instances. >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 75c373d088fe7b2d1838e768a8aeae09da4ee4df..bd62fcc504a50c01dd47d86ac713fa8bf1b1a3ed 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,107 @@ >+2019-05-06 John Wilander <wilander@apple.com> >+ >+ Storage Access API: Make two changes requested by developers and complete refactoring and cleanup >+ https://bugs.webkit.org/show_bug.cgi?id=197648 >+ <rdar://problem/50527493> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Developers have requested two minor changes to the Storage Access API: >+ - Only consume the user gesture when the user explicitly denies access. >+ - Make document.hasStorageAccess() return true instead of false when the feature is off. >+ >+ In addition to this, we have refactoring and cleanup to do. Namely: >+ - Make use of WebCore::RegistrableDomain all the way. >+ - Remove dead code in WebKit::NetworkProcess since the call now go through NetworkConnectionToWebProcess. >+ - Fix some weird naming. >+ - Introduce boolean enums for state handling. >+ - Break out the Storage Access API functionality into a supplement of WebCore::Document. >+ >+ * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: >+ (WebKit::ResourceLoadStatisticsDatabaseStore::insertDomainRelationships): >+ (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess): >+ (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener): >+ (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccess): >+ (WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal): >+ (WebKit::ResourceLoadStatisticsDatabaseStore::hasUserGrantedStorageAccessThroughPrompt const): >+ These changes are due to the new enums WebCore::StorageAccessWasGranted and >+ WebCore::StorageAccessPromptWasShown. >+ * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: >+ * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: >+ (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess): >+ (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener): >+ (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccess): >+ (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal): >+ (WebKit::ResourceLoadStatisticsMemoryStore::hasUserGrantedStorageAccessThroughPrompt): >+ These changes are due to the new enums WebCore::StorageAccessWasGranted and >+ WebCore::StorageAccessPromptWasShown. >+ * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: >+ * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: >+ These changes are due to the new enums WebCore::StorageAccessWasGranted and >+ WebCore::StorageAccessPromptWasShown. >+ * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: >+ (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess): >+ (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess): >+ (WebKit::WebResourceLoadStatisticsStore::callGrantStorageAccessHandler): >+ These changes are due to the new enums WebCore::StorageAccessWasGranted and >+ WebCore::StorageAccessPromptWasShown. >+ (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessGranted): Deleted. >+ This function is now no longer exposed and its functionality could be folded into >+ the existing WebResourceLoadStatisticsStore::requestStorageAccess() which is more >+ clearly named. >+ * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: >+ * NetworkProcess/NetworkConnectionToWebProcess.cpp: >+ (WebKit::NetworkConnectionToWebProcess::hasStorageAccess): >+ (WebKit::NetworkConnectionToWebProcess::requestStorageAccess): >+ These changes are due to the new enums WebCore::StorageAccessWasGranted and >+ WebCore::StorageAccessPromptWasShown. >+ * NetworkProcess/NetworkConnectionToWebProcess.h: >+ * NetworkProcess/NetworkConnectionToWebProcess.messages.in: >+ * NetworkProcess/NetworkProcess.cpp: >+ (WebKit::NetworkProcess::hasStorageAccessForFrame): Deleted. >+ (WebKit::NetworkProcess::hasStorageAccess): Deleted. >+ (WebKit::NetworkProcess::requestStorageAccess): Deleted. >+ (WebKit::NetworkProcess::requestStorageAccessGranted): Deleted. >+ (WebKit::NetworkProcess::grantStorageAccess): Deleted. >+ (WebKit::NetworkProcess::removeAllStorageAccess): Deleted. >+ These functions were left behind in the move of ITP to the network process. >+ This communication goes through WebKit::NetworkConnectionToWebProcess since a while back. >+ * NetworkProcess/NetworkProcess.h: >+ * NetworkProcess/NetworkProcess.messages.in: >+ * Scripts/webkit/messages.py: >+ Instructions for derived IPC code on how to include the new enums >+ WebCore::StorageAccessWasGranted and WebCore::StorageAccessPromptWasShown. >+ * UIProcess/Network/NetworkProcessProxy.cpp: >+ (WebKit::NetworkProcessProxy::hasStorageAccessForFrame): Deleted. >+ (WebKit::NetworkProcessProxy::hasStorageAccess): Deleted. >+ (WebKit::NetworkProcessProxy::requestStorageAccess): Deleted. >+ (WebKit::NetworkProcessProxy::grantStorageAccess): Deleted. >+ (WebKit::NetworkProcessProxy::removeAllStorageAccess): Deleted. >+ These functions were left behind in the move of ITP to the network process. >+ This communication goes through WebKit::NetworkConnectionToWebProcess since a while back. >+ * UIProcess/Network/NetworkProcessProxy.h: >+ * UIProcess/WebsiteData/WebsiteDataStore.cpp: >+ (WebKit::WebsiteDataStore::hasStorageAccess): Deleted. >+ (WebKit::WebsiteDataStore::requestStorageAccess): Deleted. >+ (WebKit::WebsiteDataStore::grantStorageAccess): Deleted. >+ These functions were left behind in the move of ITP to the network process. >+ This communication goes through WebKit::NetworkConnectionToWebProcess since a while back. >+ * UIProcess/WebsiteData/WebsiteDataStore.h: >+ * WebProcess/WebCoreSupport/WebChromeClient.cpp: >+ (WebKit::WebChromeClient::hasStorageAccess): >+ (WebKit::WebChromeClient::requestStorageAccess): >+ These changes are due to the new enums WebCore::StorageAccessWasGranted and >+ WebCore::StorageAccessPromptWasShown. They also receive WebCore::RegistrableDomain >+ objects instead of Strings now. >+ * WebProcess/WebCoreSupport/WebChromeClient.h: >+ * WebProcess/WebPage/WebPage.cpp: >+ (WebKit::WebPage::hasStorageAccess): >+ (WebKit::WebPage::requestStorageAccess): >+ These changes are due to the new enums WebCore::StorageAccessWasGranted and >+ WebCore::StorageAccessPromptWasShown. They also receive WebCore::RegistrableDomain >+ objects instead of Strings now. >+ * WebProcess/WebPage/WebPage.h: >+ > 2019-05-06 James Savage <james.savage@apple.com> > > Improve coordination for creating UIWindow instances. >diff --git a/Source/WebCore/DerivedSources-input.xcfilelist b/Source/WebCore/DerivedSources-input.xcfilelist >index c35133e0ccb72d3443434c4e19e710ff449571b6..ef284f5c6fa8c617467b391f01763ca2ec785f89 100644 >--- a/Source/WebCore/DerivedSources-input.xcfilelist >+++ b/Source/WebCore/DerivedSources-input.xcfilelist >@@ -562,6 +562,7 @@ $(PROJECT_DIR)/dom/DocumentAndElementEventHandlers.idl > $(PROJECT_DIR)/dom/DocumentFragment.idl > $(PROJECT_DIR)/dom/DocumentFullscreen.idl > $(PROJECT_DIR)/dom/DocumentOrShadowRoot.idl >+$(PROJECT_DIR)/dom/DocumentStorageAccess.idl > $(PROJECT_DIR)/dom/DocumentTouch.idl > $(PROJECT_DIR)/dom/DocumentType.idl > $(PROJECT_DIR)/dom/Element.idl >diff --git a/Source/WebCore/DerivedSources-output.xcfilelist b/Source/WebCore/DerivedSources-output.xcfilelist >index 1a8c932a363dcb203462d2c3df4eec8daafd6eaf..8bd7f9d38ad8ded1f761ccb4434ca4bb01520999 100644 >--- a/Source/WebCore/DerivedSources-output.xcfilelist >+++ b/Source/WebCore/DerivedSources-output.xcfilelist >@@ -473,6 +473,8 @@ $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSDocumentFullscreen.cpp > $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSDocumentFullscreen.h > $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSDocumentOrShadowRoot.cpp > $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSDocumentOrShadowRoot.h >+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSDocumentStorageAccess.cpp >+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSDocumentStorageAccess.h > $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSDocumentTimeline.cpp > $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSDocumentTimeline.h > $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSDocumentTimelineOptions.cpp >diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make >index 0433fab8874a50193676884016cebf16d5880e04..f456b458c19488eb628dc39bd39a4424605662ae 100644 >--- a/Source/WebCore/DerivedSources.make >+++ b/Source/WebCore/DerivedSources.make >@@ -584,6 +584,7 @@ JS_BINDING_IDLS = \ > $(WebCore)/dom/DocumentFullscreen.idl \ > $(WebCore)/dom/DocumentFragment.idl \ > $(WebCore)/dom/DocumentOrShadowRoot.idl \ >+ $(WebCore)/dom/DocumentStorageAccess.idl \ > $(WebCore)/dom/DocumentType.idl \ > $(WebCore)/dom/Element.idl \ > $(WebCore)/dom/ErrorEvent.idl \ >diff --git a/Source/WebCore/Sources.txt b/Source/WebCore/Sources.txt >index ba6097e9b747080ec81095fc0c0f8288b0616831..bcecba9089766f90f950c21783af62e118ffb6cc 100644 >--- a/Source/WebCore/Sources.txt >+++ b/Source/WebCore/Sources.txt >@@ -844,6 +844,7 @@ dom/DocumentFragment.cpp > dom/DocumentMarkerController.cpp > dom/DocumentParser.cpp > dom/DocumentSharedObjectPool.cpp >+dom/DocumentStorageAccess.cpp > dom/DocumentTouch.cpp @no-unify > dom/DocumentType.cpp > dom/Element.cpp >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index 0dcdc874a7b977faa86ed24746610db588b1ef93..680d6446f594c5f5bce02500f0ac5151ff7759a6 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -1975,6 +1975,7 @@ > 6B3480940EEF50D400AC1B41 /* NativeImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B3480920EEF50D400AC1B41 /* NativeImage.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 6B4E8613221B713F0022F389 /* RegistrableDomain.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B4E8612221B713F0022F389 /* RegistrableDomain.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 6B693A2E1C51A82E00B03BEF /* ResourceLoadObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B693A2D1C51A82E00B03BEF /* ResourceLoadObserver.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ 6BDB5DC2227BD3B800919770 /* DocumentStorageAccess.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BDB5DC0227BD3B800919770 /* DocumentStorageAccess.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 6C4C96DF1AD4483500363F64 /* JSReadableByteStreamController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C4C96DB1AD4483500363F64 /* JSReadableByteStreamController.h */; }; > 6C4C96DF1AD4483500365672 /* JSReadableStreamBYOBRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C4C96DB1AD4483500365672 /* JSReadableStreamBYOBRequest.h */; }; > 6C4C96DF1AD4483500365A50 /* JSReadableStreamDefaultController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C4C96DB1AD4483500365A50 /* JSReadableStreamDefaultController.h */; settings = {ATTRIBUTES = (Private, ); }; }; >@@ -9037,6 +9038,9 @@ > 6B4E8612221B713F0022F389 /* RegistrableDomain.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RegistrableDomain.h; sourceTree = "<group>"; }; > 6B693A2D1C51A82E00B03BEF /* ResourceLoadObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadObserver.h; sourceTree = "<group>"; }; > 6B693A331C51A95D00B03BEF /* ResourceLoadObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceLoadObserver.cpp; sourceTree = "<group>"; }; >+ 6BDB5DC0227BD3B800919770 /* DocumentStorageAccess.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DocumentStorageAccess.h; sourceTree = "<group>"; }; >+ 6BDB5DC1227BD3B800919770 /* DocumentStorageAccess.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentStorageAccess.cpp; sourceTree = "<group>"; }; >+ 6BDB5DC5227CA0EB00919770 /* DocumentStorageAccess.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = DocumentStorageAccess.idl; sourceTree = "<group>"; }; > 6C4C96DA1AD4483500363F64 /* JSReadableByteStreamController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSReadableByteStreamController.cpp; sourceTree = "<group>"; }; > 6C4C96DA1AD4483500365672 /* JSReadableStreamBYOBRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSReadableStreamBYOBRequest.cpp; sourceTree = "<group>"; }; > 6C4C96DA1AD4483500365A50 /* JSReadableStreamDefaultController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSReadableStreamDefaultController.cpp; sourceTree = "<group>"; }; >@@ -25921,10 +25925,10 @@ > CDE3A85517F6020400C5BE20 /* AudioTrackPrivateAVFObjC.mm */, > CD54A760180F9F7000B076C9 /* AudioTrackPrivateMediaSourceAVFObjC.cpp */, > CD54A761180F9F7000B076C9 /* AudioTrackPrivateMediaSourceAVFObjC.h */, >- CDECA8991EDF447D00DCB08B /* AVAssetTrackUtilities.h */, >- CDECA8981EDF447D00DCB08B /* AVAssetTrackUtilities.mm */, > 07C8AD121D073D630087C5CE /* AVAssetMIMETypeCache.h */, > 07C8AD111D073D630087C5CE /* AVAssetMIMETypeCache.mm */, >+ CDECA8991EDF447D00DCB08B /* AVAssetTrackUtilities.h */, >+ CDECA8981EDF447D00DCB08B /* AVAssetTrackUtilities.mm */, > CD11B3DF227CAAA90023AFC7 /* AVStreamDataParserMIMETypeCache.h */, > CD11B3E0227CAAA90023AFC7 /* AVStreamDataParserMIMETypeCache.mm */, > CD78A2EE1F75648600DE371B /* CDMInstanceFairPlayStreamingAVFObjC.h */, >@@ -27227,6 +27231,9 @@ > BCCFBAE70B5152ED0001F1D7 /* DocumentParser.h */, > AD6E71AA1668899D00320C13 /* DocumentSharedObjectPool.cpp */, > AD6E71AB1668899D00320C13 /* DocumentSharedObjectPool.h */, >+ 6BDB5DC1227BD3B800919770 /* DocumentStorageAccess.cpp */, >+ 6BDB5DC0227BD3B800919770 /* DocumentStorageAccess.h */, >+ 6BDB5DC5227CA0EB00919770 /* DocumentStorageAccess.idl */, > 86D982F6125C154000AD9E3D /* DocumentTiming.h */, > 7CE7FA5B1EF882300060C9D6 /* DocumentTouch.cpp */, > 7CE7FA591EF882300060C9D6 /* DocumentTouch.h */, >@@ -28234,11 +28241,11 @@ > C9D467051E60C465008195FB /* AutoplayEvent.h in Headers */, > 45830D4E1679B4F800ACF8C3 /* AutoscrollController.h in Headers */, > A8CFF04E0A154F09000A4234 /* AutoTableLayout.h in Headers */, >+ 07F4E93320B3587F002E3803 /* AVAssetMIMETypeCache.h in Headers */, > CDECA89B1EDF447D00DCB08B /* AVAssetTrackUtilities.h in Headers */, > CDC675271EAEA9D400727C84 /* AVAudioSessionCaptureDevice.h in Headers */, > CDC675231EAEA9B700727C84 /* AVAudioSessionCaptureDeviceManager.h in Headers */, > 070363E2181A1CDC00C074A5 /* AVCaptureDeviceManager.h in Headers */, >- 07F4E93320B3587F002E3803 /* AVAssetMIMETypeCache.h in Headers */, > CD336F6217F9F64700DDDCD0 /* AVTrackPrivateAVFObjCImpl.h in Headers */, > 070363E6181A1CDC00C074A5 /* AVVideoCaptureSource.h in Headers */, > 29AE212D21AB9EEB00869283 /* AXIsolatedTree.h in Headers */, >@@ -28795,6 +28802,7 @@ > BCCFBAE80B5152ED0001F1D7 /* DocumentParser.h in Headers */, > 4A4F48AA16B0DFC000EDBB29 /* DocumentRuleSets.h in Headers */, > AD6E71AD1668899D00320C13 /* DocumentSharedObjectPool.h in Headers */, >+ 6BDB5DC2227BD3B800919770 /* DocumentStorageAccess.h in Headers */, > 0B90561A0F2578BF0095FF6A /* DocumentThreadableLoader.h in Headers */, > 71025ED01F99F0CE004A250C /* DocumentTimeline.h in Headers */, > 71729F7B20F3BA4900801CE6 /* DocumentTimelineOptions.h in Headers */, >@@ -32575,10 +32583,11 @@ > CDE3A85717F6020400C5BE20 /* AudioTrackPrivateAVFObjC.mm in Sources */, > CD54A762180F9F7000B076C9 /* AudioTrackPrivateMediaSourceAVFObjC.cpp in Sources */, > A5F6E16B132ED46E008EDAE3 /* Autocapitalize.cpp in Sources */, >+ 0719427F1D088F21002AA51D /* AVAssetMIMETypeCache.mm in Sources */, > CDECA89A1EDF447D00DCB08B /* AVAssetTrackUtilities.mm in Sources */, > CDC675221EAEA9B700727C84 /* AVAudioSessionCaptureDeviceManager.mm in Sources */, > 070363E3181A1CDC00C074A5 /* AVCaptureDeviceManager.mm in Sources */, >- 0719427F1D088F21002AA51D /* AVAssetMIMETypeCache.mm in Sources */, >+ CD11B3E1227CE6F30023AFC7 /* AVStreamDataParserMIMETypeCache.mm in Sources */, > CD336F6117F9F64700DDDCD0 /* AVTrackPrivateAVFObjCImpl.mm in Sources */, > 070363E7181A1CDC00C074A5 /* AVVideoCaptureSource.mm in Sources */, > 7A45032F18DB717200377B34 /* BufferedLineReader.cpp in Sources */, >@@ -33021,7 +33030,6 @@ > DECA80391F9FED6A00E3B661 /* UnifiedSource248.cpp in Sources */, > DECA803A1F9FED6A00E3B661 /* UnifiedSource249.cpp in Sources */, > DECA803B1F9FED6A00E3B661 /* UnifiedSource250.cpp in Sources */, >- CD11B3E1227CE6F30023AFC7 /* AVStreamDataParserMIMETypeCache.mm in Sources */, > DECA803C1F9FED6A00E3B661 /* UnifiedSource251.cpp in Sources */, > DECA803D1F9FED6A00E3B661 /* UnifiedSource252.cpp in Sources */, > DECA803E1F9FED6A00E3B661 /* UnifiedSource253.cpp in Sources */, >diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp >index ce429277c7eac60022375d9cb89e8d651d43daa0..86a2abd55b39e3e476715d4f01f4a89c83450535 100644 >--- a/Source/WebCore/dom/Document.cpp >+++ b/Source/WebCore/dom/Document.cpp >@@ -112,7 +112,6 @@ > #include "InspectorInstrumentation.h" > #include "IntersectionObserver.h" > #include "JSCustomElementInterface.h" >-#include "JSDOMPromiseDeferred.h" > #include "JSLazyEventListener.h" > #include "KeyboardEvent.h" > #include "KeyframeEffect.h" >@@ -7731,147 +7730,6 @@ Optional<uint64_t> Document::pageID() const > return m_frame->loader().client().pageID(); > } > >-void Document::hasStorageAccess(Ref<DeferredPromise>&& promise) >-{ >- ASSERT(settings().storageAccessAPIEnabled()); >- >-#if ENABLE(RESOURCE_LOAD_STATISTICS) >- if (m_frame && hasFrameSpecificStorageAccess()) { >- promise->resolve<IDLBoolean>(true); >- return; >- } >- >- if (!m_frame || securityOrigin().isUnique()) { >- promise->resolve<IDLBoolean>(false); >- return; >- } >- >- if (m_frame->isMainFrame()) { >- promise->resolve<IDLBoolean>(true); >- return; >- } >- >- auto& securityOrigin = this->securityOrigin(); >- auto& topSecurityOrigin = topDocument().securityOrigin(); >- if (securityOrigin.equal(&topSecurityOrigin)) { >- promise->resolve<IDLBoolean>(true); >- return; >- } >- >- auto frameID = m_frame->loader().client().frameID(); >- auto pageID = m_frame->loader().client().pageID(); >- if (!frameID || !pageID) { >- promise->reject(); >- return; >- } >- >- if (Page* page = this->page()) { >- auto iframeHost = securityOrigin.host(); >- auto topHost = topSecurityOrigin.host(); >- page->chrome().client().hasStorageAccess(WTFMove(iframeHost), WTFMove(topHost), frameID.value(), pageID.value(), [documentReference = makeWeakPtr(*this), promise = WTFMove(promise)] (bool hasAccess) { >- Document* document = documentReference.get(); >- if (!document) >- return; >- >- promise->resolve<IDLBoolean>(hasAccess); >- }); >- return; >- } >-#endif >- >- promise->reject(); >-} >- >-void Document::requestStorageAccess(Ref<DeferredPromise>&& promise) >-{ >- ASSERT(settings().storageAccessAPIEnabled()); >- >-#if ENABLE(RESOURCE_LOAD_STATISTICS) >- if (m_frame && hasFrameSpecificStorageAccess()) { >- promise->resolve(); >- return; >- } >- >- if (!m_frame || securityOrigin().isUnique()) { >- promise->reject(); >- return; >- } >- >- if (m_frame->isMainFrame()) { >- promise->resolve(); >- return; >- } >- >- auto& topDocument = this->topDocument(); >- auto& topSecurityOrigin = topDocument.securityOrigin(); >- auto& securityOrigin = this->securityOrigin(); >- if (securityOrigin.equal(&topSecurityOrigin)) { >- promise->resolve(); >- return; >- } >- >- // If there is a sandbox, it has to allow the storage access API to be called. >- if (sandboxFlags() != SandboxNone && isSandboxed(SandboxStorageAccessByUserActivation)) { >- promise->reject(); >- return; >- } >- >- // The iframe has to be a direct child of the top document. >- if (&topDocument != parentDocument()) { >- promise->reject(); >- return; >- } >- >- if (!UserGestureIndicator::processingUserGesture()) { >- promise->reject(); >- return; >- } >- >- auto iframeHost = securityOrigin.host(); >- auto topHost = topSecurityOrigin.host(); >- >- Page* page = this->page(); >- auto frameID = m_frame->loader().client().frameID(); >- auto pageID = m_frame->loader().client().pageID(); >- if (!page || !frameID || !pageID) { >- promise->reject(); >- return; >- } >- >- page->chrome().client().requestStorageAccess(WTFMove(iframeHost), WTFMove(topHost), frameID.value(), pageID.value(), [documentReference = makeWeakPtr(*this), promise = WTFMove(promise)] (bool wasGranted) mutable { >- Document* document = documentReference.get(); >- if (!document) >- return; >- >- if (wasGranted) { >- document->setHasFrameSpecificStorageAccess(true); >- MicrotaskQueue::mainThreadQueue().append(std::make_unique<VoidMicrotask>([documentReference = makeWeakPtr(*document)] () { >- if (auto* document = documentReference.get()) >- document->enableTemporaryTimeUserGesture(); >- })); >- promise->resolve(); >- MicrotaskQueue::mainThreadQueue().append(std::make_unique<VoidMicrotask>([documentReference = WTFMove(documentReference)] () { >- if (auto* document = documentReference.get()) >- document->consumeTemporaryTimeUserGesture(); >- })); >- } else >- promise->reject(); >- }); >-#else >- promise->reject(); >-#endif >-} >- >-void Document::enableTemporaryTimeUserGesture() >-{ >- m_temporaryUserGesture = std::make_unique<UserGestureIndicator>(ProcessingUserGesture, this); >-} >- >-void Document::consumeTemporaryTimeUserGesture() >-{ >- m_temporaryUserGesture = nullptr; >-} >- > void Document::registerArticleElement(Element& article) > { > m_articleElements.add(&article); >@@ -7939,17 +7797,6 @@ void Document::updateMainArticleElementAfterLayout() > } > > #if ENABLE(RESOURCE_LOAD_STATISTICS) >-bool Document::hasFrameSpecificStorageAccess() const >-{ >- return m_frame && m_frame->loader().client().hasFrameSpecificStorageAccess(); >-} >- >-void Document::setHasFrameSpecificStorageAccess(bool value) >-{ >- if (m_frame) >- m_frame->loader().client().setHasFrameSpecificStorageAccess(value); >-} >- > bool Document::hasRequestedPageSpecificStorageAccessWithUserInteraction(const RegistrableDomain& domain) > { > return m_registrableDomainRequestedPageSpecificStorageAccessWithUserInteraction == domain; >diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h >index a1f1f3085532ec4cbf69189096c486b91d00bd98..135ef0b6cd8ce5515ce471eac2023ffa8e48757b 100644 >--- a/Source/WebCore/dom/Document.h >+++ b/Source/WebCore/dom/Document.h >@@ -108,7 +108,6 @@ class DOMWindow; > class DOMWrapperWorld; > class Database; > class DatabaseThread; >-class DeferredPromise; > class DocumentFragment; > class DocumentLoader; > class DocumentMarkerController; >@@ -1465,10 +1464,6 @@ public: > > Logger& logger(); > >- void hasStorageAccess(Ref<DeferredPromise>&& passedPromise); >- void requestStorageAccess(Ref<DeferredPromise>&& passedPromise); >- void setUserGrantsStorageAccessOverride(bool value) { m_grantStorageAccessOverride = value; } >- > WEBCORE_EXPORT void setConsoleMessageListener(RefPtr<StringCallback>&&); // For testing. > > WEBCORE_EXPORT DocumentTimeline& timeline(); >@@ -1502,8 +1497,6 @@ public: > > String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String& challengeString, const URL&); > >- void consumeTemporaryTimeUserGesture(); >- > void registerArticleElement(Element&); > void unregisterArticleElement(Element&); > void updateMainArticleElementAfterLayout(); >@@ -1645,8 +1638,6 @@ private: > > void platformSuspendOrStopActiveDOMObjects(); > >- void enableTemporaryTimeUserGesture(); >- > bool isBodyPotentiallyScrollable(HTMLBodyElement&); > > const Ref<Settings> m_settings; >@@ -1851,11 +1842,6 @@ private: > > void didLogMessage(const WTFLogChannel&, WTFLogLevel, Vector<JSONLogValue>&&) final; > >-#if ENABLE(RESOURCE_LOAD_STATISTICS) >- bool hasFrameSpecificStorageAccess() const; >- void setHasFrameSpecificStorageAccess(bool); >-#endif >- > #if ENABLE(DEVICE_ORIENTATION) > #if PLATFORM(IOS_FAMILY) > std::unique_ptr<DeviceMotionClient> m_deviceMotionClient; >@@ -2033,8 +2019,6 @@ private: > > static bool hasEverCreatedAnAXObjectCache; > >- bool m_grantStorageAccessOverride { false }; >- > RefPtr<DocumentTimeline> m_timeline; > DocumentIdentifier m_identifier; > >@@ -2048,8 +2032,6 @@ private: > RegistrableDomain m_registrableDomainRequestedPageSpecificStorageAccessWithUserInteraction { }; > #endif > >- std::unique_ptr<UserGestureIndicator> m_temporaryUserGesture; >- > CSSRegisteredCustomPropertySet m_CSSRegisteredPropertySet; > > #if ENABLE(CSS_PAINTING_API) >diff --git a/Source/WebCore/dom/Document.idl b/Source/WebCore/dom/Document.idl >index 43b911028294ad3fbf1780d79a032b8e095334ce..5649b6c3c70850a9ce4680ec18de5bfdb23271c0 100644 >--- a/Source/WebCore/dom/Document.idl >+++ b/Source/WebCore/dom/Document.idl >@@ -173,10 +173,6 @@ typedef ( > // FIXME: This is not standard and has been dropped from Blink already. > RenderingContext? getCSSCanvasContext(DOMString contextId, DOMString name, long width, long height); > >- // Non standard, to bring up with standards working group. >- [EnabledBySetting=StorageAccessAPI] Promise<bool> hasStorageAccess(); >- [EnabledBySetting=StorageAccessAPI] Promise<void> requestStorageAccess(); >- > // Obsolete features from https://html.spec.whatwg.org/multipage/obsolete.html > > [CEReactions] attribute [TreatNullAs=EmptyString] DOMString fgColor; >diff --git a/Source/WebCore/dom/DocumentStorageAccess.cpp b/Source/WebCore/dom/DocumentStorageAccess.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..dd1f8bba9c46c0e87a26fe5002b3614c8d8719c6 >--- /dev/null >+++ b/Source/WebCore/dom/DocumentStorageAccess.cpp >@@ -0,0 +1,231 @@ >+/* >+ * Copyright (C) 2019 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "DocumentStorageAccess.h" >+ >+#if ENABLE(RESOURCE_LOAD_STATISTICS) >+ >+#include "Chrome.h" >+#include "ChromeClient.h" >+#include "Document.h" >+#include "Frame.h" >+#include "FrameLoader.h" >+#include "FrameLoaderClient.h" >+#include "JSDOMPromiseDeferred.h" >+#include "Microtasks.h" >+#include "Page.h" >+#include "RegistrableDomain.h" >+#include "SecurityOrigin.h" >+#include "Settings.h" >+#include "UserGestureIndicator.h" >+ >+namespace WebCore { >+ >+DocumentStorageAccess* DocumentStorageAccess::from(Document& document) >+{ >+ auto* supplement = static_cast<DocumentStorageAccess*>(Supplement<Document>::from(&document, supplementName())); >+ if (!supplement) { >+ auto newSupplement = std::make_unique<DocumentStorageAccess>(document); >+ supplement = newSupplement.get(); >+ provideTo(&document, supplementName(), WTFMove(newSupplement)); >+ } >+ return supplement; >+} >+ >+const char* DocumentStorageAccess::supplementName() >+{ >+ return "DocumentStorageAccess"_s; >+} >+ >+void DocumentStorageAccess::hasStorageAccess(Document& document, Ref<DeferredPromise>&& promise) >+{ >+ DocumentStorageAccess::from(document)->hasStorageAccess(WTFMove(promise)); >+} >+ >+void DocumentStorageAccess::requestStorageAccess(Document& document, Ref<DeferredPromise>&& promise) >+{ >+ DocumentStorageAccess::from(document)->requestStorageAccess(WTFMove(promise)); >+} >+ >+void DocumentStorageAccess::hasStorageAccess(Ref<DeferredPromise>&& promise) >+{ >+ ASSERT(m_document.settings().storageAccessAPIEnabled()); >+ >+ if (m_document.frame() && hasFrameSpecificStorageAccess()) { >+ promise->resolve<IDLBoolean>(true); >+ return; >+ } >+ >+ if (!m_document.frame() || m_document.securityOrigin().isUnique()) { >+ promise->resolve<IDLBoolean>(false); >+ return; >+ } >+ >+ if (m_document.frame()->isMainFrame()) { >+ promise->resolve<IDLBoolean>(true); >+ return; >+ } >+ >+ auto& securityOrigin = m_document.securityOrigin(); >+ auto& topSecurityOrigin = m_document.topDocument().securityOrigin(); >+ if (securityOrigin.equal(&topSecurityOrigin)) { >+ promise->resolve<IDLBoolean>(true); >+ return; >+ } >+ >+ auto frameID = m_document.frame()->loader().client().frameID(); >+ auto pageID = m_document.frame()->loader().client().pageID(); >+ if (!frameID || !pageID) { >+ promise->reject(); >+ return; >+ } >+ >+ if (Page* page = m_document.page()) { >+ auto subFrameDomain = RegistrableDomain::uncheckedCreateFromHost(securityOrigin.host()); >+ auto topFrameDomain = RegistrableDomain::uncheckedCreateFromHost(topSecurityOrigin.host()); >+ page->chrome().client().hasStorageAccess(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID.value(), pageID.value(), [documentReference = makeWeakPtr(*this), promise = WTFMove(promise)] (bool hasAccess) { >+ DocumentStorageAccess* document = documentReference.get(); >+ if (!document) >+ return; >+ >+ promise->resolve<IDLBoolean>(hasAccess); >+ }); >+ return; >+ } >+ >+ promise->reject(); >+} >+ >+void DocumentStorageAccess::requestStorageAccess(Ref<DeferredPromise>&& promise) >+{ >+ ASSERT(m_document.settings().storageAccessAPIEnabled()); >+ >+ if (m_document.frame() && hasFrameSpecificStorageAccess()) { >+ promise->resolve(); >+ return; >+ } >+ >+ if (!m_document.frame() || m_document.securityOrigin().isUnique()) { >+ promise->reject(); >+ return; >+ } >+ >+ if (m_document.frame()->isMainFrame()) { >+ promise->resolve(); >+ return; >+ } >+ >+ auto& topDocument = m_document.topDocument(); >+ auto& topSecurityOrigin = topDocument.securityOrigin(); >+ auto& securityOrigin = m_document.securityOrigin(); >+ if (securityOrigin.equal(&topSecurityOrigin)) { >+ promise->resolve(); >+ return; >+ } >+ >+ // If there is a sandbox, it has to allow the storage access API to be called. >+ if (m_document.sandboxFlags() != SandboxNone && m_document.isSandboxed(SandboxStorageAccessByUserActivation)) { >+ promise->reject(); >+ return; >+ } >+ >+ // The iframe has to be a direct child of the top document. >+ if (&topDocument != m_document.parentDocument()) { >+ promise->reject(); >+ return; >+ } >+ >+ if (!UserGestureIndicator::processingUserGesture()) { >+ promise->reject(); >+ return; >+ } >+ >+ Page* page = m_document.page(); >+ auto frameID = m_document.frame()->loader().client().frameID(); >+ auto pageID = m_document.frame()->loader().client().pageID(); >+ if (!page || !frameID || !pageID) { >+ promise->reject(); >+ return; >+ } >+ >+ auto subFrameDomain = RegistrableDomain::uncheckedCreateFromHost(securityOrigin.host()); >+ auto topFrameDomain = RegistrableDomain::uncheckedCreateFromHost(topSecurityOrigin.host()); >+ >+ page->chrome().client().requestStorageAccess(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID.value(), pageID.value(), [documentReference = makeWeakPtr(*this), promise = WTFMove(promise)] (StorageAccessWasGranted wasGranted, StorageAccessPromptWasShown promptWasShown) mutable { >+ DocumentStorageAccess* document = documentReference.get(); >+ if (!document) >+ return; >+ >+ // Consume the user gesture only if the user explicitly denied access. >+ bool shouldPreserveUserGesture = wasGranted == StorageAccessWasGranted::Yes || promptWasShown == StorageAccessPromptWasShown::No; >+ >+ if (shouldPreserveUserGesture) { >+ MicrotaskQueue::mainThreadQueue().append(std::make_unique<VoidMicrotask>([documentReference = makeWeakPtr(*document)] () { >+ if (auto* document = documentReference.get()) >+ document->enableTemporaryTimeUserGesture(); >+ })); >+ } >+ >+ if (wasGranted == StorageAccessWasGranted::Yes) { >+ document->setHasFrameSpecificStorageAccess(true); >+ promise->resolve(); >+ } else >+ promise->reject(); >+ >+ if (shouldPreserveUserGesture) { >+ MicrotaskQueue::mainThreadQueue().append(std::make_unique<VoidMicrotask>([documentReference = WTFMove(documentReference)] () { >+ if (auto* document = documentReference.get()) >+ document->consumeTemporaryTimeUserGesture(); >+ })); >+ } >+ }); >+} >+ >+void DocumentStorageAccess::enableTemporaryTimeUserGesture() >+{ >+ m_temporaryUserGesture = std::make_unique<UserGestureIndicator>(ProcessingUserGesture, &m_document); >+} >+ >+void DocumentStorageAccess::consumeTemporaryTimeUserGesture() >+{ >+ m_temporaryUserGesture = nullptr; >+} >+ >+bool DocumentStorageAccess::hasFrameSpecificStorageAccess() const >+{ >+ auto* frame = m_document.frame(); >+ return frame && frame->loader().client().hasFrameSpecificStorageAccess(); >+} >+ >+void DocumentStorageAccess::setHasFrameSpecificStorageAccess(bool value) >+{ >+ if (auto* frame = m_document.frame()) >+ frame->loader().client().setHasFrameSpecificStorageAccess(value); >+} >+ >+} // namespace WebCore >+ >+#endif // ENABLE(RESOURCE_LOAD_STATISTICS) >diff --git a/Source/WebCore/dom/DocumentStorageAccess.h b/Source/WebCore/dom/DocumentStorageAccess.h >new file mode 100644 >index 0000000000000000000000000000000000000000..6a6f8c19d38aac330cef5ad4d33875ae5315a45c >--- /dev/null >+++ b/Source/WebCore/dom/DocumentStorageAccess.h >@@ -0,0 +1,77 @@ >+/* >+ * Copyright (C) 2019 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(RESOURCE_LOAD_STATISTICS) >+ >+#include "Supplementable.h" >+#include <wtf/WeakPtr.h> >+ >+namespace WebCore { >+ >+class DeferredPromise; >+class Document; >+class UserGestureIndicator; >+ >+enum class StorageAccessWasGranted : bool { >+ No, >+ Yes >+}; >+ >+enum class StorageAccessPromptWasShown : bool { >+ No, >+ Yes >+}; >+ >+class DocumentStorageAccess final : public Supplement<Document>, public CanMakeWeakPtr<DocumentStorageAccess> { >+ WTF_MAKE_FAST_ALLOCATED; >+public: >+ explicit DocumentStorageAccess(Document& document) >+ : m_document(document) >+ { >+ } >+ >+ static void hasStorageAccess(Document&, Ref<DeferredPromise>&&); >+ static void requestStorageAccess(Document&, Ref<DeferredPromise>&&); >+ >+private: >+ void hasStorageAccess(Ref<DeferredPromise>&&); >+ void requestStorageAccess(Ref<DeferredPromise>&&); >+ static DocumentStorageAccess* from(Document&); >+ static const char* supplementName(); >+ bool hasFrameSpecificStorageAccess() const; >+ void setHasFrameSpecificStorageAccess(bool); >+ void enableTemporaryTimeUserGesture(); >+ void consumeTemporaryTimeUserGesture(); >+ >+ std::unique_ptr<UserGestureIndicator> m_temporaryUserGesture; >+ >+ Document& m_document; >+}; >+ >+} // namespace WebCore >+ >+#endif // ENABLE(RESOURCE_LOAD_STATISTICS) >diff --git a/Source/WebCore/dom/DocumentStorageAccess.idl b/Source/WebCore/dom/DocumentStorageAccess.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..4de3c5f20c7454de4f0f4a33972f7b0c01e774e0 >--- /dev/null >+++ b/Source/WebCore/dom/DocumentStorageAccess.idl >@@ -0,0 +1,31 @@ >+/* >+ * Copyright (C) 2019 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ Conditional=RESOURCE_LOAD_STATISTICS, >+] partial interface Document { >+ Promise<bool> hasStorageAccess(); >+ Promise<void> requestStorageAccess(); >+}; >diff --git a/Source/WebCore/page/ChromeClient.h b/Source/WebCore/page/ChromeClient.h >index cddf13cae88930e236e9409f92efc2ffd40bf5d9..06db4144041a51006500b496871bb31ee4db42b3 100644 >--- a/Source/WebCore/page/ChromeClient.h >+++ b/Source/WebCore/page/ChromeClient.h >@@ -28,6 +28,7 @@ > #include "DeviceOrientationOrMotionPermissionState.h" > #include "DisabledAdaptations.h" > #include "DisplayRefreshMonitor.h" >+#include "DocumentStorageAccess.h" > #include "FocusDirection.h" > #include "FrameLoader.h" > #include "GraphicsContext.h" >@@ -40,6 +41,7 @@ > #include "MediaProducer.h" > #include "PopupMenu.h" > #include "PopupMenuClient.h" >+#include "RegistrableDomain.h" > #include "RenderEmbeddedObject.h" > #include "ScrollTypes.h" > #include "ScrollingCoordinator.h" >@@ -483,8 +485,8 @@ public: > virtual void reportProcessCPUTime(Seconds, ActivityStateForCPUSampling) { } > virtual RefPtr<Icon> createIconForFiles(const Vector<String>& /* filenames */) = 0; > >- virtual void hasStorageAccess(String&& /*subFrameHost*/, String&& /*topFrameHost*/, uint64_t /*frameID*/, uint64_t /*pageID*/, WTF::CompletionHandler<void (bool)>&& callback) { callback(false); } >- virtual void requestStorageAccess(String&& /*subFrameHost*/, String&& /*topFrameHost*/, uint64_t /*frameID*/, uint64_t /*pageID*/, WTF::CompletionHandler<void (bool)>&& callback) { callback(false); } >+ virtual void hasStorageAccess(RegistrableDomain&& /*subFrameDomain*/, RegistrableDomain&& /*topFrameDomain*/, uint64_t /*frameID*/, uint64_t /*pageID*/, WTF::CompletionHandler<void(bool)>&& completionHandler) { completionHandler(false); } >+ virtual void requestStorageAccess(RegistrableDomain&& /*subFrameDomain*/, RegistrableDomain&& /*topFrameDomain*/, uint64_t /*frameID*/, uint64_t /*pageID*/, WTF::CompletionHandler<void(StorageAccessWasGranted, StorageAccessPromptWasShown)>&& completionHandler) { completionHandler(StorageAccessWasGranted::No, StorageAccessPromptWasShown::No); } > > #if ENABLE(DEVICE_ORIENTATION) > virtual void shouldAllowDeviceOrientationAndMotionAccess(Frame&, bool /* mayPrompt */, WTF::CompletionHandler<void(DeviceOrientationOrMotionPermissionState)>&& callback) { callback(DeviceOrientationOrMotionPermissionState::Denied); } >diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp >index d4cd40b7eb8d64ca8a3792240d1bc2029fe709c8..3b7614bd108e2b00c86c252ff3ff0ea4c3c88a65 100644 >--- a/Source/WebCore/testing/Internals.cpp >+++ b/Source/WebCore/testing/Internals.cpp >@@ -4377,15 +4377,6 @@ void Internals::setResourceLoadStatisticsEnabled(bool enable) > DeprecatedGlobalSettings::setResourceLoadStatisticsEnabled(enable); > } > >-void Internals::setUserGrantsStorageAccess(bool value) >-{ >- Document* document = contextDocument(); >- if (!document) >- return; >- >- document->setUserGrantsStorageAccessOverride(value); >-} >- > String Internals::composedTreeAsText(Node& node) > { > if (!is<ContainerNode>(node)) >diff --git a/Source/WebCore/testing/Internals.h b/Source/WebCore/testing/Internals.h >index 491197a86d177680ebe7d589c840ca913d760b90..7dc527661f1141845d2a43efae8858932f152d78 100644 >--- a/Source/WebCore/testing/Internals.h >+++ b/Source/WebCore/testing/Internals.h >@@ -639,7 +639,6 @@ public: > > String resourceLoadStatisticsForURL(const DOMURL&); > void setResourceLoadStatisticsEnabled(bool); >- void setUserGrantsStorageAccess(bool); > > #if ENABLE(STREAMS_API) > bool isReadableStreamDisturbed(JSC::ExecState&, JSC::JSValue); >diff --git a/Source/WebCore/testing/Internals.idl b/Source/WebCore/testing/Internals.idl >index 78d4b88a65182158a35c78b5bcd2ddec4551e39d..5c7b23626608abb536694f09468ef3b8447bdc6c 100644 >--- a/Source/WebCore/testing/Internals.idl >+++ b/Source/WebCore/testing/Internals.idl >@@ -625,7 +625,6 @@ enum CompositingPolicy { > > DOMString resourceLoadStatisticsForURL(DOMURL url); > void setResourceLoadStatisticsEnabled(boolean enable); >- [EnabledBySetting=StorageAccessAPI] void setUserGrantsStorageAccess(boolean value); > > [MayThrowException] void setCanShowModalDialogOverride(boolean allow); > >diff --git a/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp b/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp >index 5c276aba8bbf20c9fffaeb10fa181cfda373f25d..c6b845f44a20bc27aff0385c725b5df95cf22e1e 100644 >--- a/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp >+++ b/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp >@@ -37,6 +37,7 @@ > #include "WebProcessProxy.h" > #include "WebResourceLoadStatisticsTelemetry.h" > #include "WebsiteDataStore.h" >+#include <WebCore/DocumentStorageAccess.h> > #include <WebCore/KeyedCoding.h> > #include <WebCore/NetworkStorageSession.h> > #include <WebCore/ResourceLoadStatistics.h> >@@ -453,7 +454,7 @@ unsigned ResourceLoadStatisticsDatabaseStore::domainID(const RegistrableDomain& > return domainID; > } > >-void ResourceLoadStatisticsDatabaseStore::insertDomainRelationships(const WebCore::ResourceLoadStatistics& loadStatistics) >+void ResourceLoadStatisticsDatabaseStore::insertDomainRelationships(const ResourceLoadStatistics& loadStatistics) > { > ASSERT(!RunLoop::isMain()); > >@@ -768,7 +769,7 @@ void ResourceLoadStatisticsDatabaseStore::requestStorageAccess(SubFrameDomain&& > }; > > auto userWasPromptedEarlier = hasUserGrantedStorageAccessThroughPrompt(subFrameStatus.second, topFrameDomain); >- if (!userWasPromptedEarlier) { >+ if (userWasPromptedEarlier == StorageAccessPromptWasShown::No) { > #if !RELEASE_LOG_DISABLED > 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()); > #endif >@@ -777,7 +778,7 @@ void ResourceLoadStatisticsDatabaseStore::requestStorageAccess(SubFrameDomain&& > } > > #if !RELEASE_LOG_DISABLED >- if (userWasPromptedEarlier) >+ if (userWasPromptedEarlier == StorageAccessPromptWasShown::Yes) > RELEASE_LOG_INFO_IF(debugLoggingEnabled(), ResourceLoadStatisticsDebug, "Storage access was granted to %{public}s under %{public}s.", subFrameDomain.string().utf8().data(), topFrameDomain.string().utf8().data()); > #endif > >@@ -788,8 +789,8 @@ void ResourceLoadStatisticsDatabaseStore::requestStorageAccess(SubFrameDomain&& > ASSERT_NOT_REACHED(); > } > >- grantStorageAccessInternal(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, pageID, userWasPromptedEarlier, [completionHandler = WTFMove(completionHandler)] (bool wasGrantedAccess) mutable { >- completionHandler(wasGrantedAccess ? StorageAccessStatus::HasAccess : StorageAccessStatus::CannotRequestAccess); >+ grantStorageAccessInternal(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, pageID, userWasPromptedEarlier, [completionHandler = WTFMove(completionHandler)] (StorageAccessWasGranted wasGranted) mutable { >+ completionHandler(wasGranted == StorageAccessWasGranted::Yes ? StorageAccessStatus::HasAccess : StorageAccessStatus::CannotRequestAccess); > }); > } > >@@ -809,46 +810,46 @@ void ResourceLoadStatisticsDatabaseStore::requestStorageAccessUnderOpener(Domain > #if !RELEASE_LOG_DISABLED > 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()); > #endif >- grantStorageAccessInternal(WTFMove(domainInNeedOfStorageAccess), WTFMove(openerDomain), WTF::nullopt, openerPageID, false, [](bool) { }); >+ grantStorageAccessInternal(WTFMove(domainInNeedOfStorageAccess), WTFMove(openerDomain), WTF::nullopt, openerPageID, StorageAccessPromptWasShown::No, [](StorageAccessWasGranted) { }); > } > >-void ResourceLoadStatisticsDatabaseStore::grantStorageAccess(SubFrameDomain&& subFrameDomain, TopFrameDomain&& topFrameDomain, uint64_t frameID, uint64_t pageID, bool userWasPromptedNow, CompletionHandler<void(bool)>&& completionHandler) >+void ResourceLoadStatisticsDatabaseStore::grantStorageAccess(SubFrameDomain&& subFrameDomain, TopFrameDomain&& topFrameDomain, uint64_t frameID, uint64_t pageID, StorageAccessPromptWasShown promptWasShown, CompletionHandler<void(StorageAccessWasGranted)>&& completionHandler) > { > ASSERT(!RunLoop::isMain()); > >- if (userWasPromptedNow) { >+ if (promptWasShown == StorageAccessPromptWasShown::Yes) { > auto subFrameStatus = ensureResourceStatisticsForRegistrableDomain(subFrameDomain); > ASSERT(subFrameStatus.first == AddedRecord::No); > ASSERT(hasHadUserInteraction(subFrameDomain, OperatingDatesWindow::Long)); > insertDomainRelationship(m_storageAccessUnderTopFrameDomainsStatement, subFrameStatus.second, topFrameDomain); > } > >- grantStorageAccessInternal(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, pageID, userWasPromptedNow, WTFMove(completionHandler)); >+ grantStorageAccessInternal(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, pageID, promptWasShown, WTFMove(completionHandler)); > } > >-void ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal(SubFrameDomain&& subFrameDomain, TopFrameDomain&& topFrameDomain, Optional<FrameID> frameID, PageID pageID, bool userWasPromptedNowOrEarlier, CompletionHandler<void(bool)>&& callback) >+void ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal(SubFrameDomain&& subFrameDomain, TopFrameDomain&& topFrameDomain, Optional<FrameID> frameID, PageID pageID, StorageAccessPromptWasShown promptWasShownNowOrEarlier, CompletionHandler<void(StorageAccessWasGranted)>&& completionHandler) > { > ASSERT(!RunLoop::isMain()); > > if (subFrameDomain == topFrameDomain) { >- callback(true); >+ completionHandler(StorageAccessWasGranted::Yes); > return; > } > >- if (userWasPromptedNowOrEarlier) { >+ if (promptWasShownNowOrEarlier == StorageAccessPromptWasShown::Yes) { > #ifndef NDEBUG > auto subFrameStatus = ensureResourceStatisticsForRegistrableDomain(subFrameDomain); > ASSERT(subFrameStatus.first == AddedRecord::No); > ASSERT(hasHadUserInteraction(subFrameDomain, OperatingDatesWindow::Long)); >- ASSERT(hasUserGrantedStorageAccessThroughPrompt(subFrameStatus.second, topFrameDomain)); >+ ASSERT(hasUserGrantedStorageAccessThroughPrompt(subFrameStatus.second, topFrameDomain) == StorageAccessPromptWasShown::Yes); > #endif > setUserInteraction(subFrameDomain, true, WallTime::now()); > } > >- RunLoop::main().dispatch([subFrameDomain = subFrameDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), frameID, pageID, store = makeRef(store()), callback = WTFMove(callback)]() mutable { >- store->callGrantStorageAccessHandler(subFrameDomain, topFrameDomain, frameID, pageID, [callback = WTFMove(callback), store = store.copyRef()](bool value) mutable { >- store->statisticsQueue().dispatch([callback = WTFMove(callback), value] () mutable { >- callback(value); >+ RunLoop::main().dispatch([subFrameDomain = subFrameDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), frameID, pageID, store = makeRef(store()), completionHandler = WTFMove(completionHandler)]() mutable { >+ store->callGrantStorageAccessHandler(subFrameDomain, topFrameDomain, frameID, pageID, [completionHandler = WTFMove(completionHandler), store = store.copyRef()](StorageAccessWasGranted wasGranted) mutable { >+ store->statisticsQueue().dispatch([wasGranted, completionHandler = WTFMove(completionHandler)] () mutable { >+ completionHandler(wasGranted); > }); > }); > }); >@@ -1349,7 +1350,7 @@ ResourceLoadStatisticsDatabaseStore::CookieTreatmentResult ResourceLoadStatistic > return hadUserInteraction ? CookieTreatmentResult::BlockAndKeep : CookieTreatmentResult::BlockAndPurge; > } > >-bool ResourceLoadStatisticsDatabaseStore::hasUserGrantedStorageAccessThroughPrompt(unsigned requestingDomainID, const RegistrableDomain& firstPartyDomain) const >+StorageAccessPromptWasShown ResourceLoadStatisticsDatabaseStore::hasUserGrantedStorageAccessThroughPrompt(unsigned requestingDomainID, const RegistrableDomain& firstPartyDomain) const > { > ASSERT(!RunLoop::isMain()); > >@@ -1358,9 +1359,9 @@ bool ResourceLoadStatisticsDatabaseStore::hasUserGrantedStorageAccessThroughProm > SQLiteStatement statement(m_database, makeString("SELECT COUNT(*) FROM StorageAccessUnderTopFrameDomains WHERE domainID = ", String::number(requestingDomainID), " AND topLevelDomainID = ", String::number(firstPartyPrimaryDomainID))); > if (statement.prepare() != SQLITE_OK > || statement.step() != SQLITE_ROW) >- return false; >+ return StorageAccessPromptWasShown::No; > >- return !statement.getColumnInt(0); >+ return !statement.getColumnInt(0) ? StorageAccessPromptWasShown::Yes : StorageAccessPromptWasShown::No; > } > > Vector<RegistrableDomain> ResourceLoadStatisticsDatabaseStore::domainsToBlock() const >diff --git a/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h b/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h >index 12946a6b05737b52be80315f42be4d86f617624e..bab2b7aeab760d2a3e1ecbde8b75853755e3ae90 100644 >--- a/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h >+++ b/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h >@@ -39,6 +39,8 @@ > namespace WebCore { > class SQLiteDatabase; > class SQLiteStatement; >+enum class StorageAccessPromptWasShown : bool; >+enum class StorageAccessWasGranted : bool; > struct ResourceLoadStatistics; > } > >@@ -91,7 +93,7 @@ public: > > void hasStorageAccess(const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, CompletionHandler<void(bool)>&&) override; > void requestStorageAccess(SubFrameDomain&&, TopFrameDomain&&, FrameID, PageID, CompletionHandler<void(StorageAccessStatus)>&&) override; >- void grantStorageAccess(SubFrameDomain&&, TopFrameDomain&&, FrameID, PageID, bool userWasPromptedNow, CompletionHandler<void(bool)>&&) override; >+ void grantStorageAccess(SubFrameDomain&&, TopFrameDomain&&, FrameID, PageID, WebCore::StorageAccessPromptWasShown, CompletionHandler<void(WebCore::StorageAccessWasGranted)>&&) override; > > void logFrameNavigation(const NavigatedToDomain&, const TopFrameDomain&, const NavigatedFromDomain&, bool isRedirect, bool isMainFrame) override; > void logUserInteraction(const TopFrameDomain&) override; >@@ -128,7 +130,7 @@ private: > Vector<unsigned> findExpiredUserInteractions() const; > void clearExpiredUserInteractions(); > void clearGrandfathering(Vector<unsigned>&&); >- bool hasUserGrantedStorageAccessThroughPrompt(unsigned domainID, const RegistrableDomain&) const; >+ WebCore::StorageAccessPromptWasShown hasUserGrantedStorageAccessThroughPrompt(unsigned domainID, const RegistrableDomain&) const; > void incrementRecordsDeletedCountForDomains(HashSet<RegistrableDomain>&&) override; > > void reclassifyResources(); >@@ -150,7 +152,7 @@ private: > void setPrevalentResource(const RegistrableDomain&, ResourceLoadPrevalence); > unsigned recursivelyFindNonPrevalentDomainsThatRedirectedToThisDomain(unsigned primaryDomainID, StdSet<unsigned>& nonPrevalentRedirectionSources, unsigned numberOfRecursiveCalls); > void setDomainsAsPrevalent(StdSet<unsigned>&&); >- void grantStorageAccessInternal(SubFrameDomain&&, TopFrameDomain&&, Optional<FrameID>, PageID, bool userWasPromptedNowOrEarlier, CompletionHandler<void(bool)>&&); >+ void grantStorageAccessInternal(SubFrameDomain&&, TopFrameDomain&&, Optional<FrameID>, PageID, WebCore::StorageAccessPromptWasShown, CompletionHandler<void(WebCore::StorageAccessWasGranted)>&&); > void markAsPrevalentIfHasRedirectedToPrevalent(); > Vector<RegistrableDomain> ensurePrevalentResourcesForDebugMode() override; > void removeDataRecords(CompletionHandler<void()>&&); >diff --git a/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp b/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp >index 69f792430ffe65b3683332574cf243e0fc7b0917..f8f68824644c82e53dfb396b909f0bfa1476860d 100644 >--- a/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp >+++ b/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp >@@ -37,6 +37,7 @@ > #include "WebProcessProxy.h" > #include "WebResourceLoadStatisticsTelemetry.h" > #include "WebsiteDataStore.h" >+#include <WebCore/DocumentStorageAccess.h> > #include <WebCore/KeyedCoding.h> > #include <WebCore/NetworkStorageSession.h> > #include <WebCore/ResourceLoadStatistics.h> >@@ -244,7 +245,7 @@ void ResourceLoadStatisticsMemoryStore::requestStorageAccess(SubFrameDomain&& su > } > > auto userWasPromptedEarlier = hasUserGrantedStorageAccessThroughPrompt(subFrameStatistic, topFrameDomain); >- if (!userWasPromptedEarlier) { >+ if (userWasPromptedEarlier == StorageAccessPromptWasShown::No) { > #if !RELEASE_LOG_DISABLED > 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()); > #endif >@@ -253,14 +254,14 @@ void ResourceLoadStatisticsMemoryStore::requestStorageAccess(SubFrameDomain&& su > } > > #if !RELEASE_LOG_DISABLED >- if (userWasPromptedEarlier) >+ if (userWasPromptedEarlier == StorageAccessPromptWasShown::Yes) > RELEASE_LOG_INFO_IF(debugLoggingEnabled(), ResourceLoadStatisticsDebug, "Storage access was granted to %{public}s under %{public}s.", subFrameDomain.string().utf8().data(), topFrameDomain.string().utf8().data()); > #endif > > subFrameStatistic.timesAccessedAsFirstPartyDueToStorageAccessAPI++; > >- grantStorageAccessInternal(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, pageID, userWasPromptedEarlier, [completionHandler = WTFMove(completionHandler)] (bool wasGrantedAccess) mutable { >- completionHandler(wasGrantedAccess ? StorageAccessStatus::HasAccess : StorageAccessStatus::CannotRequestAccess); >+ grantStorageAccessInternal(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, pageID, userWasPromptedEarlier, [completionHandler = WTFMove(completionHandler)] (StorageAccessWasGranted wasGranted) mutable { >+ completionHandler(wasGranted == StorageAccessWasGranted::Yes ? StorageAccessStatus::HasAccess : StorageAccessStatus::CannotRequestAccess); > }); > } > >@@ -282,41 +283,41 @@ void ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener(DomainIn > #if !RELEASE_LOG_DISABLED > 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()); > #endif >- grantStorageAccessInternal(WTFMove(domainInNeedOfStorageAccess), WTFMove(openerDomain), WTF::nullopt, openerPageID, false, [](bool) { }); >+ grantStorageAccessInternal(WTFMove(domainInNeedOfStorageAccess), WTFMove(openerDomain), WTF::nullopt, openerPageID, StorageAccessPromptWasShown::No, [](StorageAccessWasGranted) { }); > } > >-void ResourceLoadStatisticsMemoryStore::grantStorageAccess(SubFrameDomain&& subFrameDomain, TopFrameDomain&& topFrameDomain, uint64_t frameID, uint64_t pageID, bool userWasPromptedNow, CompletionHandler<void(bool)>&& completionHandler) >+void ResourceLoadStatisticsMemoryStore::grantStorageAccess(SubFrameDomain&& subFrameDomain, TopFrameDomain&& topFrameDomain, uint64_t frameID, uint64_t pageID, StorageAccessPromptWasShown promptWasShown, CompletionHandler<void(StorageAccessWasGranted)>&& completionHandler) > { > ASSERT(!RunLoop::isMain()); > >- if (userWasPromptedNow) { >+ if (promptWasShown == StorageAccessPromptWasShown::Yes) { > auto& subFrameStatistic = ensureResourceStatisticsForRegistrableDomain(subFrameDomain); > ASSERT(subFrameStatistic.hadUserInteraction); > subFrameStatistic.storageAccessUnderTopFrameDomains.add(topFrameDomain); > } >- grantStorageAccessInternal(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, pageID, userWasPromptedNow, WTFMove(completionHandler)); >+ grantStorageAccessInternal(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, pageID, promptWasShown, WTFMove(completionHandler)); > } > >-void ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal(SubFrameDomain&& subFrameDomain, TopFrameDomain&& topFrameDomain, Optional<FrameID> frameID, PageID pageID, bool userWasPromptedNowOrEarlier, CompletionHandler<void(bool)>&& callback) >+void ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal(SubFrameDomain&& subFrameDomain, TopFrameDomain&& topFrameDomain, Optional<FrameID> frameID, PageID pageID, StorageAccessPromptWasShown promptWasShownNowOrEarlier, CompletionHandler<void(StorageAccessWasGranted)>&& completionHandler) > { > ASSERT(!RunLoop::isMain()); > > if (subFrameDomain == topFrameDomain) { >- callback(true); >+ completionHandler(StorageAccessWasGranted::Yes); > return; > } > >- if (userWasPromptedNowOrEarlier) { >+ if (promptWasShownNowOrEarlier == StorageAccessPromptWasShown::Yes) { > auto& subFrameStatistic = ensureResourceStatisticsForRegistrableDomain(subFrameDomain); > ASSERT(subFrameStatistic.hadUserInteraction); > ASSERT(subFrameStatistic.storageAccessUnderTopFrameDomains.contains(topFrameDomain)); > subFrameStatistic.mostRecentUserInteractionTime = WallTime::now(); > } > >- RunLoop::main().dispatch([subFrameDomain = subFrameDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), frameID, pageID, store = makeRef(store()), callback = WTFMove(callback)]() mutable { >- store->callGrantStorageAccessHandler(subFrameDomain, topFrameDomain, frameID, pageID, [callback = WTFMove(callback), store = store.copyRef()](bool value) mutable { >- store->statisticsQueue().dispatch([callback = WTFMove(callback), value] () mutable { >- callback(value); >+ RunLoop::main().dispatch([subFrameDomain = subFrameDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), frameID, pageID, store = makeRef(store()), completionHandler = WTFMove(completionHandler)]() mutable { >+ store->callGrantStorageAccessHandler(subFrameDomain, topFrameDomain, frameID, pageID, [completionHandler = WTFMove(completionHandler), store = store.copyRef()](StorageAccessWasGranted wasGranted) mutable { >+ store->statisticsQueue().dispatch([wasGranted, completionHandler = WTFMove(completionHandler)] () mutable { >+ completionHandler(wasGranted); > }); > }); > }); >@@ -741,9 +742,9 @@ bool ResourceLoadStatisticsMemoryStore::shouldBlockAndPurgeCookies(const Resourc > return statistic.isPrevalentResource && !statistic.hadUserInteraction; > } > >-bool ResourceLoadStatisticsMemoryStore::hasUserGrantedStorageAccessThroughPrompt(const ResourceLoadStatistics& statistic, const RegistrableDomain& firstPartyDomain) >+StorageAccessPromptWasShown ResourceLoadStatisticsMemoryStore::hasUserGrantedStorageAccessThroughPrompt(const ResourceLoadStatistics& statistic, const RegistrableDomain& firstPartyDomain) > { >- return statistic.storageAccessUnderTopFrameDomains.contains(firstPartyDomain); >+ return statistic.storageAccessUnderTopFrameDomains.contains(firstPartyDomain) ? StorageAccessPromptWasShown::Yes : StorageAccessPromptWasShown::No; > } > > void ResourceLoadStatisticsMemoryStore::updateCookieBlocking(CompletionHandler<void()>&& completionHandler) >diff --git a/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h b/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h >index f1dd2d8365cc15bbd8b8ec18b1e6a8e2d46ad9f2..44efbf4dec14f202702acad07768f5ac820b805a 100644 >--- a/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h >+++ b/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h >@@ -37,6 +37,8 @@ > namespace WebCore { > class KeyedDecoder; > class KeyedEncoder; >+enum class StorageAccessPromptWasShown : bool; >+enum class StorageAccessWasGranted : bool; > struct ResourceLoadStatistics; > } > >@@ -97,7 +99,7 @@ public: > > void hasStorageAccess(const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, CompletionHandler<void(bool)>&&) override; > void requestStorageAccess(SubFrameDomain&&, TopFrameDomain&&, FrameID, PageID, CompletionHandler<void(StorageAccessStatus)>&&) override; >- void grantStorageAccess(SubFrameDomain&&, TopFrameDomain&&, FrameID, PageID, bool userWasPromptedNow, CompletionHandler<void(bool)>&&) override; >+ void grantStorageAccess(SubFrameDomain&&, TopFrameDomain&&, FrameID, PageID, WebCore::StorageAccessPromptWasShown, CompletionHandler<void(WebCore::StorageAccessWasGranted)>&&) override; > > void logFrameNavigation(const NavigatedToDomain&, const TopFrameDomain&, const NavigatedFromDomain&, bool isRedirect, bool isMainFrame) override; > void logUserInteraction(const TopFrameDomain&) override; >@@ -113,7 +115,7 @@ public: > private: > static bool shouldBlockAndKeepCookies(const ResourceLoadStatistics&); > static bool shouldBlockAndPurgeCookies(const ResourceLoadStatistics&); >- static bool hasUserGrantedStorageAccessThroughPrompt(const ResourceLoadStatistics&, const RegistrableDomain&); >+ static WebCore::StorageAccessPromptWasShown hasUserGrantedStorageAccessThroughPrompt(const ResourceLoadStatistics&, const RegistrableDomain&); > bool hasHadUnexpiredRecentUserInteraction(ResourceLoadStatistics&, OperatingDatesWindow) const; > bool shouldRemoveAllWebsiteDataFor(ResourceLoadStatistics&, bool shouldCheckForGrandfathering) const; > bool shouldRemoveAllButCookiesFor(ResourceLoadStatistics&, bool shouldCheckForGrandfathering) const; >@@ -121,7 +123,7 @@ private: > void incrementRecordsDeletedCountForDomains(HashSet<RegistrableDomain>&&) override; > void setPrevalentResource(ResourceLoadStatistics&, ResourceLoadPrevalence); > unsigned recursivelyGetAllDomainsThatHaveRedirectedToThisDomain(const ResourceLoadStatistics&, HashSet<RedirectedToDomain>&, unsigned numberOfRecursiveCalls) const; >- void grantStorageAccessInternal(SubFrameDomain&&, TopFrameDomain&&, Optional<FrameID>, PageID, bool userWasPromptedNowOrEarlier, CompletionHandler<void(bool)>&&); >+ void grantStorageAccessInternal(SubFrameDomain&&, TopFrameDomain&&, Optional<FrameID>, PageID, WebCore::StorageAccessPromptWasShown, CompletionHandler<void(WebCore::StorageAccessWasGranted)>&&); > void markAsPrevalentIfHasRedirectedToPrevalent(ResourceLoadStatistics&); > bool isPrevalentDueToDebugMode(ResourceLoadStatistics&); > Vector<RegistrableDomain> ensurePrevalentResourcesForDebugMode() override; >diff --git a/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.h b/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.h >index d30aa9f5ddaea9dcf70c2b086c3422c6332f31be..220b3c6bf655d2f06b976c141c37d7cce9260a56 100644 >--- a/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.h >+++ b/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.h >@@ -41,6 +41,8 @@ > namespace WebCore { > class KeyedDecoder; > class KeyedEncoder; >+enum class StorageAccessPromptWasShown : bool; >+enum class StorageAccessWasGranted : bool; > struct ResourceLoadStatistics; > } > >@@ -161,7 +163,7 @@ public: > > virtual void hasStorageAccess(const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, CompletionHandler<void(bool)>&&) = 0; > virtual void requestStorageAccess(SubFrameDomain&&, TopFrameDomain&&, FrameID, PageID, CompletionHandler<void(StorageAccessStatus)>&&) = 0; >- virtual void grantStorageAccess(SubFrameDomain&&, TopFrameDomain&&, FrameID, PageID, bool userWasPromptedNow, CompletionHandler<void(bool)>&&) = 0; >+ virtual void grantStorageAccess(SubFrameDomain&&, TopFrameDomain&&, FrameID, PageID, WebCore::StorageAccessPromptWasShown, CompletionHandler<void(WebCore::StorageAccessWasGranted)>&&) = 0; > > virtual void logFrameNavigation(const NavigatedToDomain&, const TopFrameDomain&, const NavigatedFromDomain&, bool isRedirect, bool isMainFrame) = 0; > virtual void logUserInteraction(const TopFrameDomain&) = 0; >diff --git a/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp b/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp >index b798fd0c47c3f76af0ed03a9c0cacb080b6f7fff..252fe1ca0316310f3a4df1fe8b92d6841c5c9697 100644 >--- a/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp >+++ b/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp >@@ -47,6 +47,7 @@ > #include <WebCore/CookieJar.h> > #include <WebCore/DiagnosticLoggingClient.h> > #include <WebCore/DiagnosticLoggingKeys.h> >+#include <WebCore/DocumentStorageAccess.h> > #include <WebCore/NetworkStorageSession.h> > #include <WebCore/ResourceLoadStatistics.h> > #include <WebCore/RuntimeEnabledFeatures.h> >@@ -314,52 +315,47 @@ void WebResourceLoadStatisticsStore::callHasStorageAccessForFrameHandler(const R > callback(false); > } > >-void WebResourceLoadStatisticsStore::requestStorageAccessGranted(const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler) >+void WebResourceLoadStatisticsStore::requestStorageAccess(const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(StorageAccessWasGranted, StorageAccessPromptWasShown)>&& completionHandler) > { >+ if (subFrameDomain == topFrameDomain) { >+ completionHandler(StorageAccessWasGranted::Yes, StorageAccessPromptWasShown::No); >+ return; >+ } >+ > auto statusHandler = [this, protectedThis = makeRef(*this), subFrameDomain = subFrameDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), frameID, pageID, completionHandler = WTFMove(completionHandler)](StorageAccessStatus status) mutable { > switch (status) { > case StorageAccessStatus::CannotRequestAccess: >- completionHandler(false); >+ completionHandler(StorageAccessWasGranted::No, StorageAccessPromptWasShown::No); > return; > case StorageAccessStatus::RequiresUserPrompt: > { > CompletionHandler<void(bool)> requestConfirmationCompletionHandler = [this, protectedThis = protectedThis.copyRef(), subFrameDomain, topFrameDomain, frameID, pageID, completionHandler = WTFMove(completionHandler)] (bool userDidGrantAccess) mutable { > if (userDidGrantAccess) >- grantStorageAccess(subFrameDomain, topFrameDomain, frameID, pageID, userDidGrantAccess, WTFMove(completionHandler)); >+ grantStorageAccess(subFrameDomain, topFrameDomain, frameID, pageID, StorageAccessPromptWasShown::Yes, WTFMove(completionHandler)); > else >- completionHandler(false); >+ completionHandler(StorageAccessWasGranted::No, StorageAccessPromptWasShown::Yes); > }; > m_networkSession->networkProcess().parentProcessConnection()->sendWithAsyncReply(Messages::NetworkProcessProxy::RequestStorageAccessConfirm(pageID, frameID, subFrameDomain, topFrameDomain), WTFMove(requestConfirmationCompletionHandler)); > } > return; > case StorageAccessStatus::HasAccess: >- completionHandler(true); >+ completionHandler(StorageAccessWasGranted::Yes, StorageAccessPromptWasShown::No); > return; > } > }; > >- requestStorageAccess(subFrameDomain, topFrameDomain, frameID, pageID, WTFMove(statusHandler)); >-} >- >-void WebResourceLoadStatisticsStore::requestStorageAccess(const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(StorageAccessStatus)>&& completionHandler) >-{ >- if (subFrameDomain == topFrameDomain) { >- completionHandler(StorageAccessStatus::HasAccess); >- return; >- } >- >- postTask([this, subFrameDomain = subFrameDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), frameID, pageID, completionHandler = WTFMove(completionHandler)]() mutable { >+ postTask([this, subFrameDomain = subFrameDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), frameID, pageID, statusHandler = WTFMove(statusHandler)]() mutable { > if (!m_statisticsStore) { >- postTaskReply([completionHandler = WTFMove(completionHandler)]() mutable { >- completionHandler(StorageAccessStatus::CannotRequestAccess); >+ postTaskReply([statusHandler = WTFMove(statusHandler)]() mutable { >+ statusHandler(StorageAccessStatus::CannotRequestAccess); > }); > return; > } > > if (m_statisticsStore) { >- m_statisticsStore->requestStorageAccess(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID.value(), pageID, [completionHandler = WTFMove(completionHandler)](StorageAccessStatus status) mutable { >- postTaskReply([completionHandler = WTFMove(completionHandler), status]() mutable { >- completionHandler(status); >+ m_statisticsStore->requestStorageAccess(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, pageID, [statusHandler = WTFMove(statusHandler)](StorageAccessStatus status) mutable { >+ postTaskReply([statusHandler = WTFMove(statusHandler), status]() mutable { >+ statusHandler(status); > }); > }); > } >@@ -379,28 +375,28 @@ void WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener(Registrable > }); > } > >-void WebResourceLoadStatisticsStore::grantStorageAccess(const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, bool userWasPromptedNow, CompletionHandler<void(bool)>&& completionHandler) >+void WebResourceLoadStatisticsStore::grantStorageAccess(const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, StorageAccessPromptWasShown promptWasShown, CompletionHandler<void(StorageAccessWasGranted, StorageAccessPromptWasShown)>&& completionHandler) > { > ASSERT(RunLoop::isMain()); >- postTask([this, subFrameDomain = subFrameDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), frameID, pageID, userWasPromptedNow, completionHandler = WTFMove(completionHandler)]() mutable { >+ postTask([this, subFrameDomain = subFrameDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), frameID, pageID, promptWasShown, completionHandler = WTFMove(completionHandler)]() mutable { > if (!m_statisticsStore) { >- postTaskReply([completionHandler = WTFMove(completionHandler)]() mutable { >- completionHandler(false); >+ postTaskReply([promptWasShown, completionHandler = WTFMove(completionHandler)]() mutable { >+ completionHandler(StorageAccessWasGranted::No, promptWasShown); > }); > return; > } > > if (m_statisticsStore) { >- m_statisticsStore->grantStorageAccess(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, pageID, userWasPromptedNow, [completionHandler = WTFMove(completionHandler)](bool wasGrantedAccess) mutable { >- postTaskReply([completionHandler = WTFMove(completionHandler), wasGrantedAccess]() mutable { >- completionHandler(wasGrantedAccess); >+ m_statisticsStore->grantStorageAccess(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, pageID, promptWasShown, [promptWasShown, completionHandler = WTFMove(completionHandler)](StorageAccessWasGranted wasGrantedAccess) mutable { >+ postTaskReply([wasGrantedAccess, promptWasShown, completionHandler = WTFMove(completionHandler)]() mutable { >+ completionHandler(wasGrantedAccess, promptWasShown); > }); > }); > } > }); > } > >-bool WebResourceLoadStatisticsStore::grantStorageAccess(const RegistrableDomain& resourceDomain, const RegistrableDomain& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID) >+StorageAccessWasGranted WebResourceLoadStatisticsStore::grantStorageAccess(const RegistrableDomain& resourceDomain, const RegistrableDomain& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID) > { > bool isStorageGranted = false; > >@@ -410,14 +406,14 @@ bool WebResourceLoadStatisticsStore::grantStorageAccess(const RegistrableDomain& > isStorageGranted = true; > } > >- return isStorageGranted; >+ return isStorageGranted ? StorageAccessWasGranted::Yes : StorageAccessWasGranted::No; > } > >-void WebResourceLoadStatisticsStore::callGrantStorageAccessHandler(const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&& callback) >+void WebResourceLoadStatisticsStore::callGrantStorageAccessHandler(const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(StorageAccessWasGranted)>&& completionHandler) > { > ASSERT(RunLoop::isMain()); > >- callback(grantStorageAccess(subFrameDomain, topFrameDomain, frameID, pageID)); >+ completionHandler(grantStorageAccess(subFrameDomain, topFrameDomain, frameID, pageID)); > } > > void WebResourceLoadStatisticsStore::didCreateNetworkProcess() >diff --git a/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h b/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h >index a0fe8ece8d8f8e5ea13e086c3efd5ebbd2fc8aa2..f569dc36431a4dddc4b7ffb441b340e059eddd1d 100644 >--- a/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h >+++ b/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h >@@ -48,6 +48,8 @@ class ResourceRequest; > struct ResourceLoadStatistics; > enum class ShouldSample : bool; > enum class IncludeHttpOnlyCookies : bool; >+enum class StorageAccessPromptWasShown : bool; >+enum class StorageAccessWasGranted : bool; > } > > namespace WebKit { >@@ -83,6 +85,8 @@ public: > using OpenerPageID = uint64_t; > using PageID = uint64_t; > using FrameID = uint64_t; >+ using StorageAccessWasGranted = WebCore::StorageAccessWasGranted; >+ using StorageAccessPromptWasShown = WebCore::StorageAccessPromptWasShown; > > static Ref<WebResourceLoadStatisticsStore> create(NetworkSession& networkSession, const String& resourceLoadStatisticsDirectory, ShouldIncludeLocalhost shouldIncludeLocalhost) > { >@@ -100,7 +104,7 @@ public: > void setShouldClassifyResourcesBeforeDataRecordsRemoval(bool, CompletionHandler<void()>&&); > void setShouldSubmitTelemetry(bool); > >- void grantStorageAccess(const SubFrameDomain&, const TopFrameDomain&, FrameID, PageID, bool userWasPromptedNow, CompletionHandler<void(bool)>&&); >+ void grantStorageAccess(const SubFrameDomain&, const TopFrameDomain&, FrameID, PageID, StorageAccessPromptWasShown, CompletionHandler<void(StorageAccessWasGranted, StorageAccessPromptWasShown)>&&); > > void applicationWillTerminate(); > >@@ -114,12 +118,11 @@ public: > void clearUserInteraction(const TopFrameDomain&, CompletionHandler<void()>&&); > void deleteWebsiteDataForRegistrableDomains(OptionSet<WebsiteDataType>, HashMap<RegistrableDomain, WebsiteDataToRemove>&&, bool shouldNotifyPage, CompletionHandler<void(const HashSet<RegistrableDomain>&)>&&); > void registrableDomainsWithWebsiteData(OptionSet<WebsiteDataType>, bool shouldNotifyPage, CompletionHandler<void(HashSet<RegistrableDomain>&&)>&&); >- bool grantStorageAccess(const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID); >+ StorageAccessWasGranted grantStorageAccess(const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID); > void hasHadUserInteraction(const RegistrableDomain&, CompletionHandler<void(bool)>&&); >- void hasStorageAccess(const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, CompletionHandler<void(bool)>&& callback); >+ void hasStorageAccess(const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, CompletionHandler<void(bool)>&&); > bool hasStorageAccessForFrame(const SubFrameDomain&, const TopFrameDomain&, FrameID, PageID); >- void requestStorageAccess(const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, CompletionHandler<void(StorageAccessStatus)>&&); >- void requestStorageAccessGranted(const SubFrameDomain&, const TopFrameDomain&, FrameID, PageID, CompletionHandler<void(bool)>&&); >+ void requestStorageAccess(const SubFrameDomain&, const TopFrameDomain&, FrameID, PageID, CompletionHandler<void(StorageAccessWasGranted, StorageAccessPromptWasShown)>&&); > void setLastSeen(const RegistrableDomain&, Seconds, CompletionHandler<void()>&&); > void setPrevalentResource(const RegistrableDomain&, CompletionHandler<void()>&&); > void setVeryPrevalentResource(const RegistrableDomain&, CompletionHandler<void()>&&); >@@ -162,7 +165,7 @@ public: > void setPrevalentResourceForDebugMode(const RegistrableDomain&, CompletionHandler<void()>&&); > > void logTestingEvent(const String&); >- void callGrantStorageAccessHandler(const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, CompletionHandler<void(bool)>&&); >+ void callGrantStorageAccessHandler(const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, CompletionHandler<void(StorageAccessWasGranted)>&&); > void removeAllStorageAccess(CompletionHandler<void()>&&); > void callUpdatePrevalentDomainsToBlockCookiesForHandler(const Vector<RegistrableDomain>&, CompletionHandler<void()>&&); > void callRemoveDomainsHandler(const Vector<RegistrableDomain>&); >diff --git a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp >index dc74a613b9d9c4c489d671e30aa8a673460455fb..e9c98f2e2227fe1c5251770d060d2ed2e3ccde5b 100644 >--- a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp >+++ b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp >@@ -57,6 +57,7 @@ > #include "WebSWServerToContextConnection.h" > #include "WebSWServerToContextConnectionMessages.h" > #include "WebsiteDataStoreParameters.h" >+#include <WebCore/DocumentStorageAccess.h> > #include <WebCore/NetworkStorageSession.h> > #include <WebCore/ResourceLoadStatistics.h> > #include <WebCore/ResourceRequest.h> >@@ -680,12 +681,18 @@ void NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated(Vector<WebCore > > void NetworkConnectionToWebProcess::hasStorageAccess(PAL::SessionID sessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler) > { >- networkProcess().hasStorageAccess(sessionID, subFrameDomain, topFrameDomain, frameID, pageID, WTFMove(completionHandler)); >+ if (auto networkSession = networkProcess().networkSession(sessionID)) { >+ if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics()) >+ resourceLoadStatistics->hasStorageAccess(subFrameDomain, topFrameDomain, frameID, pageID, WTFMove(completionHandler)); >+ } > } > >-void NetworkConnectionToWebProcess::requestStorageAccess(PAL::SessionID sessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler) >+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) > { >- networkProcess().requestStorageAccessGranted(sessionID, subFrameDomain, topFrameDomain, frameID, pageID, WTFMove(completionHandler)); >+ if (auto networkSession = networkProcess().networkSession(sessionID)) { >+ if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics()) >+ resourceLoadStatistics->requestStorageAccess(subFrameDomain, topFrameDomain, frameID, pageID, WTFMove(completionHandler)); >+ } > } > > void NetworkConnectionToWebProcess::requestStorageAccessUnderOpener(PAL::SessionID sessionID, WebCore::RegistrableDomain&& domainInNeedOfStorageAccess, uint64_t openerPageID, WebCore::RegistrableDomain&& openerDomain) >diff --git a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h >index c69e325e618e9ce86ba8af2c31036eaeaec12a0f..0903a164589da1954ce63fc31bed20beb21aed87 100644 >--- a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h >+++ b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h >@@ -48,6 +48,8 @@ class BlobDataFileReference; > class BlobRegistryImpl; > class ResourceError; > class ResourceRequest; >+enum class StorageAccessPromptWasShown : bool; >+enum class StorageAccessWasGranted : bool; > struct SameSiteInfo; > > enum class IncludeSecureCookies : bool; >@@ -221,7 +223,7 @@ private: > void logSubresourceRedirect(PAL::SessionID, const RegistrableDomain& sourceDomain, const RegistrableDomain& targetDomain); > void resourceLoadStatisticsUpdated(Vector<WebCore::ResourceLoadStatistics>&&); > void hasStorageAccess(PAL::SessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&&); >- void requestStorageAccess(PAL::SessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&&); >+ void requestStorageAccess(PAL::SessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(WebCore::StorageAccessWasGranted, WebCore::StorageAccessPromptWasShown)>&&); > void requestStorageAccessUnderOpener(PAL::SessionID, WebCore::RegistrableDomain&& domainInNeedOfStorageAccess, uint64_t openerPageID, WebCore::RegistrableDomain&& openerDomain); > #endif > >diff --git a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in >index 16ed34ad987890418371a39cade6486f371d6ce3..fd848e3ad046c80c3ae3f46d39015a02f003c951 100644 >--- a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in >+++ b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in >@@ -64,7 +64,7 @@ messages -> NetworkConnectionToWebProcess LegacyReceiver { > LogSubresourceRedirect(PAL::SessionID sessionID, WebCore::RegistrableDomain sourceDomain, WebCore::RegistrableDomain targetDomain) > ResourceLoadStatisticsUpdated(Vector<WebCore::ResourceLoadStatistics> statistics) > HasStorageAccess(PAL::SessionID sessionID, WebCore::RegistrableDomain subFrameDomain, WebCore::RegistrableDomain topFrameDomain, uint64_t frameID, uint64_t pageID) -> (bool hasStorageAccess) Async >- RequestStorageAccess(PAL::SessionID sessionID, WebCore::RegistrableDomain subFrameDomain, WebCore::RegistrableDomain topFrameDomain, uint64_t frameID, uint64_t pageID) -> (bool accessGranted) Async >+ 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 > RequestStorageAccessUnderOpener(PAL::SessionID sessionID, WebCore::RegistrableDomain domainInNeedOfStorageAccess, uint64_t openerPageID, WebCore::RegistrableDomain openerDomain) > #endif > >diff --git a/Source/WebKit/NetworkProcess/NetworkProcess.cpp b/Source/WebKit/NetworkProcess/NetworkProcess.cpp >index a60b2c55bf1e3483b9d33a532f881c63a83eabaf..0e7180db2bcf410902d449c7c26388ad5f46e878 100644 >--- a/Source/WebKit/NetworkProcess/NetworkProcess.cpp >+++ b/Source/WebKit/NetworkProcess/NetworkProcess.cpp >@@ -950,17 +950,6 @@ void NetworkProcess::setLastSeen(PAL::SessionID sessionID, const RegistrableDoma > } > } > >-void NetworkProcess::hasStorageAccessForFrame(PAL::SessionID sessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler) >-{ >- bool hasStorageAccess = false; >- if (auto* networkStorageSession = storageSession(sessionID)) >- hasStorageAccess = networkStorageSession->hasStorageAccess(subFrameDomain, topFrameDomain, frameID, pageID); >- else >- ASSERT_NOT_REACHED(); >- >- completionHandler(hasStorageAccess); >-} >- > void NetworkProcess::getAllStorageAccessEntries(PAL::SessionID sessionID, CompletionHandler<void(Vector<String> domains)>&& completionHandler) > { > if (auto* networkStorageSession = storageSession(sessionID)) >@@ -971,64 +960,6 @@ void NetworkProcess::getAllStorageAccessEntries(PAL::SessionID sessionID, Comple > } > } > >-void NetworkProcess::hasStorageAccess(PAL::SessionID sessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler) >-{ >- if (auto* networkSession = this->networkSession(sessionID)) { >- if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics()) >- resourceLoadStatistics->hasStorageAccess(subFrameDomain, topFrameDomain, frameID, pageID, WTFMove(completionHandler)); >- else >- completionHandler(false); >- } else { >- ASSERT_NOT_REACHED(); >- completionHandler(false); >- } >-} >- >-void NetworkProcess::requestStorageAccess(PAL::SessionID sessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(StorageAccessStatus)>&& completionHandler) >-{ >- if (auto* networkSession = this->networkSession(sessionID)) { >- if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics()) >- resourceLoadStatistics->requestStorageAccess(subFrameDomain, topFrameDomain, frameID.value(), pageID, WTFMove(completionHandler)); >- else >- completionHandler(StorageAccessStatus::CannotRequestAccess); >- } else { >- ASSERT_NOT_REACHED(); >- completionHandler(StorageAccessStatus::CannotRequestAccess); >- } >-} >- >-void NetworkProcess::requestStorageAccessGranted(PAL::SessionID sessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler) >-{ >- if (auto* networkSession = this->networkSession(sessionID)) { >- if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics()) >- resourceLoadStatistics->requestStorageAccessGranted(subFrameDomain, topFrameDomain, frameID, pageID, WTFMove(completionHandler)); >- else >- completionHandler(false); >- } else { >- ASSERT_NOT_REACHED(); >- completionHandler(false); >- } >-} >- >-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) >-{ >- // FIXME: We should not accept an optional frame ID since we call frameID.value() unconditionally. >- if (!frameID) { >- completionHandler(false); >- return; >- } >- >- if (auto* networkSession = this->networkSession(sessionID)) { >- if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics()) >- resourceLoadStatistics->grantStorageAccess(subFrameDomain, topFrameDomain, frameID.value(), pageID, userWasPrompted, WTFMove(completionHandler)); >- else >- completionHandler(false); >- } else { >- ASSERT_NOT_REACHED(); >- completionHandler(false); >- } >-} >- > void NetworkProcess::logFrameNavigation(PAL::SessionID sessionID, const RegistrableDomain& targetDomain, const RegistrableDomain& topFrameDomain, const RegistrableDomain& sourceDomain, bool isRedirect, bool isMainFrame) > { > if (auto* networkSession = this->networkSession(sessionID)) { >@@ -1077,15 +1008,6 @@ void NetworkProcess::clearUserInteraction(PAL::SessionID sessionID, const Regist > } > } > >-void NetworkProcess::removeAllStorageAccess(PAL::SessionID sessionID, CompletionHandler<void()>&& completionHandler) >-{ >- if (auto* networkStorageSession = storageSession(sessionID)) >- networkStorageSession->removeAllStorageAccess(); >- else >- ASSERT_NOT_REACHED(); >- completionHandler(); >-} >- > void NetworkProcess::removePrevalentDomains(PAL::SessionID sessionID, const Vector<RegistrableDomain>& domains) > { > if (auto* networkStorageSession = storageSession(sessionID)) >diff --git a/Source/WebKit/NetworkProcess/NetworkProcess.h b/Source/WebKit/NetworkProcess/NetworkProcess.h >index d01bc7751bc8aae63030223a4b47ea89089d98df..2d6effcf7504de2aafbd967e97bd1870c3bcf4ea 100644 >--- a/Source/WebKit/NetworkProcess/NetworkProcess.h >+++ b/Source/WebKit/NetworkProcess/NetworkProcess.h >@@ -79,6 +79,8 @@ class ResourceError; > class SWServer; > enum class IncludeHttpOnlyCookies : bool; > enum class StoredCredentialsPolicy : uint8_t; >+enum class StorageAccessPromptWasShown : bool; >+enum class StorageAccessWasGranted : bool; > struct ClientOrigin; > struct MessageWithMessagePorts; > struct SecurityOriginData; >@@ -225,16 +227,10 @@ public: > void setVeryPrevalentResource(PAL::SessionID, const RegistrableDomain&, CompletionHandler<void()>&&); > void setPruneEntriesDownTo(PAL::SessionID, uint64_t pruneTargetCount, CompletionHandler<void()>&&); > void hadUserInteraction(PAL::SessionID, const RegistrableDomain&, CompletionHandler<void(bool)>&&); >- void hasStorageAccessForFrame(PAL::SessionID, const SubFrameDomain&, const TopFrameDomain&, FrameID, PageID, CompletionHandler<void(bool)>&&); > void getAllStorageAccessEntries(PAL::SessionID, CompletionHandler<void(Vector<String> domains)>&&); >- void grantStorageAccess(PAL::SessionID, const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, bool userWasPrompted, CompletionHandler<void(bool)>&&); >- void hasStorageAccess(PAL::SessionID, const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, CompletionHandler<void(bool)>&&); > void logFrameNavigation(PAL::SessionID, const NavigatedToDomain&, const TopFrameDomain&, const NavigatedFromDomain&, bool isRedirect, bool isMainFrame); > void logUserInteraction(PAL::SessionID, const TopFrameDomain&, CompletionHandler<void()>&&); >- void removeAllStorageAccess(PAL::SessionID, CompletionHandler<void()>&&); > void removePrevalentDomains(PAL::SessionID, const Vector<RegistrableDomain>&); >- void requestStorageAccess(PAL::SessionID, const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, CompletionHandler<void(StorageAccessStatus)>&&); >- void requestStorageAccessGranted(PAL::SessionID, const SubFrameDomain&, const TopFrameDomain&, FrameID, PageID, CompletionHandler<void(bool)>&&); > void resetCacheMaxAgeCapForPrevalentResources(PAL::SessionID, CompletionHandler<void()>&&); > void resetParametersToDefaultValues(PAL::SessionID, CompletionHandler<void()>&&); > void scheduleClearInMemoryAndPersistent(PAL::SessionID, Optional<WallTime> modifiedSince, ShouldGrandfatherStatistics, CompletionHandler<void()>&&); >diff --git a/Source/WebKit/NetworkProcess/NetworkProcess.messages.in b/Source/WebKit/NetworkProcess/NetworkProcess.messages.in >index 6f76379a77e913f5e58b66dadafea802bf9dd300..73fdb335a46ab64d2f69532389a307f1a45e8b8a 100644 >--- a/Source/WebKit/NetworkProcess/NetworkProcess.messages.in >+++ b/Source/WebKit/NetworkProcess/NetworkProcess.messages.in >@@ -98,18 +98,13 @@ messages -> NetworkProcess LegacyReceiver { > SetPrevalentResource(PAL::SessionID sessionID, WebCore::RegistrableDomain resourceDomain) -> () Async > SetPrevalentResourceForDebugMode(PAL::SessionID sessionID, WebCore::RegistrableDomain resourceDomain) -> () Async > HadUserInteraction(PAL::SessionID sessionID, WebCore::RegistrableDomain resourceDomain) -> (bool hadUserInteraction) Async >- HasStorageAccessForFrame(PAL::SessionID sessionID, WebCore::RegistrableDomain subFrameDomain, WebCore::RegistrableDomain topFrameDomain, uint64_t frameID, uint64_t pageID) -> (bool hasStorageAccess) Async >- HasStorageAccess(PAL::SessionID sessionID, WebCore::RegistrableDomain resourceDomain, WebCore::RegistrableDomain topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID) -> (bool hasStorageAccess) Async > GetAllStorageAccessEntries(PAL::SessionID sessionID) -> (Vector<String> domains) Async >- GrantStorageAccess(PAL::SessionID sessionID, WebCore::RegistrableDomain subFrameDomain, WebCore::RegistrableDomain topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID, bool userWasPrompted) -> (bool accessGranted) Async > IsRegisteredAsRedirectingTo(PAL::SessionID sessionID, WebCore::RegistrableDomain redirectedFromDomain, WebCore::RegistrableDomain redirectedToDomain) -> (bool isRedirectingTo) Async > IsRegisteredAsSubFrameUnder(PAL::SessionID sessionID, WebCore::RegistrableDomain subFrameDomain, WebCore::RegistrableDomain topFrameDomain) -> (bool isSubframeUnder) Async > IsRegisteredAsSubresourceUnder(PAL::SessionID sessionID, WebCore::RegistrableDomain subresourceDomain, WebCore::RegistrableDomain topFrameDomain) -> (bool isSubresourceUnder) Async > LogFrameNavigation(PAL::SessionID sessionID, WebCore::RegistrableDomain targetDomain, WebCore::RegistrableDomain topFrameDomain, WebCore::RegistrableDomain sourceDomain, bool isRedirect, bool isMainFrame) > LogUserInteraction(PAL::SessionID sessionID, WebCore::RegistrableDomain topFrameDomain) -> () Async >- RemoveAllStorageAccess(PAL::SessionID sessionID) -> () Async > RemovePrevalentDomains(PAL::SessionID sessionID, Vector<WebCore::RegistrableDomain> domainsWithInteraction) >- RequestStorageAccess(PAL::SessionID sessionID, WebCore::RegistrableDomain resourceDomain, WebCore::RegistrableDomain topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID) -> (enum:uint8_t WebKit::StorageAccessStatus storageAccessStatus) Async > ResetParametersToDefaultValues(PAL::SessionID sessionID) -> () Async > ScheduleClearInMemoryAndPersistent(PAL::SessionID sessionID, Optional<WallTime> modifiedSince, enum:bool WebKit::ShouldGrandfatherStatistics shouldGrandfather) -> () Async > ScheduleCookieBlockingUpdate(PAL::SessionID sessionID) -> () Async >diff --git a/Source/WebKit/Scripts/webkit/messages.py b/Source/WebKit/Scripts/webkit/messages.py >index 8e52ac03c2805218b9aacaec8b36609379e165df..a3773b1412fe365a4a127e86aca9ca66ce6f207c 100644 >--- a/Source/WebKit/Scripts/webkit/messages.py >+++ b/Source/WebKit/Scripts/webkit/messages.py >@@ -456,6 +456,8 @@ def headers_for_type(type): > 'WebCore::ShippingMethodUpdate': ['<WebCore/ApplePaySessionPaymentRequest.h>'], > 'WebCore::ShouldNotifyWhenResolved': ['<WebCore/ServiceWorkerTypes.h>'], > 'WebCore::ShouldSample': ['<WebCore/DiagnosticLoggingClient.h>'], >+ 'WebCore::StorageAccessPromptWasShown': ['<WebCore/DocumentStorageAccess.h>'], >+ 'WebCore::StorageAccessWasGranted': ['<WebCore/DocumentStorageAccess.h>'], > 'WebCore::SupportedPluginIdentifier': ['<WebCore/PluginData.h>'], > 'WebCore::TextCheckingRequestData': ['<WebCore/TextChecking.h>'], > 'WebCore::TextCheckingResult': ['<WebCore/TextCheckerClient.h>'], >diff --git a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp >index c344d16382735b0b683c696f9b662671071d8464..af859aec0362e91f930b286b8f42fc20fa883043 100644 >--- a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp >+++ b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp >@@ -726,36 +726,6 @@ void NetworkProcessProxy::setGrandfathered(PAL::SessionID sessionID, const Regis > sendWithAsyncReply(Messages::NetworkProcess::SetGrandfathered(sessionID, resourceDomain, isGrandfathered), WTFMove(completionHandler)); > } > >-void NetworkProcessProxy::hasStorageAccessForFrame(PAL::SessionID sessionID, const RegistrableDomain& resourceDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler) >-{ >- if (!canSendMessage()) { >- completionHandler(false); >- return; >- } >- >- sendWithAsyncReply(Messages::NetworkProcess::HasStorageAccessForFrame(sessionID, resourceDomain, topFrameDomain, frameID, pageID), WTFMove(completionHandler)); >-} >- >-void NetworkProcessProxy::hasStorageAccess(PAL::SessionID sessionID, const RegistrableDomain& resourceDomain, const RegistrableDomain& topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler) >-{ >- if (!canSendMessage()) { >- completionHandler(false); >- return; >- } >- >- sendWithAsyncReply(Messages::NetworkProcess::HasStorageAccess(sessionID, resourceDomain, topFrameDomain, frameID, pageID), WTFMove(completionHandler)); >-} >- >-void NetworkProcessProxy::requestStorageAccess(PAL::SessionID sessionID, const RegistrableDomain& resourceDomain, const RegistrableDomain& topFrameDomain, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(StorageAccessStatus)>&& completionHandler) >-{ >- if (!canSendMessage()) { >- completionHandler(StorageAccessStatus::CannotRequestAccess); >- return; >- } >- >- sendWithAsyncReply(Messages::NetworkProcess::RequestStorageAccess(sessionID, resourceDomain, topFrameDomain, frameID, pageID), WTFMove(completionHandler)); >-} >- > void NetworkProcessProxy::requestStorageAccessConfirm(uint64_t pageID, uint64_t frameID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, CompletionHandler<void(bool)>&& completionHandler) > { > WebPageProxy* page = WebProcessProxy::webPage(pageID); >@@ -767,32 +737,6 @@ void NetworkProcessProxy::requestStorageAccessConfirm(uint64_t pageID, uint64_t > page->requestStorageAccessConfirm(subFrameDomain, topFrameDomain, frameID, WTFMove(completionHandler)); > } > >-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) >-{ >- if (!canSendMessage()) { >- completionHandler(false); >- return; >- } >- >- // FIXME: We should not accept an optional frame ID since we call frameID.value() unconditionally. >- if (!frameID) { >- completionHandler(false); >- return; >- } >- >- sendWithAsyncReply(Messages::NetworkProcess::GrantStorageAccess(sessionID, resourceDomain, topFrameDomain, frameID.value(), pageID, userWasPrompted), WTFMove(completionHandler)); >-} >- >-void NetworkProcessProxy::removeAllStorageAccess(PAL::SessionID sessionID, CompletionHandler<void()>&& completionHandler) >-{ >- if (!canSendMessage()) { >- completionHandler(); >- return; >- } >- >- sendWithAsyncReply(Messages::NetworkProcess::RemoveAllStorageAccess(sessionID), WTFMove(completionHandler)); >-} >- > void NetworkProcessProxy::getAllStorageAccessEntries(PAL::SessionID sessionID, CompletionHandler<void(Vector<String> domains)>&& completionHandler) > { > if (!canSendMessage()) { >diff --git a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h >index fcb2b78b45dc572c37883e8e6a80fbbf8db1a6c3..ac3dd8325955a8b6fa1480808b30fe3bfc613cd7 100644 >--- a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h >+++ b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h >@@ -49,6 +49,8 @@ class AuthenticationChallenge; > class ProtectionSpace; > class ResourceRequest; > enum class ShouldSample : bool; >+enum class StorageAccessPromptWasShown : bool; >+enum class StorageAccessWasGranted : bool; > class SecurityOrigin; > struct SecurityOriginData; > } >@@ -125,14 +127,9 @@ public: > void setPrevalentResource(PAL::SessionID, const RegistrableDomain&, CompletionHandler<void()>&&); > void setPrevalentResourceForDebugMode(PAL::SessionID, const RegistrableDomain&, CompletionHandler<void()>&&); > void setVeryPrevalentResource(PAL::SessionID, const RegistrableDomain&, CompletionHandler<void()>&&); >- void hasStorageAccessForFrame(PAL::SessionID, const RegistrableDomain&, const TopFrameDomain&, FrameID, PageID, CompletionHandler<void(bool)>&&); > void getAllStorageAccessEntries(PAL::SessionID, CompletionHandler<void(Vector<String> domains)>&&); >- void grantStorageAccess(PAL::SessionID, const RegistrableDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, bool userWasPrompted, CompletionHandler<void(bool)>&&); >- void hasStorageAccess(PAL::SessionID, const RegistrableDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, CompletionHandler<void(bool)>&&); >- void requestStorageAccess(PAL::SessionID, const SubFrameDomain&, const TopFrameDomain&, Optional<FrameID>, PageID, CompletionHandler<void(StorageAccessStatus)>&&); > void requestStorageAccessConfirm(PageID, FrameID, const SubFrameDomain&, const TopFrameDomain&, CompletionHandler<void(bool)>&&); > void resetParametersToDefaultValues(PAL::SessionID, CompletionHandler<void()>&&); >- void removeAllStorageAccess(PAL::SessionID, CompletionHandler<void()>&&); > void scheduleClearInMemoryAndPersistent(PAL::SessionID, ShouldGrandfatherStatistics, CompletionHandler<void()>&&); > void scheduleClearInMemoryAndPersistent(PAL::SessionID, Optional<WallTime> modifiedSince, ShouldGrandfatherStatistics, CompletionHandler<void()>&&); > void scheduleCookieBlockingUpdate(PAL::SessionID, CompletionHandler<void()>&&); >diff --git a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >index 00641a139f53bb46249396843568d04a33c2169a..56e18aaa45abac7c4903b6c8947c7e8f07e9bb2f 100644 >--- a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >+++ b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >@@ -1683,56 +1683,6 @@ void WebsiteDataStore::getAllStorageAccessEntries(uint64_t pageID, CompletionHan > networkProcess.getAllStorageAccessEntries(m_sessionID, WTFMove(completionHandler)); > } > >-void WebsiteDataStore::hasStorageAccess(const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler) >-{ >- if (!resourceLoadStatisticsEnabled()) { >- completionHandler(false); >- return; >- } >- >- auto* webPage = WebProcessProxy::webPage(pageID); >- if (!webPage) { >- completionHandler(false); >- return; >- } >- >- if (auto networkProcess = webPage->process().processPool().networkProcess()) >- networkProcess->hasStorageAccess(m_sessionID, WebCore::RegistrableDomain::uncheckedCreateFromHost(subFrameHost), WebCore::RegistrableDomain::uncheckedCreateFromHost(topFrameHost), frameID, pageID, WTFMove(completionHandler)); >-} >- >-void WebsiteDataStore::requestStorageAccess(const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, CompletionHandler<void(StorageAccessStatus)>&& completionHandler) >-{ >- if (!resourceLoadStatisticsEnabled()) { >- completionHandler(StorageAccessStatus::CannotRequestAccess); >- return; >- } >- >- auto* webPage = WebProcessProxy::webPage(pageID); >- if (!webPage) { >- completionHandler(StorageAccessStatus::CannotRequestAccess); >- return; >- } >- >- if (auto networkProcess = webPage->process().processPool().networkProcess()) >- networkProcess->requestStorageAccess(m_sessionID, WebCore::RegistrableDomain::uncheckedCreateFromHost(subFrameHost), WebCore::RegistrableDomain::uncheckedCreateFromHost(topFrameHost), frameID, pageID, WTFMove(completionHandler)); >-} >- >-void WebsiteDataStore::grantStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool userWasPrompted, CompletionHandler<void(bool)>&& completionHandler) >-{ >- if (!resourceLoadStatisticsEnabled()) { >- completionHandler(false); >- return; >- } >- >- auto* webPage = WebProcessProxy::webPage(pageID); >- if (!webPage) { >- completionHandler(false); >- return; >- } >- >- if (auto networkProcess = webPage->process().processPool().networkProcess()) >- networkProcess->grantStorageAccess(m_sessionID, WebCore::RegistrableDomain::uncheckedCreateFromHost(subFrameHost), WebCore::RegistrableDomain::uncheckedCreateFromHost(topFrameHost), frameID, pageID, userWasPrompted, WTFMove(completionHandler)); >-} > > void WebsiteDataStore::setTimeToLiveUserInteraction(Seconds seconds, CompletionHandler<void()>&& completionHandler) > { >diff --git a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h >index c28b731b5853ae70d452e036550ac65c2930456b..77f048a454f34e5e0916fa190ad11293069afc6f 100644 >--- a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h >+++ b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h >@@ -169,9 +169,6 @@ public: > void setShouldClassifyResourcesBeforeDataRecordsRemoval(bool, CompletionHandler<void()>&&); > void setStatisticsTestingCallback(WTF::Function<void(const String&)>&& callback) { m_statisticsTestingCallback = WTFMove(callback); } > void setVeryPrevalentResource(const URL&, CompletionHandler<void()>&&); >- void hasStorageAccess(const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&&); >- void requestStorageAccess(const String& subFrameHost, const String& topFrameHost, uint64_t frameID, uint64_t pageID, CompletionHandler<void(StorageAccessStatus)>&&); >- void grantStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool userWasPrompted, CompletionHandler<void(bool)>&&); > void setSubframeUnderTopFrameDomain(const URL& subframe, const URL& topFrame); > void setCrossSiteLoadWithLinkDecorationForTesting(const URL& fromURL, const URL& toURL, CompletionHandler<void()>&&); > void resetCrossSiteLoadsWithLinkDecorationForTesting(CompletionHandler<void()>&&); >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >index 9baa84d38ae0801118a12b81e204ea2e8f0e9ef4..6bca27535f4368b8ed8b0e835a97fbf1feb38d23 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >@@ -62,6 +62,7 @@ > #include <WebCore/DataListSuggestionPicker.h> > #include <WebCore/DatabaseTracker.h> > #include <WebCore/DocumentLoader.h> >+#include <WebCore/DocumentStorageAccess.h> > #include <WebCore/FileChooser.h> > #include <WebCore/FileIconLoader.h> > #include <WebCore/Frame.h> >@@ -76,6 +77,7 @@ > #include <WebCore/Icon.h> > #include <WebCore/NotImplemented.h> > #include <WebCore/Page.h> >+#include <WebCore/RegistrableDomain.h> > #include <WebCore/ScriptController.h> > #include <WebCore/SecurityOrigin.h> > #include <WebCore/SecurityOriginData.h> >@@ -1311,14 +1313,14 @@ void WebChromeClient::didInvalidateDocumentMarkerRects() > } > > #if ENABLE(RESOURCE_LOAD_STATISTICS) >-void WebChromeClient::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t, CompletionHandler<void(bool)>&& callback) >+void WebChromeClient::hasStorageAccess(RegistrableDomain&& subFrameDomain, RegistrableDomain&& topFrameDomain, uint64_t frameID, uint64_t, CompletionHandler<void(bool)>&& completionHandler) > { >- m_page.hasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, WTFMove(callback)); >+ m_page.hasStorageAccess(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, WTFMove(completionHandler)); > } > >-void WebChromeClient::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t, CompletionHandler<void(bool)>&& callback) >+void WebChromeClient::requestStorageAccess(RegistrableDomain&& subFrameDomain, RegistrableDomain&& topFrameDomain, uint64_t frameID, uint64_t, CompletionHandler<void(StorageAccessWasGranted, StorageAccessPromptWasShown)>&& completionHandler) > { >- m_page.requestStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, WTFMove(callback)); >+ m_page.requestStorageAccess(WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, WTFMove(completionHandler)); > } > #endif > >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h >index 705b25e9fc912a63b5b4577ef2b8d5e0717a3540..7925331ec8e670e105ff4d2e6e47890be971d6fa 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h >@@ -28,6 +28,12 @@ > > #include <WebCore/ChromeClient.h> > >+namespace WebCore { >+class RegistrableDomain; >+enum class StorageAccessPromptWasShown : bool; >+enum class StorageAccessWasGranted : bool; >+} >+ > namespace WebKit { > > class WebFrame; >@@ -363,8 +369,8 @@ private: > void didInvalidateDocumentMarkerRects() final; > > #if ENABLE(RESOURCE_LOAD_STATISTICS) >- void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&&) final; >- void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&&) final; >+ void hasStorageAccess(WebCore::RegistrableDomain&& subFrameDomain, WebCore::RegistrableDomain&& topFrameDomain, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(bool)>&&) final; >+ void requestStorageAccess(WebCore::RegistrableDomain&& subFrameDomain, WebCore::RegistrableDomain&& topFrameDomain, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(WebCore::StorageAccessWasGranted, WebCore::StorageAccessPromptWasShown)>&&) final; > #endif > > #if ENABLE(DEVICE_ORIENTATION) >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >index 4370222ae8d38776799307f8903916735cf80a80..58ac38bd937b6273cf31e8e3ccf9a255b08587c9 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -147,6 +147,7 @@ > #include <WebCore/DocumentFragment.h> > #include <WebCore/DocumentLoader.h> > #include <WebCore/DocumentMarkerController.h> >+#include <WebCore/DocumentStorageAccess.h> > #include <WebCore/DragController.h> > #include <WebCore/DragData.h> > #include <WebCore/Editing.h> >@@ -6440,14 +6441,14 @@ void WebPage::frameBecameRemote(uint64_t frameID, GlobalFrameIdentifier&& remote > } > > #if ENABLE(RESOURCE_LOAD_STATISTICS) >-void WebPage::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& completionHandler) >+void WebPage::hasStorageAccess(RegistrableDomain&& subFrameDomain, RegistrableDomain&& topFrameDomain, uint64_t frameID, CompletionHandler<void(bool)>&& completionHandler) > { >- WebProcess::singleton().ensureNetworkProcessConnection().connection().sendWithAsyncReply(Messages::NetworkConnectionToWebProcess::HasStorageAccess(sessionID(), RegistrableDomain::uncheckedCreateFromHost(subFrameHost), RegistrableDomain::uncheckedCreateFromHost(topFrameHost), frameID, m_pageID), WTFMove(completionHandler)); >+ WebProcess::singleton().ensureNetworkProcessConnection().connection().sendWithAsyncReply(Messages::NetworkConnectionToWebProcess::HasStorageAccess(sessionID(), WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, m_pageID), WTFMove(completionHandler)); > } >- >-void WebPage::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& completionHandler) >+ >+void WebPage::requestStorageAccess(RegistrableDomain&& subFrameDomain, RegistrableDomain&& topFrameDomain, uint64_t frameID, CompletionHandler<void(WebCore::StorageAccessWasGranted, WebCore::StorageAccessPromptWasShown)>&& completionHandler) > { >- WebProcess::singleton().ensureNetworkProcessConnection().connection().sendWithAsyncReply(Messages::NetworkConnectionToWebProcess::RequestStorageAccess(sessionID(), RegistrableDomain::uncheckedCreateFromHost(subFrameHost), RegistrableDomain::uncheckedCreateFromHost(topFrameHost), frameID, m_pageID), WTFMove(completionHandler)); >+ WebProcess::singleton().ensureNetworkProcessConnection().connection().sendWithAsyncReply(Messages::NetworkConnectionToWebProcess::RequestStorageAccess(sessionID(), WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, m_pageID), WTFMove(completionHandler)); > } > #endif > >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h >index d9d804cbd637991052c8c6d2c1ce229e67d36a98..c93903f7bb31f4c9390445c86806eed9ceb93cad 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.h >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.h >@@ -177,6 +177,8 @@ enum SyntheticClickType : int8_t; > enum class DOMPasteAccessResponse : uint8_t; > enum class DragHandlingMethod : uint8_t; > enum class ShouldTreatAsContinuingLoad : bool; >+enum class StorageAccessPromptWasShown : bool; >+enum class StorageAccessWasGranted : bool; > enum class TextIndicatorPresentationTransition : uint8_t; > enum class WritingDirection : uint8_t; > >@@ -1118,8 +1120,8 @@ public: > void flushPendingEditorStateUpdate(); > > #if ENABLE(RESOURCE_LOAD_STATISTICS) >- void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& callback); >- void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& callback); >+ void hasStorageAccess(WebCore::RegistrableDomain&& subFrameDomain, WebCore::RegistrableDomain&& topFrameDomain, uint64_t frameID, CompletionHandler<void(bool)>&&); >+ void requestStorageAccess(WebCore::RegistrableDomain&& subFrameDomain, WebCore::RegistrableDomain&& topFrameDomain, uint64_t frameID, CompletionHandler<void(WebCore::StorageAccessWasGranted, WebCore::StorageAccessPromptWasShown)>&&); > #endif > > #if ENABLE(DEVICE_ORIENTATION) >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 1648c6b0259af7c4d2a1b76cf7508da804478137..be199530cf4788edf63d2dd39121109a14a3424d 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,34 @@ >+2019-05-06 John Wilander <wilander@apple.com> >+ >+ Storage Access API: Make two changes requested by developers and complete refactoring and cleanup >+ https://bugs.webkit.org/show_bug.cgi?id=197648 >+ <rdar://problem/50527493> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ The changed test cases have had calls to WebCore::Internals::setUserGrantsStorageAccess() removed >+ since it was dead code. >+ >+ One of the new tests, deny-with-prompt-does-not-preserve-gesture.html, is marked [ Skip ] for now since >+ we lack the ability to click "Don't allow" in the prompt. I wanted to include the test anyway so that >+ we have it. I have done a manual test to make sure the code does the right thing for this case. >+ >+ * http/tests/storageAccess/deny-with-prompt-does-not-preserve-gesture-expected.txt: Added. >+ * 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. >+ * http/tests/storageAccess/deny-without-prompt-preserves-gesture-expected.txt: Added. >+ * 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. >+ * 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. >+ * 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. >+ * http/tests/storageAccess/has-storage-access-true-if-feature-off-expected.txt: Added. >+ * http/tests/storageAccess/has-storage-access-true-if-feature-off.html: Added. >+ * http/tests/storageAccess/resources/request-storage-access-and-immediately-postmessage-iframe.html: >+ * http/tests/storageAccess/resources/request-storage-access-iframe-and-pop-window.html: >+ * http/tests/storageAccess/resources/request-storage-access-iframe.html: >+ * http/tests/storageAccess/resources/request-storage-access-without-user-gesture-iframe.html: >+ * http/tests/storageAccess/resources/self-navigating-frame-after-granted-access.html: >+ * platform/mac-wk2/TestExpectations: >+ Added expectations for the new tests. >+ > 2019-05-06 Andres Gonzalez <andresg_22@apple.com> > > Hitpoint for link which spans two lines in web content is incorrect >diff --git a/LayoutTests/http/tests/storageAccess/deny-with-prompt-does-not-preserve-gesture-expected.txt b/LayoutTests/http/tests/storageAccess/deny-with-prompt-does-not-preserve-gesture-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..9e97975677959e2e13ed74449c4aaff6f1b00382 >--- /dev/null >+++ b/LayoutTests/http/tests/storageAccess/deny-with-prompt-does-not-preserve-gesture-expected.txt >@@ -0,0 +1,11 @@ >+Tests that a cross-origin iframe can not open a window if storage access is explicitly denied. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS Window was successfully opened with user interaction since the user was never consulted/prompted. >+PASS successfullyParsed is true >+Some tests failed. >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/http/tests/storageAccess/deny-with-prompt-does-not-preserve-gesture.html b/LayoutTests/http/tests/storageAccess/deny-with-prompt-does-not-preserve-gesture.html >new file mode 100644 >index 0000000000000000000000000000000000000000..e97a20d9f8241fc8634ab1f80e3a3b3fa0a0126b >--- /dev/null >+++ b/LayoutTests/http/tests/storageAccess/deny-with-prompt-does-not-preserve-gesture.html >@@ -0,0 +1,74 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <script src="/js-test-resources/js-test.js"></script> >+ <script src="/js-test-resources/ui-helper.js"></script> >+ <script src="/resourceLoadStatistics/resources/util.js"></script> >+ <script> >+ description("Tests that a cross-origin iframe can not open a window if storage access is explicitly denied."); >+ jsTestIsAsync = true; >+ >+ const hostUnderTest = "localhost:8000"; >+ const statisticsUrl = "http://" + hostUnderTest + "/temp"; >+ >+ window.addEventListener("message", receiveMessage, false); >+ >+ function receiveMessage(event) { >+ if (event.origin === "http://localhost:8000") { >+ if (event.data.indexOf("PASS ") !== -1) >+ testPassed(event.data.replace("PASS ", "")); >+ else >+ testFailed(event.data.replace("FAIL ", "")); >+ } else >+ testFailed("Received a message from an unexpected origin: " + event.origin); >+ setEnableFeature(false, finishJSTest); >+ } >+ >+ function activateElement(elementId) { >+ var element = document.getElementById(elementId); >+ var centerX = element.offsetLeft + element.offsetWidth / 2; >+ var centerY = element.offsetTop + element.offsetHeight / 2; >+ UIHelper.activateAt(centerX, centerY).then( >+ function () { >+ if (window.eventSender) >+ eventSender.keyDown("escape"); >+ else { >+ testFailed("No eventSender."); >+ setEnableFeature(false, finishJSTest); >+ } >+ }, >+ function () { >+ testFailed("Promise rejected."); >+ setEnableFeature(false, finishJSTest); >+ } >+ ); >+ } >+ >+ function runTest() { >+ setEnableFeature(true, function() { >+ testRunner.setCanOpenWindows(false); >+ testRunner.setPopupBlockingEnabled(true); >+ testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() { >+ if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >+ testFailed("Host did not get set as prevalent resource."); >+ testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, true, function() { >+ if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) >+ testFailed("Host did not get logged for user interaction."); >+ testRunner.statisticsUpdateCookieBlocking(function() { >+ let iframeElement = document.createElement("iframe"); >+ iframeElement.onload = function() { >+ activateElement("TheIframeThatRequestsStorageAccess"); >+ }; >+ iframeElement.id = "TheIframeThatRequestsStorageAccess"; >+ iframeElement.src = "http://localhost:8000/storageAccess/resources/request-storage-access-iframe-and-pop-window.html#userShouldNotGrantAccess,userShouldBeConsulted,policyShouldNotGrantAccess,isNotSameOriginIframe"; >+ document.body.appendChild(iframeElement); >+ }); >+ }); >+ }); >+ }); >+ } >+ </script> >+</head> >+<body onload="runTest()"> >+</body> >+</html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/storageAccess/deny-without-prompt-preserves-gesture-expected.txt b/LayoutTests/http/tests/storageAccess/deny-without-prompt-preserves-gesture-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..44afde34d74263cc52ebfcd64371161601f63210 >--- /dev/null >+++ b/LayoutTests/http/tests/storageAccess/deny-without-prompt-preserves-gesture-expected.txt >@@ -0,0 +1,10 @@ >+Tests that a cross-origin iframe can open a window if storage access is denied without prompt. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS Window was successfully opened with user interaction since the user was never consulted/prompted. >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/http/tests/storageAccess/deny-without-prompt-preserves-gesture.html b/LayoutTests/http/tests/storageAccess/deny-without-prompt-preserves-gesture.html >new file mode 100644 >index 0000000000000000000000000000000000000000..b1fc4d8bdeb6260aae9aec0a246bea5f216a016c >--- /dev/null >+++ b/LayoutTests/http/tests/storageAccess/deny-without-prompt-preserves-gesture.html >@@ -0,0 +1,74 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <script src="/js-test-resources/js-test.js"></script> >+ <script src="/js-test-resources/ui-helper.js"></script> >+ <script src="/resourceLoadStatistics/resources/util.js"></script> >+ <script> >+ description("Tests that a cross-origin iframe can open a window if storage access is denied without prompt."); >+ jsTestIsAsync = true; >+ >+ const hostUnderTest = "localhost:8000"; >+ const statisticsUrl = "http://" + hostUnderTest + "/temp"; >+ >+ window.addEventListener("message", receiveMessage, false); >+ >+ function receiveMessage(event) { >+ if (event.origin === "http://localhost:8000") { >+ if (event.data.indexOf("PASS ") !== -1) >+ testPassed(event.data.replace("PASS ", "")); >+ else >+ testFailed(event.data.replace("FAIL ", "")); >+ } else >+ testFailed("Received a message from an unexpected origin: " + event.origin); >+ setEnableFeature(false, finishJSTest); >+ } >+ >+ function activateElement(elementId) { >+ var element = document.getElementById(elementId); >+ var centerX = element.offsetLeft + element.offsetWidth / 2; >+ var centerY = element.offsetTop + element.offsetHeight / 2; >+ UIHelper.activateAt(centerX, centerY).then( >+ function () { >+ if (window.eventSender) >+ eventSender.keyDown("escape"); >+ else { >+ testFailed("No eventSender."); >+ setEnableFeature(false, finishJSTest); >+ } >+ }, >+ function () { >+ testFailed("Promise rejected."); >+ setEnableFeature(false, finishJSTest); >+ } >+ ); >+ } >+ >+ function runTest() { >+ setEnableFeature(true, function() { >+ testRunner.setCanOpenWindows(false); >+ testRunner.setPopupBlockingEnabled(true); >+ testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() { >+ if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >+ testFailed("Host did not get set as prevalent resource."); >+ testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, false, function() { >+ if (testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) >+ testFailed("Host did get logged for user interaction."); >+ testRunner.statisticsUpdateCookieBlocking(function() { >+ let iframeElement = document.createElement("iframe"); >+ iframeElement.onload = function() { >+ activateElement("TheIframeThatRequestsStorageAccess"); >+ }; >+ iframeElement.id = "TheIframeThatRequestsStorageAccess"; >+ iframeElement.src = "http://localhost:8000/storageAccess/resources/request-storage-access-iframe-and-pop-window.html#userShouldNotGrantAccess,userShouldNotBeConsulted,policyShouldNotGrantAccess,isNotSameOriginIframe"; >+ document.body.appendChild(iframeElement); >+ }); >+ }); >+ }); >+ }); >+ } >+ </script> >+</head> >+<body onload="runTest()"> >+</body> >+</html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/storageAccess/grant-with-prompt-preserves-gesture-expected.txt b/LayoutTests/http/tests/storageAccess/grant-with-prompt-preserves-gesture-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..d7ec4cf7f7841d57c68ddb5fa66cb5634b31da3b >--- /dev/null >+++ b/LayoutTests/http/tests/storageAccess/grant-with-prompt-preserves-gesture-expected.txt >@@ -0,0 +1,10 @@ >+Tests that cross-origin iframe can display a window if storage access is granted. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS Window was successfully opened with user interaction. >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/http/tests/storageAccess/grant-with-prompt-preserves-gesture.html b/LayoutTests/http/tests/storageAccess/grant-with-prompt-preserves-gesture.html >new file mode 100644 >index 0000000000000000000000000000000000000000..8341283816e079dd63c4c9b6639752b6f2a3bcc7 >--- /dev/null >+++ b/LayoutTests/http/tests/storageAccess/grant-with-prompt-preserves-gesture.html >@@ -0,0 +1,74 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <script src="/js-test-resources/js-test.js"></script> >+ <script src="/js-test-resources/ui-helper.js"></script> >+ <script src="/resourceLoadStatistics/resources/util.js"></script> >+ <script> >+ description("Tests that cross-origin iframe can display a window if storage access is granted."); >+ jsTestIsAsync = true; >+ >+ const hostUnderTest = "localhost:8000"; >+ const statisticsUrl = "http://" + hostUnderTest + "/temp"; >+ >+ window.addEventListener("message", receiveMessage, false); >+ >+ function receiveMessage(event) { >+ if (event.origin === "http://localhost:8000") { >+ if (event.data.indexOf("PASS ") !== -1) >+ testPassed(event.data.replace("PASS ", "")); >+ else >+ testFailed(event.data.replace("FAIL ", "")); >+ } else >+ testFailed("Received a message from an unexpected origin: " + event.origin); >+ setEnableFeature(false, finishJSTest); >+ } >+ >+ function activateElement(elementId) { >+ var element = document.getElementById(elementId); >+ var centerX = element.offsetLeft + element.offsetWidth / 2; >+ var centerY = element.offsetTop + element.offsetHeight / 2; >+ UIHelper.activateAt(centerX, centerY).then( >+ function () { >+ if (window.eventSender) >+ eventSender.keyDown("escape"); >+ else { >+ testFailed("No eventSender."); >+ setEnableFeature(false, finishJSTest); >+ } >+ }, >+ function () { >+ testFailed("Promise rejected."); >+ setEnableFeature(false, finishJSTest); >+ } >+ ); >+ } >+ >+ function runTest() { >+ setEnableFeature(true, function() { >+ testRunner.setCanOpenWindows(false); >+ testRunner.setPopupBlockingEnabled(true); >+ testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() { >+ if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >+ testFailed("Host did not get set as prevalent resource."); >+ testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, true, function() { >+ if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) >+ testFailed("Host did not get logged for user interaction."); >+ testRunner.statisticsUpdateCookieBlocking(function() { >+ let iframeElement = document.createElement("iframe"); >+ iframeElement.onload = function() { >+ activateElement("TheIframeThatRequestsStorageAccess"); >+ }; >+ iframeElement.id = "TheIframeThatRequestsStorageAccess"; >+ iframeElement.src = "http://localhost:8000/storageAccess/resources/request-storage-access-iframe-and-pop-window.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess,isNotSameOriginIframe"; >+ document.body.appendChild(iframeElement); >+ }); >+ }); >+ }); >+ }); >+ } >+ </script> >+</head> >+<body onload="runTest()"> >+</body> >+</html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off-expected.txt b/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..249631b14c8c6440a036832562505e120986c48e >--- /dev/null >+++ b/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off-expected.txt >@@ -0,0 +1,10 @@ >+Tests that document.hasStorageAccess() returns true for a 3rd-party iframe if there is no way to request access (feature off). >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS Has storage access. document.cookie == , cookies seen server-side == "No cookies" >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html b/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html >new file mode 100644 >index 0000000000000000000000000000000000000000..d3fcb52d1044c792f276167d0617efebba95b281 >--- /dev/null >+++ b/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html >@@ -0,0 +1,38 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <script src="/js-test-resources/js-test.js"></script> >+ <script src="/js-test-resources/ui-helper.js"></script> >+ <script src="/resourceLoadStatistics/resources/util.js"></script> >+ <script> >+ description("Tests that document.hasStorageAccess() returns true for a 3rd-party iframe if there is no way to request access (feature off)."); >+ jsTestIsAsync = true; >+ >+ window.addEventListener("message", receiveMessage, false); >+ >+ function receiveMessage(event) { >+ if (event.origin === "http://localhost:8000") { >+ if (event.data.indexOf("PASS") !== -1) >+ testPassed(event.data.replace("PASS ", "")); >+ else >+ testFailed(event.data.replace("FAIL ", "")); >+ } else >+ testFailed("Received a message from an unexpected origin: " + event.origin); >+ setEnableFeature(false, finishJSTest); >+ } >+ >+ const hostUnderTest = "localhost:8000"; >+ const statisticsUrl = "http://" + hostUnderTest + "/temp"; >+ function runTest() { >+ setEnableFeature(false, function() { >+ let iframeElement = document.createElement("iframe"); >+ iframeElement.id = "TheIframeThatRequestsStorageAccess"; >+ iframeElement.src = "http://localhost:8000/storageAccess/resources/has-storage-access-iframe.html#policyShouldGrantAccess"; >+ document.body.appendChild(iframeElement); >+ }); >+ } >+ </script> >+</head> >+<body onload="runTest()"> >+</body> >+</html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-pop-window-expected.txt b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-pop-window-expected.txt >deleted file mode 100644 >index d7ec4cf7f7841d57c68ddb5fa66cb5634b31da3b..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-pop-window-expected.txt >+++ /dev/null >@@ -1,10 +0,0 @@ >-Tests that cross-origin iframe can display a window if storage access is granted. >- >-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >- >- >-PASS Window was successfully opened with user interaction. >-PASS successfullyParsed is true >- >-TEST COMPLETE >- >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-pop-window.html b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-pop-window.html >deleted file mode 100644 >index 291f9fbb417af76de66b5f948713dd0861c96c36..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-pop-window.html >+++ /dev/null >@@ -1,75 +0,0 @@ >-<!DOCTYPE html> >-<html> >-<head> >- <script src="/js-test-resources/js-test.js"></script> >- <script src="/js-test-resources/ui-helper.js"></script> >- <script src="/resourceLoadStatistics/resources/util.js"></script> >- <script> >- description("Tests that cross-origin iframe can display a window if storage access is granted."); >- jsTestIsAsync = true; >- >- const hostUnderTest = "localhost:8000"; >- const statisticsUrl = "http://" + hostUnderTest + "/temp"; >- >- window.addEventListener("message", receiveMessage, false); >- >- function receiveMessage(event) { >- if (event.origin === "http://localhost:8000") { >- if (event.data.indexOf("PASS ") !== -1) >- testPassed(event.data.replace("PASS ", "")); >- else >- testFailed(event.data); >- } else >- testFailed("Received a message from an unexpected origin: " + event.origin); >- setEnableFeature(false, finishJSTest); >- } >- >- function activateElement(elementId) { >- var element = document.getElementById(elementId); >- var centerX = element.offsetLeft + element.offsetWidth / 2; >- var centerY = element.offsetTop + element.offsetHeight / 2; >- UIHelper.activateAt(centerX, centerY).then( >- function () { >- if (window.eventSender) >- eventSender.keyDown("escape"); >- else { >- testFailed("No eventSender."); >- setEnableFeature(false, finishJSTest); >- } >- }, >- function () { >- testFailed("Promise rejected."); >- setEnableFeature(false, finishJSTest); >- } >- ); >- } >- >- function runTest() { >- setEnableFeature(true, function() { >- testRunner.setCanOpenWindows(false); >- testRunner.setPopupBlockingEnabled(true); >- testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() { >- if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >- testFailed("Host did not get set as prevalent resource."); >- testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, true, function() { >- if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) >- testFailed("Host did not get logged for user interaction."); >- testRunner.statisticsUpdateCookieBlocking(function() { >- let iframeElement = document.createElement("iframe"); >- iframeElement.onload = function() { >- activateElement("TheIframeThatRequestsStorageAccess"); >- }; >- iframeElement.id = "TheIframeThatRequestsStorageAccess"; >- iframeElement.src = "http://localhost:8000/storageAccess/resources/request-storage-access-iframe-and-pop-window.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess,isNotSameOriginIframe"; >- document.body.appendChild(iframeElement); >- >- }); >- }); >- }); >- }); >- } >- </script> >-</head> >-<body onload="runTest()"> >-</body> >-</html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/storageAccess/resources/request-storage-access-and-immediately-postmessage-iframe.html b/LayoutTests/http/tests/storageAccess/resources/request-storage-access-and-immediately-postmessage-iframe.html >index 2840fc135094f60d15ac9a126ba27d7acc63bce5..5d948015e075228071d24bd3c7c3a017a7207314 100644 >--- a/LayoutTests/http/tests/storageAccess/resources/request-storage-access-and-immediately-postmessage-iframe.html >+++ b/LayoutTests/http/tests/storageAccess/resources/request-storage-access-and-immediately-postmessage-iframe.html >@@ -1,9 +1,6 @@ > <html> > <head> > <script> >- if (internals) >- internals.setUserGrantsStorageAccess(true); >- > function makeRequestWithUserGesture() { > document.requestStorageAccess(); > top.postMessage("API called.", "http://127.0.0.1:8000"); >diff --git a/LayoutTests/http/tests/storageAccess/resources/request-storage-access-iframe-and-pop-window.html b/LayoutTests/http/tests/storageAccess/resources/request-storage-access-iframe-and-pop-window.html >index 8da52bffb08d69e5ff6d6ff9677317692dfd4934..46714fedfb907f98dbff40ca60e2272518f8a74b 100644 >--- a/LayoutTests/http/tests/storageAccess/resources/request-storage-access-iframe-and-pop-window.html >+++ b/LayoutTests/http/tests/storageAccess/resources/request-storage-access-iframe-and-pop-window.html >@@ -8,9 +8,6 @@ > const isSameOriginIframe = hashArguments[3] === "isSameOriginIframe"; > const originIsNull = hashArguments[4] === "originIsNull"; > >- if (window.internals) >- internals.setUserGrantsStorageAccess(userShouldGrantAccess); >- > if (window.testRunner) { > testRunner.setCanOpenWindows(false); > testRunner.setPopupBlockingEnabled(true); >@@ -25,10 +22,14 @@ > > function windowWasOpened() > { >- if (userShouldGrantAccess) >+ if (userShouldBeConsulted && userShouldGrantAccess) > messageToTop("PASS Window was successfully opened with user interaction."); >+ else if (userShouldBeConsulted && !userShouldGrantAccess) >+ messageToTop("FAIL Window was opened even though the user explicitly declined permission."); >+ else if (!userShouldBeConsulted && !userShouldGrantAccess) >+ messageToTop("PASS Window was successfully opened with user interaction since the user was never consulted/prompted."); > else >- messageToTop("Window was opened even though the user declined permission."); >+ messageToTop("FAIL Conflicting instructions: !userShouldBeConsulted && userShouldGrantAccess ."); > } > > function makeRequestWithUserGesture() { >@@ -48,12 +49,14 @@ > function continueAfterRequestWithUserGesture() { > var win = window.open("request-storage-access-second-window.html", "test window"); > if (!win) { >- if (userShouldGrantAccess) >- messageToTop("Window was not opened even though the user granted permission."); >- else >+ if (userShouldBeConsulted && userShouldGrantAccess) >+ messageToTop("FAIL Window was not opened even though the user explicitly granted permission."); >+ else if (userShouldBeConsulted && !userShouldGrantAccess) > messageToTop("PASS Window was blocked from opening."); >- } else if (!userShouldGrantAccess) { >- messageToTop("Window was opened even though the user did not grant permission."); >+ else if (!userShouldBeConsulted && !userShouldGrantAccess) >+ messageToTop("FAIL Window was blocked from opening even though the user was never consulted/prompted."); >+ else >+ messageToTop("FAIL Conflicting instructions: !userShouldBeConsulted && userShouldGrantAccess ."); > } > } > </script> >diff --git a/LayoutTests/http/tests/storageAccess/resources/request-storage-access-iframe.html b/LayoutTests/http/tests/storageAccess/resources/request-storage-access-iframe.html >index 6afd6c8b1b2fe14d7f147a4f6e1875f1072eea07..543132c466116082ab117b3ef20825b0a52444af 100644 >--- a/LayoutTests/http/tests/storageAccess/resources/request-storage-access-iframe.html >+++ b/LayoutTests/http/tests/storageAccess/resources/request-storage-access-iframe.html >@@ -8,9 +8,6 @@ > const isSameOriginIframe = hashArguments[3] === "isSameOriginIframe"; > const originIsNull = hashArguments[4] === "originIsNull"; > >- if (internals && userShouldGrantAccess) >- internals.setUserGrantsStorageAccess(true); >- > var requestStorageAccessResolved; > > function messageToTop(messagePrefix, fetchData) { >diff --git a/LayoutTests/http/tests/storageAccess/resources/request-storage-access-without-user-gesture-iframe.html b/LayoutTests/http/tests/storageAccess/resources/request-storage-access-without-user-gesture-iframe.html >index 64fd4a4fa00172079df187f659956c8e1284e361..a7b40c8534e64275f3d8f24757becef3a4e90b1d 100644 >--- a/LayoutTests/http/tests/storageAccess/resources/request-storage-access-without-user-gesture-iframe.html >+++ b/LayoutTests/http/tests/storageAccess/resources/request-storage-access-without-user-gesture-iframe.html >@@ -6,9 +6,6 @@ > const userShouldBeConsulted = hashArguments[1] === "userShouldBeConsulted"; > const policyShouldGrantAccess = hashArguments[2] === "policyShouldGrantAccess"; > >- if (internals && userShouldGrantAccess) >- internals.setUserGrantsStorageAccess(true); >- > var requestStorageAccessResolved; > > function makeRequestWithoutUserGesture() { >diff --git a/LayoutTests/http/tests/storageAccess/resources/self-navigating-frame-after-granted-access.html b/LayoutTests/http/tests/storageAccess/resources/self-navigating-frame-after-granted-access.html >index dbda7ea2430b687acfd57fe353bc0448b85a37d3..52565c2c51c633e9ac25feb618b5b7bd63fd5d9e 100644 >--- a/LayoutTests/http/tests/storageAccess/resources/self-navigating-frame-after-granted-access.html >+++ b/LayoutTests/http/tests/storageAccess/resources/self-navigating-frame-after-granted-access.html >@@ -7,9 +7,6 @@ > const policyShouldGrantAccess = hashArguments[2] === "policyShouldGrantAccess"; > const sameSiteNavigation = hashArguments[3] === "sameSiteNavigation"; > >- if (internals && userShouldGrantAccess) >- internals.setUserGrantsStorageAccess(true); >- > var requestStorageAccessResolved; > > function makeRequestWithUserGesture() { >diff --git a/LayoutTests/platform/mac-wk2/TestExpectations b/LayoutTests/platform/mac-wk2/TestExpectations >index f4c190dafc79e5322a0b1dcea2f83e72e602bce1..61e3b4db9b989b38a05bf7b6b5239ebdb7788f7b 100644 >--- a/LayoutTests/platform/mac-wk2/TestExpectations >+++ b/LayoutTests/platform/mac-wk2/TestExpectations >@@ -726,6 +726,9 @@ http/tests/resourceLoadStatistics/user-interaction-reported-after-website-data-r > [ HighSierra+ ] http/tests/storageAccess/request-and-grant-access-then-navigate-same-site-should-have-access.html [ Pass ] > [ HighSierra+ ] http/tests/storageAccess/deny-storage-access-under-opener.html [ Pass ] > [ HighSierra+ ] http/tests/storageAccess/deny-storage-access-under-opener-if-auto-dismiss.html [ Pass ] >+[ HighSierra+ ] http/tests/storageAccess/grant-with-prompt-preserves-gesture.html [ Pass ] >+[ HighSierra+ ] http/tests/storageAccess/deny-with-prompt-does-not-preserve-gesture.html [ Skip ] >+[ HighSierra+ ] http/tests/storageAccess/deny-without-prompt-preserves-gesture.html [ Pass ] > > # As of https://trac.webkit.org/changeset/227762 the timestampResolution is just 5 seconds which makes this test flaky > http/tests/resourceLoadStatistics/user-interaction-only-reported-once-within-short-period-of-time.html [ Skip ]
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 197648
:
369233
|
369299
|
369300
|
369310