From 6ab8763b07ac5edbfa248deb88c0bfb813a80473 Mon Sep 17 00:00:00 2001 From: "wilander@apple.com" Date: Mon, 18 Dec 2017 03:44:54 +0000 Subject: [PATCH] Storage Access API: Make document.hasStorageAccess() retrieve current status from the network process https://bugs.webkit.org/show_bug.cgi?id=180681 Reviewed by Alex Christensen. Source/WebCore: Tests: http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction.html http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction.html This change makes an asynchronous request to the network process to see if storage access has been granted for this frame, on this page, for this domain. * dom/Document.cpp: (WebCore::Document::hasStorageAccess): * page/ChromeClient.h: Source/WebKit: This change makes an asynchronous request to the network process to see if storage access has been granted for this frame, on this page, for this domain. * NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::hasStorageAccessForPrevalentDomains): (WebKit::NetworkProcess::updateStorageAccessForPrevalentDomains): * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkProcess.messages.in: * UIProcess/Network/NetworkProcessProxy.cpp: (WebKit::NetworkProcessProxy::hasStorageAccessForPrevalentDomains): * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::hasStorageAccess): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore): (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess): * UIProcess/WebResourceLoadStatisticsStore.h: * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::hasStorageAccessForPrevalentDomainsHandler): (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback): (WebKit::WebsiteDataStore::hasStorageAccess): * UIProcess/WebsiteData/WebsiteDataStore.h: * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::hasStorageAccess): * WebProcess/WebCoreSupport/WebChromeClient.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::hasStorageAccess): * WebProcess/WebPage/WebPage.h: LayoutTests: This change makes an asynchronous request to the network process to see if storage access has been granted for this frame, on this page, for this domain. * http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction-expected.txt: Added. * http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction.html: Added. * http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction-expected.txt: Added. * http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction.html: Added. * http/tests/storageAccess/resources/has-storage-access-iframe.html: Added. * platform/mac-wk2/TestExpectations: New tests marked as [ Pass ]. All http/tests/storageAccess/ tests marked [ HighSierra+ ] since document.hasStorageAccess() now requires code that relies on cookie partitioning. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226016 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- LayoutTests/ChangeLog | 23 +++++++++++++ ...n-with-non-recent-user-interaction-expected.txt | 10 ++++++ ...nt-domain-with-non-recent-user-interaction.html | 36 +++++++++++++++++++ ...omain-with-recent-user-interaction-expected.txt | 10 ++++++ ...valent-domain-with-recent-user-interaction.html | 36 +++++++++++++++++++ .../resources/has-storage-access-iframe.html | 30 ++++++++++++++++ LayoutTests/platform/mac-wk2/TestExpectations | 30 ++++++++-------- Source/WebCore/ChangeLog | 19 ++++++++++ Source/WebCore/dom/Document.cpp | 26 ++++++++------ Source/WebCore/page/ChromeClient.h | 2 +- Source/WebKit/ChangeLog | 40 ++++++++++++++++++++++ Source/WebKit/NetworkProcess/NetworkProcess.cpp | 8 +++++ Source/WebKit/NetworkProcess/NetworkProcess.h | 1 + .../NetworkProcess/NetworkProcess.messages.in | 1 + .../UIProcess/Network/NetworkProcessProxy.cpp | 8 +++++ .../WebKit/UIProcess/Network/NetworkProcessProxy.h | 3 +- Source/WebKit/UIProcess/WebPageProxy.cpp | 4 +-- Source/WebKit/UIProcess/WebPageProxy.h | 2 +- Source/WebKit/UIProcess/WebPageProxy.messages.in | 2 +- .../UIProcess/WebResourceLoadStatisticsStore.cpp | 24 ++++++------- .../UIProcess/WebResourceLoadStatisticsStore.h | 10 +++--- .../UIProcess/WebsiteData/WebsiteDataStore.cpp | 14 ++++++-- .../UIProcess/WebsiteData/WebsiteDataStore.h | 3 +- .../WebProcess/WebCoreSupport/WebChromeClient.cpp | 4 +-- .../WebProcess/WebCoreSupport/WebChromeClient.h | 2 +- Source/WebKit/WebProcess/WebPage/WebPage.cpp | 4 +-- Source/WebKit/WebProcess/WebPage/WebPage.h | 2 +- 27 files changed, 298 insertions(+), 56 deletions(-) create mode 100644 LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction-expected.txt create mode 100644 LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction.html create mode 100644 LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction-expected.txt create mode 100644 LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction.html create mode 100644 LayoutTests/http/tests/storageAccess/resources/has-storage-access-iframe.html diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index 86ef3e4..c7bceae 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,26 @@ +2017-12-17 John Wilander + + Storage Access API: Make document.hasStorageAccess() retrieve current status from the network process + https://bugs.webkit.org/show_bug.cgi?id=180681 + + + Reviewed by Alex Christensen. + + This change makes an asynchronous request to the network process + to see if storage access has been granted for this frame, on this + page, for this domain. + + * http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction-expected.txt: Added. + * http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction.html: Added. + * http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction-expected.txt: Added. + * http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction.html: Added. + * http/tests/storageAccess/resources/has-storage-access-iframe.html: Added. + * platform/mac-wk2/TestExpectations: + New tests marked as [ Pass ]. + All http/tests/storageAccess/ tests marked [ HighSierra+ ] since + document.hasStorageAccess() now requires code that relies on cookie + partitioning. + 2017-12-16 Ms2ger Enable wpt fetch tests on WPE. diff --git a/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction-expected.txt b/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction-expected.txt new file mode 100644 index 0000000..70d5c6b --- /dev/null +++ b/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction-expected.txt @@ -0,0 +1,10 @@ +Tests that a cross-origin iframe from a prevalent domain with non-recent user interaction does not have storage access. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS No storage access. +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction.html b/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction.html new file mode 100644 index 0000000..c6ea1db7 --- /dev/null +++ b/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction.html @@ -0,0 +1,36 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction-expected.txt b/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction-expected.txt new file mode 100644 index 0000000..49d28b9 --- /dev/null +++ b/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction-expected.txt @@ -0,0 +1,10 @@ +Tests that a cross-origin iframe from a prevalent domain with recent user interaction does have storage access. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS Has storage access. +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction.html b/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction.html new file mode 100644 index 0000000..510215a --- /dev/null +++ b/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction.html @@ -0,0 +1,36 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/LayoutTests/http/tests/storageAccess/resources/has-storage-access-iframe.html b/LayoutTests/http/tests/storageAccess/resources/has-storage-access-iframe.html new file mode 100644 index 0000000..21578c9 --- /dev/null +++ b/LayoutTests/http/tests/storageAccess/resources/has-storage-access-iframe.html @@ -0,0 +1,30 @@ + + + + + + + \ No newline at end of file diff --git a/LayoutTests/platform/mac-wk2/TestExpectations b/LayoutTests/platform/mac-wk2/TestExpectations index 7d1ddb5..ef9c507 100644 --- a/LayoutTests/platform/mac-wk2/TestExpectations +++ b/LayoutTests/platform/mac-wk2/TestExpectations @@ -749,22 +749,24 @@ webkit.org/b/172397 [ Debug ] animations/needs-layout.html [ Pass ImageOnlyFailu http/tests/resourceLoadStatistics/user-interaction-in-cross-origin-sub-frame.html [ Pass ] http/tests/resourceLoadStatistics/user-interaction-only-reported-once-within-short-period-of-time.html [ Pass ] http/tests/resourceLoadStatistics/user-interaction-reported-after-website-data-removal.html [ Pass ] -http/tests/storageAccess/request-and-deny-storage-access-cross-origin-iframe.html [ Pass ] -http/tests/storageAccess/request-and-deny-storage-access-cross-origin-sandboxed-iframe.html [ Pass ] -http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe.html [ Pass ] -http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe.html [ Pass ] -http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin.html [ Pass ] -http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-allow-token.html [ Pass ] -http/tests/storageAccess/request-storage-access-same-origin-iframe.html [ Pass ] -http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe-without-allow-token.html [ Pass ] -http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe.html [ Pass ] -http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-nested-iframe.html [ Pass ] -http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-recent-user-interaction.html [ Pass ] +[ HighSierra+ ] http/tests/storageAccess/request-and-deny-storage-access-cross-origin-iframe.html [ Pass ] +[ HighSierra+ ] http/tests/storageAccess/request-and-deny-storage-access-cross-origin-sandboxed-iframe.html [ Pass ] +[ HighSierra+ ] http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe.html [ Pass ] +[ HighSierra+ ] http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe.html [ Pass ] +[ HighSierra+ ] http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin.html [ Pass ] +[ HighSierra+ ] http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-allow-token.html [ Pass ] +[ HighSierra+ ] http/tests/storageAccess/request-storage-access-same-origin-iframe.html [ Pass ] +[ HighSierra+ ] http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe-without-allow-token.html [ Pass ] +[ HighSierra+ ] http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe.html [ Pass ] +[ HighSierra+ ] http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-nested-iframe.html [ Pass ] +[ HighSierra+ ] http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-recent-user-interaction.html [ Pass ] [ HighSierra+ ] http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-but-try-access-from-wrong-frame.html [ Pass ] [ HighSierra+ ] http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-and-try-access-from-right-frame.html [ Pass ] -http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction.html [ Pass ] -http/tests/storageAccess/request-storage-access-top-frame.html [ Pass ] -http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-user-gesture.html [ Pass ] +[ HighSierra+ ] http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction.html [ Pass ] +[ HighSierra+ ] http/tests/storageAccess/request-storage-access-top-frame.html [ Pass ] +[ HighSierra+ ] http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-user-gesture.html [ Pass ] +[ HighSierra+ ] http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction.html [ Pass ] +[ HighSierra+ ] http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction.html [ Pass ] webkit.org/b/173861 [ Release ] http/tests/webrtc/filtering-ice-candidate-same-origin-frame.html [ Pass Timeout ] webkit.org/b/173861 [ Release ] http/tests/webrtc/filtering-ice-candidate-cross-origin-frame.html [ Pass Timeout ] diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index a67eb39..9b8aa7a 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,22 @@ +2017-12-17 John Wilander + + Storage Access API: Make document.hasStorageAccess() retrieve current status from the network process + https://bugs.webkit.org/show_bug.cgi?id=180681 + + + Reviewed by Alex Christensen. + + Tests: http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction.html + http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction.html + + This change makes an asynchronous request to the network process + to see if storage access has been granted for this frame, on this + page, for this domain. + + * dom/Document.cpp: + (WebCore::Document::hasStorageAccess): + * page/ChromeClient.h: + 2017-12-17 Chris Dumez Strip fragment identifier from ServiceWorker's scriptURL diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp index a1d0e4d..deab18d 100644 --- a/Source/WebCore/dom/Document.cpp +++ b/Source/WebCore/dom/Document.cpp @@ -7423,15 +7423,15 @@ Logger& Document::logger() return *m_logger; } -void Document::hasStorageAccess(Ref&& passedPromise) +void Document::hasStorageAccess(Ref&& promise) { ASSERT(settings().storageAccessAPIEnabled()); - RefPtr promise(WTFMove(passedPromise)); - - if (m_hasFrameSpecificStorageAccess) + if (m_hasFrameSpecificStorageAccess) { promise->resolve(true); - + return; + } + if (!m_frame || securityOrigin().isUnique()) { promise->resolve(false); return; @@ -7449,10 +7449,18 @@ void Document::hasStorageAccess(Ref&& passedPromise) return; } + ASSERT(m_frame); + 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), [documentReference = m_weakFactory.createWeakPtr(*this), promise] (bool hasAccess) { + page->chrome().client().hasStorageAccess(WTFMove(iframeHost), WTFMove(topHost), frameID.value(), pageID.value(), [documentReference = m_weakFactory.createWeakPtr(*this), promise = WTFMove(promise)] (bool hasAccess) { Document* document = documentReference.get(); if (!document) return; @@ -7465,12 +7473,10 @@ void Document::hasStorageAccess(Ref&& passedPromise) promise->reject(); } -void Document::requestStorageAccess(Ref&& passedPromise) +void Document::requestStorageAccess(Ref&& promise) { ASSERT(settings().storageAccessAPIEnabled()); - RefPtr promise(WTFMove(passedPromise)); - if (m_hasFrameSpecificStorageAccess) promise->resolve(); @@ -7529,7 +7535,7 @@ void Document::requestStorageAccess(Ref&& passedPromise) // FIXME: Don't use runJavaScriptConfirm because it responds synchronously. if ((page && page->chrome().runJavaScriptConfirm(*m_frame, builder.toString())) || m_grantStorageAccessOverride) { - page->chrome().client().requestStorageAccess(WTFMove(iframeHost), WTFMove(topHost), frameID.value(), pageID.value(), [documentReference = m_weakFactory.createWeakPtr(*this), promise] (bool wasGranted) { + page->chrome().client().requestStorageAccess(WTFMove(iframeHost), WTFMove(topHost), frameID.value(), pageID.value(), [documentReference = m_weakFactory.createWeakPtr(*this), promise = WTFMove(promise)] (bool wasGranted) { Document* document = documentReference.get(); if (!document) return; diff --git a/Source/WebCore/page/ChromeClient.h b/Source/WebCore/page/ChromeClient.h index 2b8ac68..b415d28 100644 --- a/Source/WebCore/page/ChromeClient.h +++ b/Source/WebCore/page/ChromeClient.h @@ -467,7 +467,7 @@ public: virtual void reportProcessCPUTime(Seconds, ActivityStateForCPUSampling) { } virtual RefPtr createIconForFiles(const Vector& /* filenames */) = 0; - virtual void hasStorageAccess(String&& /*subFrameHost*/, String&& /*topFrameHost*/, WTF::CompletionHandler&& callback) { callback(false); } + virtual void hasStorageAccess(String&& /*subFrameHost*/, String&& /*topFrameHost*/, uint64_t /*frameID*/, uint64_t /*pageID*/, WTF::CompletionHandler&& callback) { callback(false); } virtual void requestStorageAccess(String&& /*subFrameHost*/, String&& /*topFrameHost*/, uint64_t /*frameID*/, uint64_t /*pageID*/, WTF::CompletionHandler&& callback) { callback(false); } virtual void didInsertMenuElement(HTMLMenuElement&) { } diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog index 9d3b0fd..59503f3 100644 --- a/Source/WebKit/ChangeLog +++ b/Source/WebKit/ChangeLog @@ -1,3 +1,43 @@ +2017-12-17 John Wilander + + Storage Access API: Make document.hasStorageAccess() retrieve current status from the network process + https://bugs.webkit.org/show_bug.cgi?id=180681 + + + Reviewed by Alex Christensen. + + This change makes an asynchronous request to the network process + to see if storage access has been granted for this frame, on this + page, for this domain. + + * NetworkProcess/NetworkProcess.cpp: + (WebKit::NetworkProcess::hasStorageAccessForPrevalentDomains): + (WebKit::NetworkProcess::updateStorageAccessForPrevalentDomains): + * NetworkProcess/NetworkProcess.h: + * NetworkProcess/NetworkProcess.messages.in: + * UIProcess/Network/NetworkProcessProxy.cpp: + (WebKit::NetworkProcessProxy::hasStorageAccessForPrevalentDomains): + * UIProcess/Network/NetworkProcessProxy.h: + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::hasStorageAccess): + * UIProcess/WebPageProxy.h: + * UIProcess/WebPageProxy.messages.in: + * UIProcess/WebResourceLoadStatisticsStore.cpp: + (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore): + (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess): + * UIProcess/WebResourceLoadStatisticsStore.h: + * UIProcess/WebsiteData/WebsiteDataStore.cpp: + (WebKit::WebsiteDataStore::hasStorageAccessForPrevalentDomainsHandler): + (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback): + (WebKit::WebsiteDataStore::hasStorageAccess): + * UIProcess/WebsiteData/WebsiteDataStore.h: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::hasStorageAccess): + * WebProcess/WebCoreSupport/WebChromeClient.h: + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::hasStorageAccess): + * WebProcess/WebPage/WebPage.h: + 2017-12-16 Dan Bernstein WKWebView has no equivalent of -[WebView setAlwaysShowVerticalScroller:] diff --git a/Source/WebKit/NetworkProcess/NetworkProcess.cpp b/Source/WebKit/NetworkProcess/NetworkProcess.cpp index e9fac84..5537a94 100644 --- a/Source/WebKit/NetworkProcess/NetworkProcess.cpp +++ b/Source/WebKit/NetworkProcess/NetworkProcess.cpp @@ -335,6 +335,14 @@ void NetworkProcess::updatePrevalentDomainsToPartitionOrBlockCookies(PAL::Sessio networkStorageSession->setPrevalentDomainsToPartitionOrBlockCookies(domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, shouldClearFirst); } +void NetworkProcess::hasStorageAccessForPrevalentDomains(PAL::SessionID sessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, uint64_t contextId) +{ + if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID)) + parentProcessConnection()->send(Messages::NetworkProcessProxy::StorageAccessRequestResult(networkStorageSession->isStorageAccessGranted(resourceDomain, firstPartyDomain, frameID, pageID), contextId), 0); + else + ASSERT_NOT_REACHED(); +} + void NetworkProcess::updateStorageAccessForPrevalentDomains(PAL::SessionID sessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, bool shouldGrantStorage, uint64_t contextId) { bool isStorageGranted = false; diff --git a/Source/WebKit/NetworkProcess/NetworkProcess.h b/Source/WebKit/NetworkProcess/NetworkProcess.h index 3432637..d8058c0 100644 --- a/Source/WebKit/NetworkProcess/NetworkProcess.h +++ b/Source/WebKit/NetworkProcess/NetworkProcess.h @@ -138,6 +138,7 @@ public: #if HAVE(CFNETWORK_STORAGE_PARTITIONING) void updatePrevalentDomainsToPartitionOrBlockCookies(PAL::SessionID, const Vector& domainsToPartition, const Vector& domainsToBlock, const Vector& domainsToNeitherPartitionNorBlock, bool shouldClearFirst); + void hasStorageAccessForPrevalentDomains(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, uint64_t contextId); void updateStorageAccessForPrevalentDomains(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, bool value, uint64_t contextId); void removePrevalentDomains(PAL::SessionID, const Vector& domains); #endif diff --git a/Source/WebKit/NetworkProcess/NetworkProcess.messages.in b/Source/WebKit/NetworkProcess/NetworkProcess.messages.in index 2c6c34d..f25acec 100644 --- a/Source/WebKit/NetworkProcess/NetworkProcess.messages.in +++ b/Source/WebKit/NetworkProcess/NetworkProcess.messages.in @@ -83,6 +83,7 @@ messages -> NetworkProcess LegacyReceiver { #if HAVE(CFNETWORK_STORAGE_PARTITIONING) UpdatePrevalentDomainsToPartitionOrBlockCookies(PAL::SessionID sessionID, Vector domainsToPartition, Vector domainsToBlock, Vector domainsToNeitherPartitionNorBlock, bool shouldClearFirst) + HasStorageAccessForPrevalentDomains(PAL::SessionID sessionID, String resourceDomain, String firstPartyDomain, uint64_t frameID, uint64_t pageID, uint64_t contextId) UpdateStorageAccessForPrevalentDomains(PAL::SessionID sessionID, String resourceDomain, String firstPartyDomain, uint64_t frameID, uint64_t pageID, bool shouldGrantAccess, uint64_t contextId) RemovePrevalentDomains(PAL::SessionID sessionID, Vector domainsWithInteraction); #endif diff --git a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp index 446406a..6ac3782 100644 --- a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp +++ b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp @@ -408,6 +408,14 @@ static uint64_t nextRequestStorageAccessContextId() return ++nextContextId; } +void NetworkProcessProxy::hasStorageAccessForPrevalentDomains(PAL::SessionID sessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler&& callback) +{ + auto contextId = nextRequestStorageAccessContextId(); + auto addResult = m_storageAccessResponseCallbackMap.add(contextId, WTFMove(callback)); + ASSERT_UNUSED(addResult, addResult.isNewEntry); + send(Messages::NetworkProcess::HasStorageAccessForPrevalentDomains(sessionID, resourceDomain, firstPartyDomain, frameID, pageID, contextId), 0); +} + void NetworkProcessProxy::updateStorageAccessForPrevalentDomains(PAL::SessionID sessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, bool value, WTF::CompletionHandler&& callback) { auto contextId = nextRequestStorageAccessContextId(); diff --git a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h index 81d9c58..48b5f81 100644 --- a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h +++ b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h @@ -78,7 +78,8 @@ public: #endif #if HAVE(CFNETWORK_STORAGE_PARTITIONING) - void updateStorageAccessForPrevalentDomains(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, bool value, WTF::CompletionHandler&& callback); + void hasStorageAccessForPrevalentDomains(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, CompletionHandler&& callback); + void updateStorageAccessForPrevalentDomains(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, bool value, CompletionHandler&& callback); #endif void processReadyToSuspend(); diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp index 1c25d5b..a9b43c2 100644 --- a/Source/WebKit/UIProcess/WebPageProxy.cpp +++ b/Source/WebKit/UIProcess/WebPageProxy.cpp @@ -7187,9 +7187,9 @@ void WebPageProxy::stopURLSchemeTask(uint64_t handlerIdentifier, uint64_t taskId iterator->value->stopTask(*this, taskIdentifier); } -void WebPageProxy::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t webProcessContextId) +void WebPageProxy::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, uint64_t webProcessContextId) { - m_websiteDataStore->hasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), [this, webProcessContextId] (bool hasAccess) { + m_websiteDataStore->hasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, [this, webProcessContextId] (bool hasAccess) { m_process->send(Messages::WebPage::StorageAccessResponse(hasAccess, webProcessContextId), m_pageID); }); } diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h index c8d392e..0139046 100644 --- a/Source/WebKit/UIProcess/WebPageProxy.h +++ b/Source/WebKit/UIProcess/WebPageProxy.h @@ -1244,7 +1244,7 @@ public: void touchBarMenuItemDataRemoved(const TouchBarMenuItemData&); #endif - void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t webProcessContextId); + void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, uint64_t webProcessContextId); void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, uint64_t webProcessContextId); #if ENABLE(ATTACHMENT_ELEMENT) diff --git a/Source/WebKit/UIProcess/WebPageProxy.messages.in b/Source/WebKit/UIProcess/WebPageProxy.messages.in index 331ba19..58c998f 100644 --- a/Source/WebKit/UIProcess/WebPageProxy.messages.in +++ b/Source/WebKit/UIProcess/WebPageProxy.messages.in @@ -508,7 +508,7 @@ messages -> WebPageProxy { StartURLSchemeTask(struct WebKit::URLSchemeTaskParameters parameters) StopURLSchemeTask(uint64_t handlerIdentifier, uint64_t taskIdentifier) - HasStorageAccess(String subFrameHost, String topFrameHost, uint64_t contextID) + HasStorageAccess(String subFrameHost, String topFrameHost, uint64_t frameID, uint64_t pageID, uint64_t contextID) RequestStorageAccess(String subFrameHost, String topFrameHost, uint64_t frameID, uint64_t pageID, uint64_t contextID) #if ENABLE(ATTACHMENT_ELEMENT) diff --git a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp index 8f12b53..3913a1c 100644 --- a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp +++ b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp @@ -147,10 +147,11 @@ static Vector mergeOperatingDates(const Vector& ex return mergedDates; } -WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore(const String& resourceLoadStatisticsDirectory, Function&& testingCallback, UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler&& updatePrevalentDomainsToPartitionOrBlockCookiesHandler, UpdateStorageAccessForPrevalentDomainsHandler&& updateStorageAccessForPrevalentDomainsHandler, RemovePrevalentDomainsHandler&& removeDomainsHandler) +WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore(const String& resourceLoadStatisticsDirectory, Function&& testingCallback, UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler&& updatePrevalentDomainsToPartitionOrBlockCookiesHandler, HasStorageAccessForPrevalentDomainsHandler&& hasStorageAccessForPrevalentDomainsHandler, UpdateStorageAccessForPrevalentDomainsHandler&& updateStorageAccessForPrevalentDomainsHandler, RemovePrevalentDomainsHandler&& removeDomainsHandler) : m_statisticsQueue(WorkQueue::create("WebResourceLoadStatisticsStore Process Data Queue", WorkQueue::Type::Serial, WorkQueue::QOS::Utility)) , m_persistentStorage(*this, resourceLoadStatisticsDirectory) , m_updatePrevalentDomainsToPartitionOrBlockCookiesHandler(WTFMove(updatePrevalentDomainsToPartitionOrBlockCookiesHandler)) + , m_hasStorageAccessForPrevalentDomainsHandler(WTFMove(hasStorageAccessForPrevalentDomainsHandler)) , m_updateStorageAccessForPrevalentDomainsHandler(WTFMove(updateStorageAccessForPrevalentDomainsHandler)) , m_removeDomainsHandler(WTFMove(removeDomainsHandler)) , m_dailyTasksTimer(RunLoop::main(), this, &WebResourceLoadStatisticsStore::performDailyTasks) @@ -253,26 +254,25 @@ void WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated(Vector&& callback) +void WebResourceLoadStatisticsStore::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler&& callback) { ASSERT(subFrameHost != topFrameHost); ASSERT(RunLoop::isMain()); - - m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), subFramePrimaryDomain = isolatedPrimaryDomain(subFrameHost), topFramePrimaryDomain = isolatedPrimaryDomain(topFrameHost), callback = WTFMove(callback)] () mutable { - - auto& topFrameStatistic = ensureResourceStatisticsForPrimaryDomain(topFramePrimaryDomain); - if (topFrameStatistic.storageAccessUnderTopFrameOrigins.contains(subFramePrimaryDomain)) { - callback(true); - return; - } + + m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), subFramePrimaryDomain = isolatedPrimaryDomain(subFrameHost), topFramePrimaryDomain = isolatedPrimaryDomain(topFrameHost), frameID, pageID, callback = WTFMove(callback)] () mutable { auto& subFrameStatistic = ensureResourceStatisticsForPrimaryDomain(subFramePrimaryDomain); if (shouldBlockCookies(subFrameStatistic)) { callback(false); return; } - - callback(!shouldPartitionCookies(subFrameStatistic)); + + if (!shouldPartitionCookies(subFrameStatistic)) { + callback(true); + return; + } + + m_hasStorageAccessForPrevalentDomainsHandler(subFramePrimaryDomain, topFramePrimaryDomain, frameID, pageID, WTFMove(callback)); }); } diff --git a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h index c1ff38e..dc6ed48 100644 --- a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h +++ b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h @@ -62,11 +62,12 @@ enum class ShouldClearFirst; class WebResourceLoadStatisticsStore final : public IPC::Connection::WorkQueueMessageReceiver { public: using UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler = WTF::Function& domainsToPartition, const Vector& domainsToBlock, const Vector& domainsToNeitherPartitionNorBlock, ShouldClearFirst)>; + using HasStorageAccessForPrevalentDomainsHandler = WTF::Function&& callback)>; using UpdateStorageAccessForPrevalentDomainsHandler = WTF::Function&& callback)>; using RemovePrevalentDomainsHandler = WTF::Function&)>; - static Ref create(const String& resourceLoadStatisticsDirectory, Function&& testingCallback, UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler&& updatePrevalentDomainsToPartitionOrBlockCookiesHandler = [](const Vector&, const Vector&, const Vector&, ShouldClearFirst) { }, UpdateStorageAccessForPrevalentDomainsHandler&& updateStorageAccessForPrevalentDomainsHandler = [](const String&, const String&, uint64_t, uint64_t, bool, WTF::Function&&) { }, RemovePrevalentDomainsHandler&& removeDomainsHandler = [] (const Vector&) { }) + static Ref create(const String& resourceLoadStatisticsDirectory, Function&& testingCallback, UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler&& updatePrevalentDomainsToPartitionOrBlockCookiesHandler = [](const Vector&, const Vector&, const Vector&, ShouldClearFirst) { }, HasStorageAccessForPrevalentDomainsHandler&& hasStorageAccessForPrevalentDomainsHandler = [](const String&, const String&, uint64_t, uint64_t, WTF::Function&&) { }, UpdateStorageAccessForPrevalentDomainsHandler&& updateStorageAccessForPrevalentDomainsHandler = [](const String&, const String&, uint64_t, uint64_t, bool, WTF::Function&&) { }, RemovePrevalentDomainsHandler&& removeDomainsHandler = [] (const Vector&) { }) { - return adoptRef(*new WebResourceLoadStatisticsStore(resourceLoadStatisticsDirectory, WTFMove(testingCallback), WTFMove(updatePrevalentDomainsToPartitionOrBlockCookiesHandler), WTFMove(updateStorageAccessForPrevalentDomainsHandler), WTFMove(removeDomainsHandler))); + return adoptRef(*new WebResourceLoadStatisticsStore(resourceLoadStatisticsDirectory, WTFMove(testingCallback), WTFMove(updatePrevalentDomainsToPartitionOrBlockCookiesHandler), WTFMove(hasStorageAccessForPrevalentDomainsHandler), WTFMove(updateStorageAccessForPrevalentDomainsHandler), WTFMove(removeDomainsHandler))); } ~WebResourceLoadStatisticsStore(); @@ -82,7 +83,7 @@ public: void resourceLoadStatisticsUpdated(Vector&& origins); - void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, WTF::CompletionHandler&& callback); + void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler&& callback); void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler&& callback); void requestStorageAccessCallback(bool wasGranted, uint64_t contextId); @@ -142,7 +143,7 @@ public: void logTestingEvent(const String&); private: - WebResourceLoadStatisticsStore(const String&, Function&& testingCallback, UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler&&, UpdateStorageAccessForPrevalentDomainsHandler&&, RemovePrevalentDomainsHandler&&); + WebResourceLoadStatisticsStore(const String&, Function&& testingCallback, UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler&&, HasStorageAccessForPrevalentDomainsHandler&&, UpdateStorageAccessForPrevalentDomainsHandler&&, RemovePrevalentDomainsHandler&&); void removeDataRecords(); @@ -195,6 +196,7 @@ private: Vector m_operatingDates; UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler m_updatePrevalentDomainsToPartitionOrBlockCookiesHandler; + HasStorageAccessForPrevalentDomainsHandler m_hasStorageAccessForPrevalentDomainsHandler; UpdateStorageAccessForPrevalentDomainsHandler m_updateStorageAccessForPrevalentDomainsHandler; RemovePrevalentDomainsHandler m_removeDomainsHandler; diff --git a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp index fcbd222..7d3afe3 100644 --- a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp +++ b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp @@ -1166,6 +1166,12 @@ void WebsiteDataStore::updatePrevalentDomainsToPartitionOrBlockCookies(const Vec processPool->sendToNetworkingProcess(Messages::NetworkProcess::UpdatePrevalentDomainsToPartitionOrBlockCookies(m_sessionID, domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, shouldClearFirst == ShouldClearFirst::Yes)); } +void WebsiteDataStore::hasStorageAccessForPrevalentDomainsHandler(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler&& callback) +{ + for (auto& processPool : processPools()) + processPool->networkProcess()->hasStorageAccessForPrevalentDomains(m_sessionID, resourceDomain, firstPartyDomain, frameID, pageID, WTFMove(callback)); +} + void WebsiteDataStore::updateStorageAccessForPrevalentDomainsHandler(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, bool value, WTF::CompletionHandler&& callback) { for (auto& processPool : processPools()) @@ -1367,7 +1373,9 @@ void WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback(Functio #if HAVE(CFNETWORK_STORAGE_PARTITIONING) m_resourceLoadStatistics = WebResourceLoadStatisticsStore::create(m_configuration.resourceLoadStatisticsDirectory, WTFMove(callback), [this] (const Vector& domainsToPartition, const Vector& domainsToBlock, const Vector& domainsToNeitherPartitionNorBlock, ShouldClearFirst shouldClearFirst) { updatePrevalentDomainsToPartitionOrBlockCookies(domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, shouldClearFirst); - }, [this, protectedThis = makeRef(*this)] (const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, bool value, WTF::Function&& callback) { + }, [this, protectedThis = makeRef(*this)] (const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler&& callback) { + hasStorageAccessForPrevalentDomainsHandler(resourceDomain, firstPartyDomain, frameID, pageID, WTFMove(callback)); + }, [this, protectedThis = makeRef(*this)] (const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, bool value, WTF::CompletionHandler&& callback) { updateStorageAccessForPrevalentDomainsHandler(resourceDomain, firstPartyDomain, frameID, pageID, value, WTFMove(callback)); }, [this, protectedThis = makeRef(*this)] (const Vector& domainsToRemove) { removePrevalentDomains(domainsToRemove); @@ -1426,14 +1434,14 @@ void WebsiteDataStore::removePendingCookie(const WebCore::Cookie& cookie) m_pendingCookies.remove(cookie); } -void WebsiteDataStore::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, WTF::CompletionHandler&& callback) +void WebsiteDataStore::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler&& callback) { if (!resourceLoadStatisticsEnabled()) { callback(false); return; } - m_resourceLoadStatistics->hasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), WTFMove(callback)); + m_resourceLoadStatistics->hasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, WTFMove(callback)); } void WebsiteDataStore::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler&& callback) diff --git a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h index 1dca31d..7a1ddb9 100644 --- a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h +++ b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h @@ -118,6 +118,7 @@ public: #if HAVE(CFNETWORK_STORAGE_PARTITIONING) void updatePrevalentDomainsToPartitionOrBlockCookies(const Vector& domainsToPartition, const Vector& domainsToBlock, const Vector& domainsToNeitherPartitionNorBlock, ShouldClearFirst); + void hasStorageAccessForPrevalentDomainsHandler(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler&& callback); void updateStorageAccessForPrevalentDomainsHandler(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, bool value, WTF::CompletionHandler&& callback); void removePrevalentDomains(const Vector& domains); #endif @@ -146,7 +147,7 @@ public: void enableResourceLoadStatisticsAndSetTestingCallback(Function&& callback); - void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, WTF::CompletionHandler&& callback); + void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler&& callback); void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler&& callback); void setBoundInterfaceIdentifier(String&& identifier) { m_boundInterfaceIdentifier = WTFMove(identifier); } diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp index f1c757f..aaea800 100644 --- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp +++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp @@ -1256,9 +1256,9 @@ void WebChromeClient::didInvalidateDocumentMarkerRects() m_page.findController().didInvalidateDocumentMarkerRects(); } -void WebChromeClient::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, WTF::CompletionHandler&& callback) +void WebChromeClient::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler&& callback) { - m_page.hasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), WTFMove(callback)); + m_page.hasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, WTFMove(callback)); } void WebChromeClient::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler&& callback) diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h index 03ac213..2e63409 100644 --- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h +++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h @@ -349,7 +349,7 @@ private: void didInvalidateDocumentMarkerRects() final; - void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, WTF::CompletionHandler&&) final; + void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler&&) final; void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler&&) final; String m_cachedToolTip; diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp index fb9acda..b8b0f9a 100644 --- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp +++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp @@ -5803,13 +5803,13 @@ static uint64_t nextRequestStorageAccessContextId() return ++nextContextId; } -void WebPage::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, WTF::CompletionHandler&& callback) +void WebPage::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler&& callback) { auto contextId = nextRequestStorageAccessContextId(); auto addResult = m_storageAccessResponseCallbackMap.add(contextId, WTFMove(callback)); ASSERT(addResult.isNewEntry); if (addResult.iterator->value) - send(Messages::WebPageProxy::HasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), contextId)); + send(Messages::WebPageProxy::HasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, contextId)); else callback(false); } diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h index 88c8058..05759c2 100644 --- a/Source/WebKit/WebProcess/WebPage/WebPage.h +++ b/Source/WebKit/WebProcess/WebPage/WebPage.h @@ -1030,7 +1030,7 @@ public: void sendPartialEditorStateAndSchedulePostLayoutUpdate(); void flushPendingEditorStateUpdate(); - void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, WTF::CompletionHandler&& callback); + void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler&& callback); void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler&& callback); void storageAccessResponse(bool wasGranted, uint64_t contextId); -- 1.8.3.1