WebKit Bugzilla
Attachment 339696 Details for
Bug 185368
: Storage Access API: Add a request roundtrip to check whether prompting is needed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185368-20180506165110.patch (text/plain), 52.88 KB, created by
John Wilander
on 2018-05-06 16:51:11 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
John Wilander
Created:
2018-05-06 16:51:11 PDT
Size:
52.88 KB
patch
obsolete
>Index: Source/WebKit/ChangeLog >=================================================================== >--- Source/WebKit/ChangeLog (revision 231400) >+++ Source/WebKit/ChangeLog (working copy) >@@ -1,3 +1,77 @@ >+2018-05-06 John Wilander <wilander@apple.com> >+ >+ Storage Access API: Add a request roundtrip to check whether prompting is needed >+ https://bugs.webkit.org/show_bug.cgi?id=185368 >+ <rdar://problem/40011556> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This patch adds an enum WebKit::StorageAccessStatus to handle the three access >+ states we handle: >+ - WebKit::StorageAccessStatus::CannotRequestAccess. >+ This means the domain is blocked from cookies. >+ - WebKit::StorageAccessStatus::DoesNotHaveAccess. >+ This means that this particular access has not been granted yet. One such >+ condition is that a prompt is required. Another is to simply support the >+ document.hasStorageAccess() API. >+ - WebKit::StorageAccessStatus::HasAccess. >+ This means that this domain does not need to ask for access, this particular >+ access was already granted, or this particular access was granted now. >+ >+ Most of the changes are to support the above mentioned enum. But there's one >+ more important change. WebKit::WebChromeClient::requestStorageAccess() now >+ potentially requests storage access twice. If the first request comes back as >+ WebKit::StorageAccessStatus::DoesNotHaveAccess, it may prompt the user and then >+ request access again if the user says yes. >+ >+ * NetworkProcess/NetworkProcess.cpp: >+ (WebKit::NetworkProcess::hasStorageAccessForFrame): >+ (WebKit::NetworkProcess::grantStorageAccess): >+ * Shared/StorageAccessStatus.h: Added. >+ * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm: >+ (WebKit::WebResourceLoadStatisticsStore::registerUserDefaultsIfNeeded): >+ Now checks for the experimental feature flag for prompting. >+ * UIProcess/Network/NetworkProcessProxy.cpp: >+ (WebKit::NetworkProcessProxy::hasStorageAccessForFrame): >+ (WebKit::NetworkProcessProxy::grantStorageAccess): >+ (WebKit::NetworkProcessProxy::storageAccessRequestResult): >+ * UIProcess/Network/NetworkProcessProxy.h: >+ * UIProcess/Network/NetworkProcessProxy.messages.in: >+ * UIProcess/WebPageProxy.cpp: >+ (WebKit::WebPageProxy::hasStorageAccess): >+ (WebKit::WebPageProxy::requestStorageAccess): >+ * UIProcess/WebPageProxy.h: >+ * UIProcess/WebPageProxy.messages.in: >+ * UIProcess/WebResourceLoadStatisticsStore.cpp: >+ (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess): >+ (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess): >+ Now supports a boolean flag for whether the user has explicitly granted >+ access or not. If not, and the experimental prompt flag is on, storage >+ access is not granted, allowing for a second request after the prompt. >+ (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener): >+ * UIProcess/WebResourceLoadStatisticsStore.h: >+ * UIProcess/WebsiteData/WebsiteDataStore.cpp: >+ (WebKit::WebsiteDataStore::hasStorageAccessForFrameHandler): >+ (WebKit::WebsiteDataStore::grantStorageAccessHandler): >+ (WebKit::WebsiteDataStore::hasStorageAccess): >+ (WebKit::WebsiteDataStore::requestStorageAccess): >+ (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback): >+ * UIProcess/WebsiteData/WebsiteDataStore.h: >+ * WebKit.xcodeproj/project.pbxproj: >+ * WebProcess/WebCoreSupport/WebChromeClient.cpp: >+ (WebKit::WebChromeClient::hasStorageAccess): >+ (WebKit::WebChromeClient::requestStorageAccess): >+ Now potentially performs two requests for access. If the first >+ one comes back as WebKit::StorageAccessStatus::DoesNotHaveAccess, >+ it may prompt the user and then request access again if the user >+ says yes. >+ * WebProcess/WebPage/WebPage.cpp: >+ (WebKit::WebPage::hasStorageAccess): >+ (WebKit::WebPage::requestStorageAccess): >+ (WebKit::WebPage::storageAccessResponse): >+ * WebProcess/WebPage/WebPage.h: >+ * WebProcess/WebPage/WebPage.messages.in: >+ > 2018-05-04 Tim Horton <timothy_horton@apple.com> > > Shift to a lower-level framework for simplifying URLs >Index: Source/WebKit/NetworkProcess/NetworkProcess.cpp >=================================================================== >--- Source/WebKit/NetworkProcess/NetworkProcess.cpp (revision 231400) >+++ Source/WebKit/NetworkProcess/NetworkProcess.cpp (working copy) >@@ -49,6 +49,7 @@ > #include "RemoteNetworkingContext.h" > #include "SessionTracker.h" > #include "StatisticsData.h" >+#include "StorageAccessStatus.h" > #include "WebCookieManager.h" > #include "WebCoreArgumentCoders.h" > #include "WebPageProxyMessages.h" >@@ -407,9 +408,10 @@ void NetworkProcess::updatePrevalentDoma > > void NetworkProcess::hasStorageAccessForFrame(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->hasStorageAccess(resourceDomain, firstPartyDomain, frameID, pageID), contextId), 0); >- else >+ if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID)) { >+ auto status = networkStorageSession->hasStorageAccess(resourceDomain, firstPartyDomain, frameID, pageID) ? StorageAccessStatus::HasAccess : StorageAccessStatus::DoesNotHaveAccess; >+ parentProcessConnection()->send(Messages::NetworkProcessProxy::StorageAccessRequestResult(status, contextId), 0); >+ } else > ASSERT_NOT_REACHED(); > } > >@@ -423,15 +425,15 @@ void NetworkProcess::getAllStorageAccess > > void NetworkProcess::grantStorageAccess(PAL::SessionID sessionID, const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, uint64_t contextId) > { >- bool isStorageGranted = false; >+ auto status = StorageAccessStatus::CannotRequestAccess; > if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID)) { > networkStorageSession->grantStorageAccess(resourceDomain, firstPartyDomain, frameID, pageID); > ASSERT(networkStorageSession->hasStorageAccess(resourceDomain, firstPartyDomain, frameID, pageID)); >- isStorageGranted = true; >+ status = StorageAccessStatus::HasAccess; > } else > ASSERT_NOT_REACHED(); > >- parentProcessConnection()->send(Messages::NetworkProcessProxy::StorageAccessRequestResult(isStorageGranted, contextId), 0); >+ parentProcessConnection()->send(Messages::NetworkProcessProxy::StorageAccessRequestResult(status, contextId), 0); > } > > void NetworkProcess::removeAllStorageAccess(PAL::SessionID sessionID) >Index: Source/WebKit/Shared/StorageAccessStatus.h >=================================================================== >--- Source/WebKit/Shared/StorageAccessStatus.h (nonexistent) >+++ Source/WebKit/Shared/StorageAccessStatus.h (working copy) >@@ -0,0 +1,51 @@ >+/* >+ * Copyright (C) 2018 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 >+ >+#include <wtf/EnumTraits.h> >+ >+namespace WebKit { >+ >+enum class StorageAccessStatus { >+ CannotRequestAccess, >+ DoesNotHaveAccess, >+ HasAccess >+}; >+ >+} // namespace WebKit >+ >+namespace WTF { >+ >+template<> struct EnumTraits<WebKit::StorageAccessStatus> { >+ using values = EnumValues< >+ WebKit::StorageAccessStatus, >+ WebKit::StorageAccessStatus::CannotRequestAccess, >+ WebKit::StorageAccessStatus::DoesNotHaveAccess, >+ WebKit::StorageAccessStatus::HasAccess >+ >; >+}; >+ >+} // namespace WTF >Index: Source/WebKit/UIProcess/WebPageProxy.cpp >=================================================================== >--- Source/WebKit/UIProcess/WebPageProxy.cpp (revision 231400) >+++ Source/WebKit/UIProcess/WebPageProxy.cpp (working copy) >@@ -75,6 +75,7 @@ > #include "PluginInformation.h" > #include "PluginProcessManager.h" > #include "PrintInfo.h" >+#include "StorageAccessStatus.h" > #include "TextChecker.h" > #include "TextCheckerState.h" > #include "UIMessagePortChannelProvider.h" >@@ -7474,16 +7475,16 @@ void WebPageProxy::stopURLSchemeTask(uin > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) > void WebPageProxy::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, uint64_t webProcessContextId) > { >- m_websiteDataStore->hasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, [this, webProcessContextId] (bool hasAccess) { >- m_process->send(Messages::WebPage::StorageAccessResponse(hasAccess, webProcessContextId), m_pageID); >+ m_websiteDataStore->hasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, [this, webProcessContextId] (StorageAccessStatus status) { >+ m_process->send(Messages::WebPage::StorageAccessResponse(status, webProcessContextId), m_pageID); > }); > } > >-void WebPageProxy::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, uint64_t webProcessContextId) >+void WebPageProxy::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool userDidGrantStorageAccess, uint64_t webProcessContextId) > { > ASSERT(pageID == m_pageID); >- m_websiteDataStore->requestStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, [this, webProcessContextId] (bool wasGranted) { >- m_process->send(Messages::WebPage::StorageAccessResponse(wasGranted, webProcessContextId), m_pageID); >+ m_websiteDataStore->requestStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, userDidGrantStorageAccess, [this, webProcessContextId] (StorageAccessStatus status) { >+ m_process->send(Messages::WebPage::StorageAccessResponse(status, webProcessContextId), m_pageID); > }); > } > #endif >Index: Source/WebKit/UIProcess/WebPageProxy.h >=================================================================== >--- Source/WebKit/UIProcess/WebPageProxy.h (revision 231400) >+++ Source/WebKit/UIProcess/WebPageProxy.h (working copy) >@@ -1278,7 +1278,7 @@ public: > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) > 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); >+ void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool userDidGrantStorageAccess, uint64_t webProcessContextId); > #endif > > #if ENABLE(ATTACHMENT_ELEMENT) >Index: Source/WebKit/UIProcess/WebPageProxy.messages.in >=================================================================== >--- Source/WebKit/UIProcess/WebPageProxy.messages.in (revision 231400) >+++ Source/WebKit/UIProcess/WebPageProxy.messages.in (working copy) >@@ -511,7 +511,7 @@ messages -> WebPageProxy { > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) > 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) >+ RequestStorageAccess(String subFrameHost, String topFrameHost, uint64_t frameID, uint64_t pageID, bool userDidGrantStorageAccess, uint64_t contextID) > #endif > > #if ENABLE(ATTACHMENT_ELEMENT) >Index: Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp >=================================================================== >--- Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp (revision 231400) >+++ Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp (working copy) >@@ -29,6 +29,7 @@ > #include "Logging.h" > #include "PluginProcessManager.h" > #include "PluginProcessProxy.h" >+#include "StorageAccessStatus.h" > #include "WebProcessMessages.h" > #include "WebProcessProxy.h" > #include "WebResourceLoadStatisticsStoreMessages.h" >@@ -333,7 +334,7 @@ void WebResourceLoadStatisticsStore::res > processStatisticsAndDataRecords(); > } > >-void WebResourceLoadStatisticsStore::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback) >+void WebResourceLoadStatisticsStore::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(StorageAccessStatus)>&& callback) > { > ASSERT(subFrameHost != topFrameHost); > ASSERT(RunLoop::isMain()); >@@ -342,12 +343,12 @@ void WebResourceLoadStatisticsStore::has > > auto& subFrameStatistic = ensureResourceStatisticsForPrimaryDomain(subFramePrimaryDomain); > if (shouldBlockCookies(subFrameStatistic)) { >- callback(false); >+ callback(StorageAccessStatus::CannotRequestAccess); > return; > } > > if (!shouldPartitionCookies(subFrameStatistic)) { >- callback(true); >+ callback(StorageAccessStatus::HasAccess); > return; > } > >@@ -355,7 +356,7 @@ void WebResourceLoadStatisticsStore::has > }); > } > >-void WebResourceLoadStatisticsStore::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback) >+void WebResourceLoadStatisticsStore::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool userDidGrantStorageAccess, WTF::CompletionHandler<void(StorageAccessStatus)>&& callback) > { > ASSERT(subFrameHost != topFrameHost); > ASSERT(RunLoop::isMain()); >@@ -363,20 +364,25 @@ void WebResourceLoadStatisticsStore::req > auto subFramePrimaryDomain = isolatedPrimaryDomain(subFrameHost); > auto topFramePrimaryDomain = isolatedPrimaryDomain(topFrameHost); > if (subFramePrimaryDomain == topFramePrimaryDomain) { >- callback(true); >+ callback(StorageAccessStatus::HasAccess); > return; > } > >- m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), subFramePrimaryDomain = crossThreadCopy(subFramePrimaryDomain), topFramePrimaryDomain = crossThreadCopy(topFramePrimaryDomain), frameID, pageID, callback = WTFMove(callback)] () mutable { >+ m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), subFramePrimaryDomain = crossThreadCopy(subFramePrimaryDomain), topFramePrimaryDomain = crossThreadCopy(topFramePrimaryDomain), frameID, pageID, userDidGrantStorageAccess, callback = WTFMove(callback)] () mutable { > > auto& subFrameStatistic = ensureResourceStatisticsForPrimaryDomain(subFramePrimaryDomain); > if (shouldBlockCookies(subFrameStatistic)) { >- callback(false); >+ callback(StorageAccessStatus::CannotRequestAccess); > return; > } > > if (!shouldPartitionCookies(subFrameStatistic)) { >- callback(true); >+ callback(StorageAccessStatus::HasAccess); >+ return; >+ } >+ >+ if (m_storageAccessPromptsEnabled && !userDidGrantStorageAccess) { >+ callback(StorageAccessStatus::DoesNotHaveAccess); > return; > } > >@@ -405,7 +411,7 @@ void WebResourceLoadStatisticsStore::req > if (!cookiesBlocked && !shouldPartitionCookies(domainInNeedOfStorageAccessStatistic)) > return; > >- m_grantStorageAccessHandler(WTFMove(domainInNeedOfStorageAccess), WTFMove(openerDomain), std::nullopt, openerPageID, [](bool) { }); >+ m_grantStorageAccessHandler(WTFMove(domainInNeedOfStorageAccess), WTFMove(openerDomain), std::nullopt, openerPageID, [](StorageAccessStatus) { }); > #if !RELEASE_LOG_DISABLED > RELEASE_LOG_INFO_IF(m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "Grant storage access for %{public}s under opener %{public}s, %{public}s user interaction.", domainInNeedOfStorageAccess.utf8().data(), openerDomain.utf8().data(), (isTriggeredByUserGesture ? "with" : "without")); > #endif >Index: Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h >=================================================================== >--- Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h (revision 231400) >+++ Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h (working copy) >@@ -58,15 +58,16 @@ class OperatingDate; > class WebProcessProxy; > > enum class ShouldClearFirst; >+enum class StorageAccessStatus; > > class WebResourceLoadStatisticsStore final : public IPC::Connection::WorkQueueMessageReceiver { > public: > using UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler = WTF::Function<void(const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst)>; >- using HasStorageAccessForFrameHandler = WTF::Function<void(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::Function<void(bool hasAccess)>&& callback)>; >- using GrantStorageAccessHandler = WTF::Function<void(const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, WTF::Function<void(bool wasGranted)>&& callback)>; >+ using HasStorageAccessForFrameHandler = WTF::Function<void(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::Function<void(StorageAccessStatus)>&& callback)>; >+ using GrantStorageAccessHandler = WTF::Function<void(const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, WTF::Function<void(StorageAccessStatus)>&& callback)>; > using RemoveAllStorageAccessHandler = WTF::Function<void()>; > using RemovePrevalentDomainsHandler = WTF::Function<void (const Vector<String>&)>; >- static Ref<WebResourceLoadStatisticsStore> create(const String& resourceLoadStatisticsDirectory, Function<void (const String&)>&& testingCallback, bool isEphemeral, UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler&& updatePrevalentDomainsToPartitionOrBlockCookiesHandler = [](const WTF::Vector<String>&, const WTF::Vector<String>&, const WTF::Vector<String>&, ShouldClearFirst) { }, HasStorageAccessForFrameHandler&& hasStorageAccessForFrameHandler = [](const String&, const String&, uint64_t, uint64_t, WTF::Function<void(bool)>&&) { }, GrantStorageAccessHandler&& grantStorageAccessHandler = [](const String&, const String&, std::optional<uint64_t>, uint64_t, WTF::Function<void(bool)>&&) { }, RemoveAllStorageAccessHandler&& removeAllStorageAccessHandler = []() { }, RemovePrevalentDomainsHandler&& removeDomainsHandler = [] (const WTF::Vector<String>&) { }) >+ static Ref<WebResourceLoadStatisticsStore> create(const String& resourceLoadStatisticsDirectory, Function<void (const String&)>&& testingCallback, bool isEphemeral, UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler&& updatePrevalentDomainsToPartitionOrBlockCookiesHandler = [](const WTF::Vector<String>&, const WTF::Vector<String>&, const WTF::Vector<String>&, ShouldClearFirst) { }, HasStorageAccessForFrameHandler&& hasStorageAccessForFrameHandler = [](const String&, const String&, uint64_t, uint64_t, WTF::Function<void(StorageAccessStatus)>&&) { }, GrantStorageAccessHandler&& grantStorageAccessHandler = [](const String&, const String&, std::optional<uint64_t>, uint64_t, WTF::Function<void(StorageAccessStatus)>&&) { }, RemoveAllStorageAccessHandler&& removeAllStorageAccessHandler = []() { }, RemovePrevalentDomainsHandler&& removeDomainsHandler = [] (const WTF::Vector<String>&) { }) > { > return adoptRef(*new WebResourceLoadStatisticsStore(resourceLoadStatisticsDirectory, WTFMove(testingCallback), isEphemeral, WTFMove(updatePrevalentDomainsToPartitionOrBlockCookiesHandler), WTFMove(hasStorageAccessForFrameHandler), WTFMove(grantStorageAccessHandler), WTFMove(removeAllStorageAccessHandler), WTFMove(removeDomainsHandler))); > } >@@ -84,8 +85,8 @@ public: > > void resourceLoadStatisticsUpdated(Vector<WebCore::ResourceLoadStatistics>&& origins); > >- void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback); >- void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback); >+ void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(StorageAccessStatus)>&& callback); >+ void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool userDidGrantStorageAccess, WTF::CompletionHandler<void(StorageAccessStatus)>&& callback); > void requestStorageAccessUnderOpener(String&& domainInNeedOfStorageAccess, uint64_t openerPageID, String&& openerDomain, bool isTriggeredByUserGesture); > void requestStorageAccessCallback(bool wasGranted, uint64_t contextId); > >@@ -182,6 +183,7 @@ private: > void removeAllStorageAccess(); > > void setDebugLogggingEnabled(bool enabled) { m_debugLoggingEnabled = enabled; } >+ void setStorageAccessPromptsEnabled(bool enabled) { m_storageAccessPromptsEnabled = enabled; } > > #if PLATFORM(COCOA) > void registerUserDefaultsIfNeeded(); >@@ -230,6 +232,7 @@ private: > > bool m_debugModeEnabled { false }; > bool m_debugLoggingEnabled { false }; >+ bool m_storageAccessPromptsEnabled { false }; > > Function<void (const String&)> m_statisticsTestingCallback; > }; >Index: Source/WebKit/UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm >=================================================================== >--- Source/WebKit/UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm (revision 231400) >+++ Source/WebKit/UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm (working copy) >@@ -51,6 +51,7 @@ void WebResourceLoadStatisticsStore::reg > > setDebugLogggingEnabled([[NSUserDefaults standardUserDefaults] boolForKey:@"ResourceLoadStatisticsDebugLoggingEnabled"]); > setResourceLoadStatisticsDebugMode([[NSUserDefaults standardUserDefaults] boolForKey:@"ExperimentalResourceLoadStatisticsDebugMode"]); >+ setStorageAccessPromptsEnabled([[NSUserDefaults standardUserDefaults] boolForKey:@"ExperimentalStorageAccessPromptsEnabled"]); > }); > } > >Index: Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp >=================================================================== >--- Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp (revision 231400) >+++ Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp (working copy) >@@ -432,7 +432,7 @@ static uint64_t nextRequestStorageAccess > return ++nextContextId; > } > >-void NetworkProcessProxy::hasStorageAccessForFrame(PAL::SessionID sessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(bool)>&& callback) >+void NetworkProcessProxy::hasStorageAccessForFrame(PAL::SessionID sessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(StorageAccessStatus)>&& callback) > { > auto contextId = nextRequestStorageAccessContextId(); > auto addResult = m_storageAccessResponseCallbackMap.add(contextId, WTFMove(callback)); >@@ -440,7 +440,7 @@ void NetworkProcessProxy::hasStorageAcce > send(Messages::NetworkProcess::HasStorageAccessForFrame(sessionID, resourceDomain, firstPartyDomain, frameID, pageID, contextId), 0); > } > >-void NetworkProcessProxy::grantStorageAccess(PAL::SessionID sessionID, const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, WTF::CompletionHandler<void(bool)>&& callback) >+void NetworkProcessProxy::grantStorageAccess(PAL::SessionID sessionID, const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, WTF::CompletionHandler<void(StorageAccessStatus)>&& callback) > { > auto contextId = nextRequestStorageAccessContextId(); > auto addResult = m_storageAccessResponseCallbackMap.add(contextId, WTFMove(callback)); >@@ -454,10 +454,10 @@ void NetworkProcessProxy::removeAllStora > send(Messages::NetworkProcess::RemoveAllStorageAccess(sessionID), 0); > } > >-void NetworkProcessProxy::storageAccessRequestResult(bool wasGranted, uint64_t contextId) >+void NetworkProcessProxy::storageAccessRequestResult(StorageAccessStatus status, uint64_t contextId) > { > auto callback = m_storageAccessResponseCallbackMap.take(contextId); >- callback(wasGranted); >+ callback(status); > } > > void NetworkProcessProxy::getAllStorageAccessEntries(PAL::SessionID sessionID, CompletionHandler<void(Vector<String>&& domains)>&& callback) >Index: Source/WebKit/UIProcess/Network/NetworkProcessProxy.h >=================================================================== >--- Source/WebKit/UIProcess/Network/NetworkProcessProxy.h (revision 231400) >+++ Source/WebKit/UIProcess/Network/NetworkProcessProxy.h (working copy) >@@ -62,6 +62,7 @@ enum class WebsiteDataType; > struct NetworkProcessCreationParameters; > class WebUserContentControllerProxy; > struct WebsiteData; >+enum class StorageAccessStatus; > > class NetworkProcessProxy : public ChildProcessProxy, private ProcessThrottlerClient { > public: >@@ -81,9 +82,9 @@ public: > #endif > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >- void hasStorageAccessForFrame(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& callback); >+ void hasStorageAccessForFrame(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(StorageAccessStatus)>&& callback); > void getAllStorageAccessEntries(PAL::SessionID, CompletionHandler<void(Vector<String>&& domains)>&&); >- void grantStorageAccess(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&& callback); >+ void grantStorageAccess(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(StorageAccessStatus)>&& callback); > void removeAllStorageAccess(PAL::SessionID); > #endif > >@@ -141,7 +142,7 @@ private: > void canAuthenticateAgainstProtectionSpace(uint64_t loaderID, uint64_t pageID, uint64_t frameID, const WebCore::ProtectionSpace&); > #endif > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >- void storageAccessRequestResult(bool wasGranted, uint64_t contextId); >+ void storageAccessRequestResult(StorageAccessStatus, uint64_t contextId); > void allStorageAccessEntriesResult(Vector<String>&& domains, uint64_t contextId); > #endif > >@@ -169,7 +170,7 @@ private: > ProcessThrottler::BackgroundActivityToken m_tokenForHoldingLockedFiles; > > HashMap<uint64_t, CompletionHandler<void(bool success)>> m_writeBlobToFilePathCallbackMap; >- HashMap<uint64_t, WTF::CompletionHandler<void(bool wasGranted)>> m_storageAccessResponseCallbackMap; >+ HashMap<uint64_t, WTF::CompletionHandler<void(StorageAccessStatus)>> m_storageAccessResponseCallbackMap; > HashMap<uint64_t, CompletionHandler<void(Vector<String>&& domains)>> m_allStorageAccessEntriesCallbackMap; > > #if ENABLE(CONTENT_EXTENSIONS) >Index: Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in >=================================================================== >--- Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in (revision 231400) >+++ Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in (working copy) >@@ -45,9 +45,9 @@ messages -> NetworkProcessProxy LegacyRe > CanAuthenticateAgainstProtectionSpace(uint64_t loaderID, uint64_t pageID, uint64_t frameID, WebCore::ProtectionSpace protectionSpace) > #endif > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >- StorageAccessRequestResult(bool wasGranted, uint64_t contextId) >+ StorageAccessRequestResult(enum WebKit::StorageAccessStatus status, uint64_t contextId) > AllStorageAccessEntriesResult(Vector<String> domains, uint64_t contextId) >- >+#endif > #if ENABLE(CONTENT_EXTENSIONS) > ContentExtensionRules(WebKit::UserContentControllerIdentifier identifier) > #endif >Index: Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >=================================================================== >--- Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (revision 231400) >+++ Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (working copy) >@@ -30,6 +30,7 @@ > #include "APIWebsiteDataRecord.h" > #include "APIWebsiteDataStore.h" > #include "NetworkProcessMessages.h" >+#include "StorageAccessStatus.h" > #include "StorageManager.h" > #include "StorageProcessCreationParameters.h" > #include "WebCookieManagerProxy.h" >@@ -1198,7 +1199,7 @@ void WebsiteDataStore::updatePrevalentDo > processPool->sendToNetworkingProcess(Messages::NetworkProcess::UpdatePrevalentDomainsToPartitionOrBlockCookies(m_sessionID, domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, shouldClearFirst == ShouldClearFirst::Yes)); > } > >-void WebsiteDataStore::hasStorageAccessForFrameHandler(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(bool hasAccess)>&& callback) >+void WebsiteDataStore::hasStorageAccessForFrameHandler(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(StorageAccessStatus)>&& callback) > { > for (auto& processPool : processPools()) > processPool->networkProcess()->hasStorageAccessForFrame(m_sessionID, resourceDomain, firstPartyDomain, frameID, pageID, WTFMove(callback)); >@@ -1210,7 +1211,7 @@ void WebsiteDataStore::getAllStorageAcce > processPool->networkProcess()->getAllStorageAccessEntries(m_sessionID, WTFMove(callback)); > } > >-void WebsiteDataStore::grantStorageAccessHandler(const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, WTF::CompletionHandler<void(bool wasGranted)>&& callback) >+void WebsiteDataStore::grantStorageAccessHandler(const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, WTF::CompletionHandler<void(StorageAccessStatus)>&& callback) > { > for (auto& processPool : processPools()) > processPool->networkProcess()->grantStorageAccess(m_sessionID, resourceDomain, firstPartyDomain, frameID, pageID, WTFMove(callback)); >@@ -1230,24 +1231,24 @@ void WebsiteDataStore::removePrevalentDo > processPool->sendToNetworkingProcess(Messages::NetworkProcess::RemovePrevalentDomains(m_sessionID, domains)); > } > >-void WebsiteDataStore::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback) >+void WebsiteDataStore::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(StorageAccessStatus)>&& callback) > { > if (!resourceLoadStatisticsEnabled()) { >- callback(false); >+ callback(StorageAccessStatus::CannotRequestAccess); > return; > } > > 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<void (bool)>&& callback) >+void WebsiteDataStore::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool userDidGrantStorageAccess, WTF::CompletionHandler<void(StorageAccessStatus)>&& callback) > { > if (!resourceLoadStatisticsEnabled()) { >- callback(false); >+ callback(StorageAccessStatus::CannotRequestAccess); > return; > } > >- m_resourceLoadStatistics->requestStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, WTFMove(callback)); >+ m_resourceLoadStatistics->requestStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, userDidGrantStorageAccess, WTFMove(callback)); > } > #endif > >@@ -1451,9 +1452,9 @@ void WebsiteDataStore::enableResourceLoa > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) > m_resourceLoadStatistics = WebResourceLoadStatisticsStore::create(m_configuration.resourceLoadStatisticsDirectory, WTFMove(callback), m_sessionID.isEphemeral(), [this, protectedThis = makeRef(*this)] (const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst shouldClearFirst) { > updatePrevalentDomainsToPartitionOrBlockCookies(domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, shouldClearFirst); >- }, [this, protectedThis = makeRef(*this)] (const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(bool hasAccess)>&& callback) { >+ }, [this, protectedThis = makeRef(*this)] (const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(StorageAccessStatus)>&& callback) { > hasStorageAccessForFrameHandler(resourceDomain, firstPartyDomain, frameID, pageID, WTFMove(callback)); >- }, [this, protectedThis = makeRef(*this)] (const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, WTF::CompletionHandler<void(bool wasGranted)>&& callback) { >+ }, [this, protectedThis = makeRef(*this)] (const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, WTF::CompletionHandler<void(StorageAccessStatus)>&& callback) { > grantStorageAccessHandler(resourceDomain, firstPartyDomain, frameID, pageID, WTFMove(callback)); > }, [this, protectedThis = makeRef(*this)] () { > removeAllStorageAccessHandler(); >Index: Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h >=================================================================== >--- Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h (revision 231400) >+++ Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h (working copy) >@@ -59,6 +59,7 @@ enum class WebsiteDataType; > struct StorageProcessCreationParameters; > struct WebsiteDataRecord; > struct WebsiteDataStoreParameters; >+enum class StorageAccessStatus; > > #if ENABLE(NETSCAPE_PLUGIN_API) > struct PluginModuleInfo; >@@ -124,13 +125,13 @@ public: > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) > void updatePrevalentDomainsToPartitionOrBlockCookies(const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst); >- void hasStorageAccessForFrameHandler(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(bool hasAccess)>&& callback); >+ void hasStorageAccessForFrameHandler(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(StorageAccessStatus)>&&); > void getAllStorageAccessEntries(CompletionHandler<void(Vector<String>&& domains)>&&); >- void grantStorageAccessHandler(const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, WTF::CompletionHandler<void(bool wasGranted)>&& callback); >+ void grantStorageAccessHandler(const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, WTF::CompletionHandler<void(StorageAccessStatus)>&&); > void removeAllStorageAccessHandler(); > void removePrevalentDomains(const Vector<String>& domains); >- void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback); >- void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback); >+ void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(StorageAccessStatus)>&&); >+ void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool userDidGrantStorageAccess, WTF::CompletionHandler<void(StorageAccessStatus)>&&); > #endif > void networkProcessDidCrash(); > void resolveDirectoriesIfNecessary(); >Index: Source/WebKit/WebKit.xcodeproj/project.pbxproj >=================================================================== >--- Source/WebKit/WebKit.xcodeproj/project.pbxproj (revision 231400) >+++ Source/WebKit/WebKit.xcodeproj/project.pbxproj (working copy) >@@ -1288,6 +1288,7 @@ > 6A5080BF1F0EDAAA00E617C5 /* WKWindowFeaturesPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 6A5080BE1F0EDAAA00E617C5 /* WKWindowFeaturesPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 6B821DDC1EEF05DD00D7AF4A /* WebResourceLoadStatisticsTelemetry.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B821DDA1EEF05DD00D7AF4A /* WebResourceLoadStatisticsTelemetry.h */; }; > 6B821DDD1EEF05DD00D7AF4A /* WebResourceLoadStatisticsTelemetry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B821DDB1EEF05DD00D7AF4A /* WebResourceLoadStatisticsTelemetry.cpp */; }; >+ 6BC70B4A209D14EA00D33729 /* StorageAccessStatus.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BC70B49209D14EA00D33729 /* StorageAccessStatus.h */; }; > 6BE969C11E54D452008B7483 /* corePrediction_model in Resources */ = {isa = PBXBuildFile; fileRef = 6BE969C01E54D452008B7483 /* corePrediction_model */; }; > 6BE969C71E54D4B6008B7483 /* ResourceLoadStatisticsClassifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BE969C61E54D4B6008B7483 /* ResourceLoadStatisticsClassifier.cpp */; }; > 6BE969CA1E54D4CF008B7483 /* ResourceLoadStatisticsClassifierCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BE969C81E54D4CF008B7483 /* ResourceLoadStatisticsClassifierCocoa.cpp */; }; >@@ -2071,7 +2072,6 @@ > CDA29A2B1CBEB67A00901CCF /* PlaybackSessionManagerProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = CDA29A271CBEB67A00901CCF /* PlaybackSessionManagerProxyMessages.h */; }; > CDC2831D201BD79D00E6E745 /* WKFullscreenStackView.h in Headers */ = {isa = PBXBuildFile; fileRef = CDC2831B201BD79D00E6E745 /* WKFullscreenStackView.h */; }; > CDC2831E201BD79D00E6E745 /* WKFullscreenStackView.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDC2831C201BD79D00E6E745 /* WKFullscreenStackView.mm */; }; >- CDC382FE17211799008A2FC3 /* SecItemShimLibrary.mm in Sources */ = {isa = PBXBuildFile; fileRef = 511F8A78138B460900A95F44 /* SecItemShimLibrary.mm */; }; > CDCA85C8132ABA4E00E961DF /* WKFullScreenWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDCA85C6132ABA4E00E961DF /* WKFullScreenWindowController.mm */; }; > CDCA85C9132ABA4E00E961DF /* WKFullScreenWindowController.h in Headers */ = {isa = PBXBuildFile; fileRef = CDCA85C7132ABA4E00E961DF /* WKFullScreenWindowController.h */; }; > CE11AD501CBC47F800681EE5 /* CodeSigning.mm in Sources */ = {isa = PBXBuildFile; fileRef = CE11AD4F1CBC47F800681EE5 /* CodeSigning.mm */; }; >@@ -3750,6 +3750,7 @@ > 6A5080BE1F0EDAAA00E617C5 /* WKWindowFeaturesPrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WKWindowFeaturesPrivate.h; sourceTree = "<group>"; }; > 6B821DDA1EEF05DD00D7AF4A /* WebResourceLoadStatisticsTelemetry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebResourceLoadStatisticsTelemetry.h; sourceTree = "<group>"; }; > 6B821DDB1EEF05DD00D7AF4A /* WebResourceLoadStatisticsTelemetry.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebResourceLoadStatisticsTelemetry.cpp; sourceTree = "<group>"; }; >+ 6BC70B49209D14EA00D33729 /* StorageAccessStatus.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StorageAccessStatus.h; sourceTree = "<group>"; }; > 6BE969C01E54D452008B7483 /* corePrediction_model */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = corePrediction_model; sourceTree = "<group>"; }; > 6BE969C61E54D4B6008B7483 /* ResourceLoadStatisticsClassifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceLoadStatisticsClassifier.cpp; sourceTree = "<group>"; }; > 6BE969C81E54D4CF008B7483 /* ResourceLoadStatisticsClassifierCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceLoadStatisticsClassifierCocoa.cpp; sourceTree = "<group>"; }; >@@ -4603,7 +4604,6 @@ > CDC2831B201BD79D00E6E745 /* WKFullscreenStackView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WKFullscreenStackView.h; path = ios/fullscreen/WKFullscreenStackView.h; sourceTree = "<group>"; }; > CDC2831C201BD79D00E6E745 /* WKFullscreenStackView.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = WKFullscreenStackView.mm; path = ios/fullscreen/WKFullscreenStackView.mm; sourceTree = "<group>"; }; > CDC382F717211506008A2FC3 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = /System/Library/Frameworks/CFNetwork.framework; sourceTree = "<absolute>"; }; >- CDC3830617211799008A2FC3 /* WebProcessShim.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = WebProcessShim.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; > CDC8F4881725E67800166F6E /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; }; > CDCA85C6132ABA4E00E961DF /* WKFullScreenWindowController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKFullScreenWindowController.mm; sourceTree = "<group>"; }; > CDCA85C7132ABA4E00E961DF /* WKFullScreenWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFullScreenWindowController.h; sourceTree = "<group>"; }; >@@ -5279,6 +5279,7 @@ > 83F9644C1FA0F76300C47750 /* SharedStringHashTableReadOnly.h */, > 5272B2881406985D0096A5D0 /* StatisticsData.cpp */, > 5272B2891406985D0096A5D0 /* StatisticsData.h */, >+ 6BC70B49209D14EA00D33729 /* StorageAccessStatus.h */, > 1A5E4DA312D3BD3D0099A2BB /* TextCheckerState.h */, > 2FD43B921FA006A30083F51C /* TouchBarMenuData.cpp */, > 2FD43B911FA006A10083F51C /* TouchBarMenuData.h */, >@@ -9174,6 +9175,7 @@ > 2DE6943E18BD2A68005C15E5 /* SmartMagnificationControllerMessages.h in Headers */, > 5272B28B1406985D0096A5D0 /* StatisticsData.h in Headers */, > 514BDED316C98EDD00E4E25E /* StatisticsRequest.h in Headers */, >+ 6BC70B4A209D14EA00D33729 /* StorageAccessStatus.h in Headers */, > 1AD3306F16B1D991004F60E7 /* StorageAreaImpl.h in Headers */, > 1ACECD2517162DB1001FC9EF /* StorageAreaMap.h in Headers */, > 1A334DEE16DE8F88006A8E38 /* StorageAreaMapMessages.h in Headers */, >@@ -11446,14 +11448,6 @@ > ); > runOnlyForDeploymentPostprocessing = 0; > }; >- CDC382FD17211799008A2FC3 /* Sources */ = { >- isa = PBXSourcesBuildPhase; >- buildActionMask = 2147483647; >- files = ( >- CDC382FE17211799008A2FC3 /* SecItemShimLibrary.mm in Sources */, >- ); >- runOnlyForDeploymentPostprocessing = 0; >- }; > /* End PBXSourcesBuildPhase section */ > > /* Begin PBXTargetDependency section */ >Index: Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >=================================================================== >--- Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (revision 231400) >+++ Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (working copy) >@@ -37,6 +37,7 @@ > #include "InjectedBundleNodeHandle.h" > #include "NavigationActionData.h" > #include "PageBanner.h" >+#include "StorageAccessStatus.h" > #include "UserData.h" > #include "WebColorChooser.h" > #include "WebCoreArgumentCoders.h" >@@ -1286,12 +1287,48 @@ void WebChromeClient::didInvalidateDocum > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) > void WebChromeClient::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback) > { >- m_page.hasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, WTFMove(callback)); >+ m_page.hasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, [callback = WTFMove(callback)] (StorageAccessStatus status) { >+ switch (status) { >+ case StorageAccessStatus::CannotRequestAccess: >+ case StorageAccessStatus::DoesNotHaveAccess: >+ callback(false); >+ return; >+ case StorageAccessStatus::HasAccess: >+ callback(true); >+ } >+ }); > } > > void WebChromeClient::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback) > { >- m_page.requestStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, WTFMove(callback)); >+ m_page.requestStorageAccess(subFrameHost.isolatedCopy(), topFrameHost.isolatedCopy(), frameID, pageID, false, [this, subFrameHost = WTFMove(subFrameHost), topFrameHost = WTFMove(topFrameHost), frameID, pageID, callback = WTFMove(callback)] (StorageAccessStatus status) mutable { >+ >+ switch (status) { >+ case StorageAccessStatus::CannotRequestAccess: >+ callback(false); >+ return; >+ case StorageAccessStatus::DoesNotHaveAccess: >+ // FIXME: Prompt code goes here and the second call to m_page.requestStorageAccess() >+ // is only made if the user grants access. >+ m_page.requestStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, true, [callback = WTFMove(callback)] (StorageAccessStatus status) { >+ >+ switch (status) { >+ case StorageAccessStatus::CannotRequestAccess: >+ callback(false); >+ return; >+ case StorageAccessStatus::DoesNotHaveAccess: >+ ASSERT_NOT_REACHED(); >+ callback(false); >+ return; >+ case StorageAccessStatus::HasAccess: >+ callback(true); >+ } >+ }); >+ return; >+ case StorageAccessStatus::HasAccess: >+ callback(true); >+ } >+ }); > } > #endif > >Index: Source/WebKit/WebProcess/WebPage/WebPage.cpp >=================================================================== >--- Source/WebKit/WebProcess/WebPage/WebPage.cpp (revision 231400) >+++ Source/WebKit/WebProcess/WebPage/WebPage.cpp (working copy) >@@ -60,6 +60,7 @@ > #include "SessionStateConversion.h" > #include "SessionTracker.h" > #include "ShareableBitmap.h" >+#include "StorageAccessStatus.h" > #include "UserMediaPermissionRequestManager.h" > #include "ViewGestureGeometryCollector.h" > #include "VisitedLinkTableController.h" >@@ -5907,7 +5908,7 @@ static uint64_t nextRequestStorageAccess > return ++nextContextId; > } > >-void WebPage::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback) >+void WebPage::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(StorageAccessStatus)>&& callback) > { > auto contextId = nextRequestStorageAccessContextId(); > auto addResult = m_storageAccessResponseCallbackMap.add(contextId, WTFMove(callback)); >@@ -5915,25 +5916,25 @@ void WebPage::hasStorageAccess(String&& > if (addResult.iterator->value) > send(Messages::WebPageProxy::HasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, contextId)); > else >- callback(false); >+ callback(StorageAccessStatus::CannotRequestAccess); > } >- >-void WebPage::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback) >+ >+void WebPage::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool userDidGrantStorageAccess, WTF::CompletionHandler<void(StorageAccessStatus)>&& callback) > { > auto contextId = nextRequestStorageAccessContextId(); > auto addResult = m_storageAccessResponseCallbackMap.add(contextId, WTFMove(callback)); > ASSERT(addResult.isNewEntry); > if (addResult.iterator->value) >- send(Messages::WebPageProxy::RequestStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, contextId)); >+ send(Messages::WebPageProxy::RequestStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, userDidGrantStorageAccess, contextId)); > else >- callback(false); >+ callback(StorageAccessStatus::CannotRequestAccess); > } > >-void WebPage::storageAccessResponse(bool wasGranted, uint64_t contextId) >+void WebPage::storageAccessResponse(StorageAccessStatus status, uint64_t contextId) > { > auto callback = m_storageAccessResponseCallbackMap.take(contextId); > ASSERT(callback); >- callback(wasGranted); >+ callback(status); > } > #endif > >Index: Source/WebKit/WebProcess/WebPage/WebPage.h >=================================================================== >--- Source/WebKit/WebProcess/WebPage/WebPage.h (revision 231400) >+++ Source/WebKit/WebProcess/WebPage/WebPage.h (working copy) >@@ -224,6 +224,7 @@ class RemoteLayerTreeTransaction; > > enum FindOptions : uint16_t; > enum class DragControllerAction; >+enum class StorageAccessStatus; > > struct AssistedNodeInformation; > struct AttributedString; >@@ -1052,9 +1053,9 @@ public: > void flushPendingEditorStateUpdate(); > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >- void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback); >- void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback); >- void storageAccessResponse(bool wasGranted, uint64_t contextId); >+ void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(StorageAccessStatus)>&& callback); >+ void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool userDidGrantStorageAccess, WTF::CompletionHandler<void(StorageAccessStatus)>&& callback); >+ void storageAccessResponse(StorageAccessStatus, uint64_t contextId); > #endif > > #if ENABLE(ATTACHMENT_ELEMENT) >@@ -1707,7 +1708,7 @@ private: > HashMap<String, RefPtr<WebURLSchemeHandlerProxy>> m_schemeToURLSchemeHandlerProxyMap; > HashMap<uint64_t, WebURLSchemeHandlerProxy*> m_identifierToURLSchemeHandlerProxyMap; > >- HashMap<uint64_t, WTF::Function<void (bool granted)>> m_storageAccessResponseCallbackMap; >+ HashMap<uint64_t, WTF::CompletionHandler<void(StorageAccessStatus)>> m_storageAccessResponseCallbackMap; > > #if ENABLE(APPLICATION_MANIFEST) > HashMap<uint64_t, uint64_t> m_applicationManifestFetchCallbackMap; >Index: Source/WebKit/WebProcess/WebPage/WebPage.messages.in >=================================================================== >--- Source/WebKit/WebProcess/WebPage/WebPage.messages.in (revision 231400) >+++ Source/WebKit/WebProcess/WebPage/WebPage.messages.in (working copy) >@@ -500,7 +500,7 @@ messages -> WebPage LegacyReceiver { > SetIsSuspended(bool suspended) > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >- StorageAccessResponse(bool wasGranted, uint64_t contextId) >+ StorageAccessResponse(enum WebKit::StorageAccessStatus status, uint64_t contextId) > #endif > > #if ENABLE(ATTACHMENT_ELEMENT)
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 185368
:
339696
|
339786
|
339790
|
339792
|
339800
|
339836
|
339840