Diff
Modified: trunk/Source/WebCore/ChangeLog (226481 => 226482)
--- trunk/Source/WebCore/ChangeLog 2018-01-06 01:56:23 UTC (rev 226481)
+++ trunk/Source/WebCore/ChangeLog 2018-01-06 02:16:51 UTC (rev 226482)
@@ -1,3 +1,44 @@
+2018-01-05 John Wilander <[email protected]>
+
+ Storage Access API: Refactor to make naming accurate and explicit, simplify access table, and prepare for access removal for page
+ https://bugs.webkit.org/show_bug.cgi?id=181357
+ <rdar://problem/36331031>
+
+ Reviewed by Alex Christensen.
+
+ No new tests. The only changed functionality that isn't covered
+ by existing tests is cross-origin iframes in the same partition
+ should be handled as already having access. This cannot be
+ tested in layout tests since they don't support subdomains.
+
+ This change does the following:
+ - Changes function and message names to reflect how this feature
+ was eventually implemented, i.e. access per frame.
+ - Makes it explicit that the UI process is only involved in
+ granting storage access and not removing storage access.
+ The latter is done directly by the web process.
+ - Simplifies the network process' entry map since only needs to
+ be able to give access to one domain in one frame at a time.
+ Access goes away on frame navigation so there can only be one
+ domain at a time per frame. Also, the map now uses pageIDs as
+ main keys to prepare for efficient access removal for all
+ frames under a page.
+ - Fixes a bug in so that a cross-origin iframe with the same
+ partition as the top frame correctly is handled as already
+ having access.
+
+ * platform/network/NetworkStorageSession.h:
+ * platform/network/cf/NetworkStorageSessionCFNet.cpp:
+ (WebCore::NetworkStorageSession::cookieStoragePartition const):
+ The only change here is the changed named of the call to
+ NetworkStorageSession::hasStorageAccessForFrame().
+ (WebCore::NetworkStorageSession::hasStorageAccessForFrame const):
+ (WebCore::NetworkStorageSession::grantStorageAccessForFrame):
+ (WebCore::NetworkStorageSession::removeStorageAccessForFrame):
+ (WebCore::NetworkStorageSession::isStorageAccessGranted const): Deleted.
+ (WebCore::NetworkStorageSession::setStorageAccessGranted): Deleted.
+ (WebCore::NetworkStorageSession::removeStorageAccess): Deleted.
+
2018-01-05 Youenn Fablet <[email protected]>
Implement Cache API partitioning based on ClientOrigin
Modified: trunk/Source/WebCore/platform/network/NetworkStorageSession.h (226481 => 226482)
--- trunk/Source/WebCore/platform/network/NetworkStorageSession.h 2018-01-06 01:56:23 UTC (rev 226481)
+++ trunk/Source/WebCore/platform/network/NetworkStorageSession.h 2018-01-06 02:16:51 UTC (rev 226482)
@@ -98,9 +98,9 @@
String cookieStoragePartition(const URL& firstPartyForCookies, const URL& resource, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID) const;
WEBCORE_EXPORT void setPrevalentDomainsToPartitionOrBlockCookies(const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, bool clearFirst);
WEBCORE_EXPORT void removePrevalentDomains(const Vector<String>& domains);
- WEBCORE_EXPORT bool isStorageAccessGranted(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID) const;
- WEBCORE_EXPORT void setStorageAccessGranted(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, bool value);
- WEBCORE_EXPORT void removeStorageAccess(uint64_t frameID, uint64_t pageID);
+ WEBCORE_EXPORT bool hasStorageAccessForFrame(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID) const;
+ WEBCORE_EXPORT void grantStorageAccessForFrame(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID);
+ WEBCORE_EXPORT void removeStorageAccessForFrame(uint64_t frameID, uint64_t pageID);
#endif
#elif USE(SOUP)
NetworkStorageSession(PAL::SessionID, std::unique_ptr<SoupNetworkSession>&&);
@@ -159,7 +159,7 @@
bool shouldBlockThirdPartyCookies(const String& topPrivatelyControlledDomain) const;
HashSet<String> m_topPrivatelyControlledDomainsToPartition;
HashSet<String> m_topPrivatelyControlledDomainsToBlock;
- HashMap<uint64_t, HashMap<uint64_t, HashSet<String>, DefaultHash<uint64_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>>, DefaultHash<uint64_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>> m_framesGrantedStorageAccess;
+ HashMap<uint64_t, HashMap<uint64_t, String, DefaultHash<uint64_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>>, DefaultHash<uint64_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>> m_framesGrantedStorageAccess;
#endif
#if PLATFORM(COCOA)
Modified: trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp (226481 => 226482)
--- trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp 2018-01-06 01:56:23 UTC (rev 226481)
+++ trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp 2018-01-06 02:16:51 UTC (rev 226482)
@@ -196,7 +196,7 @@
if (firstPartyDomain == resourceDomain)
return emptyString();
- if (frameID && pageID && isStorageAccessGranted(resourceDomain, firstPartyDomain, frameID.value(), pageID.value()))
+ if (frameID && pageID && hasStorageAccessForFrame(resourceDomain, firstPartyDomain, frameID.value(), pageID.value()))
return emptyString();
return firstPartyDomain;
@@ -283,65 +283,45 @@
}
}
-bool NetworkStorageSession::isStorageAccessGranted(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID) const
+bool NetworkStorageSession::hasStorageAccessForFrame(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID) const
{
UNUSED_PARAM(firstPartyDomain);
- auto it1 = m_framesGrantedStorageAccess.find(frameID);
+ auto it1 = m_framesGrantedStorageAccess.find(pageID);
if (it1 == m_framesGrantedStorageAccess.end())
return false;
- auto it2 = it1->value.find(pageID);
+ auto it2 = it1->value.find(frameID);
if (it2 == it1->value.end())
return false;
- return it2->value.contains(resourceDomain);
+ return it2->value == resourceDomain;
}
-void NetworkStorageSession::setStorageAccessGranted(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, bool value)
+void NetworkStorageSession::grantStorageAccessForFrame(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID)
{
UNUSED_PARAM(firstPartyDomain);
- auto it1 = m_framesGrantedStorageAccess.find(frameID);
- if (value) {
- if (it1 == m_framesGrantedStorageAccess.end()) {
- HashMap<uint64_t, HashSet<String>, DefaultHash<uint64_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>> entry;
- entry.add(pageID, HashSet<String>({ resourceDomain }));
- m_framesGrantedStorageAccess.add(frameID, entry);
- } else {
- auto it2 = it1->value.find(pageID);
- if (it2 == it1->value.end())
- it1->value.add(pageID, HashSet<String>({ resourceDomain }));
- else
- it2->value.add(resourceDomain);
- }
+ auto it1 = m_framesGrantedStorageAccess.find(pageID);
+ if (it1 == m_framesGrantedStorageAccess.end()) {
+ HashMap<uint64_t, String, DefaultHash<uint64_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>> entry;
+ entry.add(frameID, resourceDomain);
+ m_framesGrantedStorageAccess.add(pageID, entry);
} else {
- if (it1 == m_framesGrantedStorageAccess.end())
- return;
-
- auto it2 = it1->value.find(pageID);
- if (it2 == it1->value.end())
- return;
-
- it2->value.remove(resourceDomain);
-
- if (it2->value.isEmpty())
- it1->value.remove(pageID);
-
- if (it1->value.isEmpty())
- m_framesGrantedStorageAccess.remove(frameID);
+ auto it2 = it1->value.find(frameID);
+ it2->value = resourceDomain;
}
}
-void NetworkStorageSession::removeStorageAccess(uint64_t frameID, uint64_t pageID)
+void NetworkStorageSession::removeStorageAccessForFrame(uint64_t frameID, uint64_t pageID)
{
- auto iteration = m_framesGrantedStorageAccess.find(frameID);
+ auto iteration = m_framesGrantedStorageAccess.find(pageID);
if (iteration == m_framesGrantedStorageAccess.end())
return;
-
- iteration->value.remove(pageID);
+
+ iteration->value.remove(frameID);
}
-
+
#endif // HAVE(CFNETWORK_STORAGE_PARTITIONING)
#if !PLATFORM(COCOA)
Modified: trunk/Source/WebKit/ChangeLog (226481 => 226482)
--- trunk/Source/WebKit/ChangeLog 2018-01-06 01:56:23 UTC (rev 226481)
+++ trunk/Source/WebKit/ChangeLog 2018-01-06 02:16:51 UTC (rev 226482)
@@ -1,3 +1,61 @@
+2018-01-05 John Wilander <[email protected]>
+
+ Storage Access API: Refactor to make naming accurate and explicit, simplify access table, and prepare for access removal for page
+ https://bugs.webkit.org/show_bug.cgi?id=181357
+ <rdar://problem/36331031>
+
+ Reviewed by Alex Christensen.
+
+ This change does the following:
+ - Changes function and message names to reflect how this feature
+ was eventually implemented, i.e. access per frame.
+ - Makes it explicit that the UI process is only involved in
+ granting storage access and not removing storage access.
+ The latter is done directly by the web process.
+ - Simplifies the network process' entry map since only needs to
+ be able to give access to one domain in one frame at a time.
+ Access goes away on frame navigation so there can only be one
+ domain at a time per frame. Also, the map now uses pageIDs as
+ main keys to prepare for efficient access removal for all
+ frames under a page.
+ - Fixes a bug in so that a cross-origin iframe with the same
+ partition as the top frame correctly is handled as already
+ having access.
+
+ * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+ (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForFrame):
+ (WebKit::NetworkConnectionToWebProcess::removeStorageAccess): Deleted.
+ * NetworkProcess/NetworkConnectionToWebProcess.h:
+ * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
+ * NetworkProcess/NetworkProcess.cpp:
+ (WebKit::NetworkProcess::hasStorageAccessForFrame):
+ (WebKit::NetworkProcess::grantStorageAccessForFrame):
+ (WebKit::NetworkProcess::hasStorageAccessForPrevalentDomains): Deleted.
+ (WebKit::NetworkProcess::updateStorageAccessForPrevalentDomains): Deleted.
+ * NetworkProcess/NetworkProcess.h:
+ * NetworkProcess/NetworkProcess.messages.in:
+ * UIProcess/Network/NetworkProcessProxy.cpp:
+ (WebKit::NetworkProcessProxy::hasStorageAccessForFrame):
+ (WebKit::NetworkProcessProxy::grantStorageAccessForFrame):
+ (WebKit::NetworkProcessProxy::hasStorageAccessForPrevalentDomains): Deleted.
+ (WebKit::NetworkProcessProxy::updateStorageAccessForPrevalentDomains): Deleted.
+ * UIProcess/Network/NetworkProcessProxy.h:
+ * UIProcess/WebResourceLoadStatisticsStore.cpp:
+ (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
+ (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
+ (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
+ * UIProcess/WebResourceLoadStatisticsStore.h:
+ * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+ (WebKit::WebsiteDataStore::hasStorageAccessForFrameHandler):
+ (WebKit::WebsiteDataStore::grantStorageAccessForFrameHandler):
+ (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
+ (WebKit::WebsiteDataStore::hasStorageAccessForPrevalentDomainsHandler): Deleted.
+ (WebKit::WebsiteDataStore::updateStorageAccessForPrevalentDomainsHandler): Deleted.
+ * UIProcess/WebsiteData/WebsiteDataStore.h:
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::detachedFromParent2):
+ (WebKit::WebFrameLoaderClient::dispatchWillChangeDocument):
+
2018-01-05 Youenn Fablet <[email protected]>
Implement Cache API partitioning based on ClientOrigin
Modified: trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp (226481 => 226482)
--- trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp 2018-01-06 01:56:23 UTC (rev 226481)
+++ trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp 2018-01-06 02:16:51 UTC (rev 226482)
@@ -471,10 +471,10 @@
NetworkProcess::singleton().addWebsiteDataStore(WebsiteDataStoreParameters::legacyPrivateSessionParameters());
}
-void NetworkConnectionToWebProcess::removeStorageAccess(PAL::SessionID sessionID, uint64_t frameID, uint64_t pageID)
+void NetworkConnectionToWebProcess::removeStorageAccessForFrame(PAL::SessionID sessionID, uint64_t frameID, uint64_t pageID)
{
#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
- storageSession(sessionID).removeStorageAccess(frameID, pageID);
+ storageSession(sessionID).removeStorageAccessForFrame(frameID, pageID);
#else
UNUSED_PARAM(sessionID);
UNUSED_PARAM(frameID);
Modified: trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h (226481 => 226482)
--- trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h 2018-01-06 01:56:23 UTC (rev 226481)
+++ trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h 2018-01-06 02:16:51 UTC (rev 226482)
@@ -133,7 +133,7 @@
CacheStorageEngineConnection& cacheStorageConnection();
- void removeStorageAccess(PAL::SessionID, uint64_t frameID, uint64_t pageID);
+ void removeStorageAccessForFrame(PAL::SessionID, uint64_t frameID, uint64_t pageID);
Ref<IPC::Connection> m_connection;
Modified: trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in (226481 => 226482)
--- trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in 2018-01-06 01:56:23 UTC (rev 226481)
+++ trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in 2018-01-06 02:16:51 UTC (rev 226482)
@@ -58,5 +58,5 @@
EnsureLegacyPrivateBrowsingSession()
- RemoveStorageAccess(PAL::SessionID sessionID, uint64_t frameID, uint64_t pageID);
+ RemoveStorageAccessForFrame(PAL::SessionID sessionID, uint64_t frameID, uint64_t pageID);
}
Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp (226481 => 226482)
--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2018-01-06 01:56:23 UTC (rev 226481)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2018-01-06 02:16:51 UTC (rev 226482)
@@ -355,21 +355,21 @@
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)
+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->isStorageAccessGranted(resourceDomain, firstPartyDomain, frameID, pageID), contextId), 0);
+ parentProcessConnection()->send(Messages::NetworkProcessProxy::StorageAccessRequestResult(networkStorageSession->hasStorageAccessForFrame(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)
+void NetworkProcess::grantStorageAccessForFrame(PAL::SessionID sessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, uint64_t contextId)
{
bool isStorageGranted = false;
if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID)) {
- networkStorageSession->setStorageAccessGranted(resourceDomain, firstPartyDomain, frameID, pageID, shouldGrantStorage);
- ASSERT(networkStorageSession->isStorageAccessGranted(resourceDomain, firstPartyDomain, frameID, pageID) == shouldGrantStorage);
- isStorageGranted = shouldGrantStorage;
+ networkStorageSession->grantStorageAccessForFrame(resourceDomain, firstPartyDomain, frameID, pageID);
+ ASSERT(networkStorageSession->hasStorageAccessForFrame(resourceDomain, firstPartyDomain, frameID, pageID));
+ isStorageGranted = true;
} else
ASSERT_NOT_REACHED();
Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.h (226481 => 226482)
--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.h 2018-01-06 01:56:23 UTC (rev 226481)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.h 2018-01-06 02:16:51 UTC (rev 226482)
@@ -138,8 +138,8 @@
#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
void updatePrevalentDomainsToPartitionOrBlockCookies(PAL::SessionID, const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& 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 hasStorageAccessForFrame(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, uint64_t contextId);
+ void grantStorageAccessForFrame(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, uint64_t contextId);
void removePrevalentDomains(PAL::SessionID, const Vector<String>& domains);
#endif
Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in (226481 => 226482)
--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in 2018-01-06 01:56:23 UTC (rev 226481)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in 2018-01-06 02:16:51 UTC (rev 226482)
@@ -85,8 +85,8 @@
#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
UpdatePrevalentDomainsToPartitionOrBlockCookies(PAL::SessionID sessionID, Vector<String> domainsToPartition, Vector<String> domainsToBlock, Vector<String> 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)
+ HasStorageAccessForFrame(PAL::SessionID sessionID, String resourceDomain, String firstPartyDomain, uint64_t frameID, uint64_t pageID, uint64_t contextId)
+ GrantStorageAccessForFrame(PAL::SessionID sessionID, String resourceDomain, String firstPartyDomain, uint64_t frameID, uint64_t pageID, uint64_t contextId)
RemovePrevalentDomains(PAL::SessionID sessionID, Vector<String> domainsWithInteraction);
#endif
}
Modified: trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp (226481 => 226482)
--- trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp 2018-01-06 01:56:23 UTC (rev 226481)
+++ trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp 2018-01-06 02:16:51 UTC (rev 226482)
@@ -412,20 +412,20 @@
return ++nextContextId;
}
-void NetworkProcessProxy::hasStorageAccessForPrevalentDomains(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(bool)>&& 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);
+ send(Messages::NetworkProcess::HasStorageAccessForFrame(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<void(bool)>&& callback)
+void NetworkProcessProxy::grantStorageAccessForFrame(PAL::SessionID sessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(bool)>&& callback)
{
auto contextId = nextRequestStorageAccessContextId();
auto addResult = m_storageAccessResponseCallbackMap.add(contextId, WTFMove(callback));
ASSERT_UNUSED(addResult, addResult.isNewEntry);
- send(Messages::NetworkProcess::UpdateStorageAccessForPrevalentDomains(sessionID, resourceDomain, firstPartyDomain, frameID, pageID, value, contextId), 0);
+ send(Messages::NetworkProcess::GrantStorageAccessForFrame(sessionID, resourceDomain, firstPartyDomain, frameID, pageID, contextId), 0);
}
void NetworkProcessProxy::storageAccessRequestResult(bool wasGranted, uint64_t contextId)
Modified: trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h (226481 => 226482)
--- trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h 2018-01-06 01:56:23 UTC (rev 226481)
+++ trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h 2018-01-06 02:16:51 UTC (rev 226482)
@@ -79,8 +79,8 @@
#endif
#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
- void hasStorageAccessForPrevalentDomains(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& callback);
- void updateStorageAccessForPrevalentDomains(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, bool value, CompletionHandler<void(bool)>&& callback);
+ void hasStorageAccessForFrame(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& callback);
+ void grantStorageAccessForFrame(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& callback);
#endif
void writeBlobToFilePath(const WebCore::URL&, const String& path, CompletionHandler<void(bool)>&& callback);
Modified: trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp (226481 => 226482)
--- trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp 2018-01-06 01:56:23 UTC (rev 226481)
+++ trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp 2018-01-06 02:16:51 UTC (rev 226482)
@@ -147,12 +147,12 @@
return mergedDates;
}
-WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore(const String& resourceLoadStatisticsDirectory, Function<void(const String&)>&& testingCallback, UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler&& updatePrevalentDomainsToPartitionOrBlockCookiesHandler, HasStorageAccessForPrevalentDomainsHandler&& hasStorageAccessForPrevalentDomainsHandler, UpdateStorageAccessForPrevalentDomainsHandler&& updateStorageAccessForPrevalentDomainsHandler, RemovePrevalentDomainsHandler&& removeDomainsHandler)
+WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore(const String& resourceLoadStatisticsDirectory, Function<void(const String&)>&& testingCallback, UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler&& updatePrevalentDomainsToPartitionOrBlockCookiesHandler, HasStorageAccessForFrameHandler&& hasStorageAccessForFrameHandler, GrantStorageAccessForFrameHandler&& grantStorageAccessForFrameHandler, 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_hasStorageAccessForFrameHandler(WTFMove(hasStorageAccessForFrameHandler))
+ , m_grantStorageAccessForFrameHandler(WTFMove(grantStorageAccessForFrameHandler))
, m_removeDomainsHandler(WTFMove(removeDomainsHandler))
, m_dailyTasksTimer(RunLoop::main(), this, &WebResourceLoadStatisticsStore::performDailyTasks)
, m_statisticsTestingCallback(WTFMove(testingCallback))
@@ -272,7 +272,7 @@
return;
}
- m_hasStorageAccessForPrevalentDomainsHandler(subFramePrimaryDomain, topFramePrimaryDomain, frameID, pageID, WTFMove(callback));
+ m_hasStorageAccessForFrameHandler(subFramePrimaryDomain, topFramePrimaryDomain, frameID, pageID, WTFMove(callback));
});
}
@@ -281,8 +281,15 @@
ASSERT(subFrameHost != topFrameHost);
ASSERT(RunLoop::isMain());
- m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), subFramePrimaryDomain = isolatedPrimaryDomain(subFrameHost), topFramePrimaryDomain = isolatedPrimaryDomain(topFrameHost), frameID, pageID, callback = WTFMove(callback)] () mutable {
+ auto subFramePrimaryDomain = isolatedPrimaryDomain(subFrameHost);
+ auto topFramePrimaryDomain = isolatedPrimaryDomain(topFrameHost);
+ if (subFramePrimaryDomain == topFramePrimaryDomain) {
+ callback(true);
+ return;
+ }
+ m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), subFramePrimaryDomain = crossThreadCopy(subFramePrimaryDomain), topFramePrimaryDomain = crossThreadCopy(topFramePrimaryDomain), frameID, pageID, callback = WTFMove(callback)] () mutable {
+
auto& subFrameStatistic = ensureResourceStatisticsForPrimaryDomain(subFramePrimaryDomain);
if (shouldBlockCookies(subFrameStatistic)) {
callback(false);
@@ -294,7 +301,7 @@
return;
}
- m_updateStorageAccessForPrevalentDomainsHandler(subFramePrimaryDomain, topFramePrimaryDomain, frameID, pageID, true, WTFMove(callback));
+ m_grantStorageAccessForFrameHandler(subFramePrimaryDomain, topFramePrimaryDomain, frameID, pageID, WTFMove(callback));
});
}
Modified: trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h (226481 => 226482)
--- trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h 2018-01-06 01:56:23 UTC (rev 226481)
+++ trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h 2018-01-06 02:16:51 UTC (rev 226482)
@@ -62,12 +62,12 @@
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 HasStorageAccessForPrevalentDomainsHandler = WTF::Function<void(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::Function<void(bool hasAccess)>&& callback)>;
- using UpdateStorageAccessForPrevalentDomainsHandler = WTF::Function<void(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, bool value, 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(bool hasAccess)>&& callback)>;
+ using GrantStorageAccessForFrameHandler = WTF::Function<void(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::Function<void(bool wasGranted)>&& callback)>;
using RemovePrevalentDomainsHandler = WTF::Function<void (const Vector<String>&)>;
- static Ref<WebResourceLoadStatisticsStore> create(const String& resourceLoadStatisticsDirectory, Function<void (const String&)>&& testingCallback, UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler&& updatePrevalentDomainsToPartitionOrBlockCookiesHandler = [](const Vector<String>&, const Vector<String>&, const Vector<String>&, ShouldClearFirst) { }, HasStorageAccessForPrevalentDomainsHandler&& hasStorageAccessForPrevalentDomainsHandler = [](const String&, const String&, uint64_t, uint64_t, WTF::Function<void(bool)>&&) { }, UpdateStorageAccessForPrevalentDomainsHandler&& updateStorageAccessForPrevalentDomainsHandler = [](const String&, const String&, uint64_t, uint64_t, bool, WTF::Function<void(bool)>&&) { }, RemovePrevalentDomainsHandler&& removeDomainsHandler = [] (const Vector<String>&) { })
+ static Ref<WebResourceLoadStatisticsStore> create(const String& resourceLoadStatisticsDirectory, Function<void (const String&)>&& testingCallback, UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler&& updatePrevalentDomainsToPartitionOrBlockCookiesHandler = [](const Vector<String>&, const Vector<String>&, const Vector<String>&, ShouldClearFirst) { }, HasStorageAccessForFrameHandler&& hasStorageAccessForFrameHandler = [](const String&, const String&, uint64_t, uint64_t, WTF::Function<void(bool)>&&) { }, GrantStorageAccessForFrameHandler&& grantStorageAccessForFrameHandler = [](const String&, const String&, uint64_t, uint64_t, WTF::Function<void(bool)>&&) { }, RemovePrevalentDomainsHandler&& removeDomainsHandler = [] (const Vector<String>&) { })
{
- return adoptRef(*new WebResourceLoadStatisticsStore(resourceLoadStatisticsDirectory, WTFMove(testingCallback), WTFMove(updatePrevalentDomainsToPartitionOrBlockCookiesHandler), WTFMove(hasStorageAccessForPrevalentDomainsHandler), WTFMove(updateStorageAccessForPrevalentDomainsHandler), WTFMove(removeDomainsHandler)));
+ return adoptRef(*new WebResourceLoadStatisticsStore(resourceLoadStatisticsDirectory, WTFMove(testingCallback), WTFMove(updatePrevalentDomainsToPartitionOrBlockCookiesHandler), WTFMove(hasStorageAccessForFrameHandler), WTFMove(grantStorageAccessForFrameHandler), WTFMove(removeDomainsHandler)));
}
~WebResourceLoadStatisticsStore();
@@ -143,7 +143,7 @@
void logTestingEvent(const String&);
private:
- WebResourceLoadStatisticsStore(const String&, Function<void(const String&)>&& testingCallback, UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler&&, HasStorageAccessForPrevalentDomainsHandler&&, UpdateStorageAccessForPrevalentDomainsHandler&&, RemovePrevalentDomainsHandler&&);
+ WebResourceLoadStatisticsStore(const String&, Function<void(const String&)>&& testingCallback, UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler&&, HasStorageAccessForFrameHandler&&, GrantStorageAccessForFrameHandler&&, RemovePrevalentDomainsHandler&&);
void removeDataRecords();
@@ -196,8 +196,8 @@
Vector<OperatingDate> m_operatingDates;
UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler m_updatePrevalentDomainsToPartitionOrBlockCookiesHandler;
- HasStorageAccessForPrevalentDomainsHandler m_hasStorageAccessForPrevalentDomainsHandler;
- UpdateStorageAccessForPrevalentDomainsHandler m_updateStorageAccessForPrevalentDomainsHandler;
+ HasStorageAccessForFrameHandler m_hasStorageAccessForFrameHandler;
+ GrantStorageAccessForFrameHandler m_grantStorageAccessForFrameHandler;
RemovePrevalentDomainsHandler m_removeDomainsHandler;
WallTime m_endOfGrandfatheringTimestamp;
Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (226481 => 226482)
--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp 2018-01-06 01:56:23 UTC (rev 226481)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp 2018-01-06 02:16:51 UTC (rev 226482)
@@ -1176,16 +1176,16 @@
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<void(bool hasAccess)>&& callback)
+void WebsiteDataStore::hasStorageAccessForFrameHandler(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(bool hasAccess)>&& callback)
{
for (auto& processPool : processPools())
- processPool->networkProcess()->hasStorageAccessForPrevalentDomains(m_sessionID, resourceDomain, firstPartyDomain, frameID, pageID, WTFMove(callback));
+ processPool->networkProcess()->hasStorageAccessForFrame(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<void(bool wasGranted)>&& callback)
+void WebsiteDataStore::grantStorageAccessForFrameHandler(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(bool wasGranted)>&& callback)
{
for (auto& processPool : processPools())
- processPool->networkProcess()->updateStorageAccessForPrevalentDomains(m_sessionID, resourceDomain, firstPartyDomain, frameID, pageID, value, WTFMove(callback));
+ processPool->networkProcess()->grantStorageAccessForFrame(m_sessionID, resourceDomain, firstPartyDomain, frameID, pageID, WTFMove(callback));
}
void WebsiteDataStore::removePrevalentDomains(const Vector<String>& domains)
@@ -1404,9 +1404,9 @@
m_resourceLoadStatistics = WebResourceLoadStatisticsStore::create(m_configuration.resourceLoadStatisticsDirectory, WTFMove(callback), [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) {
- 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<void(bool wasGranted)>&& callback) {
- updateStorageAccessForPrevalentDomainsHandler(resourceDomain, firstPartyDomain, frameID, pageID, value, WTFMove(callback));
+ hasStorageAccessForFrameHandler(resourceDomain, firstPartyDomain, frameID, pageID, WTFMove(callback));
+ }, [this, protectedThis = makeRef(*this)] (const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(bool wasGranted)>&& callback) {
+ grantStorageAccessForFrameHandler(resourceDomain, firstPartyDomain, frameID, pageID, WTFMove(callback));
}, [this, protectedThis = makeRef(*this)] (const Vector<String>& domainsToRemove) {
removePrevalentDomains(domainsToRemove);
});
Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h (226481 => 226482)
--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h 2018-01-06 01:56:23 UTC (rev 226481)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h 2018-01-06 02:16:51 UTC (rev 226482)
@@ -118,8 +118,8 @@
#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
void updatePrevalentDomainsToPartitionOrBlockCookies(const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst);
- void hasStorageAccessForPrevalentDomainsHandler(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(bool hasAccess)>&& callback);
- void updateStorageAccessForPrevalentDomainsHandler(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, bool value, WTF::CompletionHandler<void(bool wasGranted)>&& callback);
+ void hasStorageAccessForFrameHandler(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(bool hasAccess)>&& callback);
+ void grantStorageAccessForFrameHandler(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(bool wasGranted)>&& callback);
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);
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (226481 => 226482)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2018-01-06 01:56:23 UTC (rev 226481)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2018-01-06 02:16:51 UTC (rev 226482)
@@ -170,7 +170,7 @@
#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
if (m_hasFrameSpecificStorageAccess) {
- WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::RemoveStorageAccess(sessionID(), frameID().value(), pageID().value()), 0);
+ WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::RemoveStorageAccessForFrame(sessionID(), frameID().value(), pageID().value()), 0);
m_hasFrameSpecificStorageAccess = false;
}
#endif
@@ -392,7 +392,7 @@
return;
if (m_hasFrameSpecificStorageAccess) {
- WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::RemoveStorageAccess(sessionID(), frameID().value(), pageID().value()), 0);
+ WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::RemoveStorageAccessForFrame(sessionID(), frameID().value(), pageID().value()), 0);
m_hasFrameSpecificStorageAccess = false;
}
#endif