WebKit Bugzilla
Attachment 346208 Details for
Bug 188109
: Resource Load Statistics: Remove partitioned cookies for reduced complexity, lower memory footprint, and ability to support more platforms
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188109-20180731151415.patch (text/plain), 429.86 KB, created by
John Wilander
on 2018-07-31 15:14:16 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
John Wilander
Created:
2018-07-31 15:14:16 PDT
Size:
429.86 KB
patch
obsolete
>Subversion Revision: 234435 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index a8fb1912198bfab0f4cf6dd072e03e181047cdfb..43efff2c027cc901f8084e480d875daf907b25cc 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,77 @@ >+2018-07-31 John Wilander <wilander@apple.com> >+ >+ Resource Load Statistics: Remove partitioned cookies for reduced complexity, lower memory footprint, and ability to support more platforms >+ https://bugs.webkit.org/show_bug.cgi?id=188109 >+ <rdar://problem/42664391> >+ >+ Reviewed by Brent Fulgham, Chris Dumez, and Alex Christensen. >+ >+ Tests: http/tests/resourceLoadStatistics/cookie-deletion.html >+ http/tests/resourceLoadStatistics/cookies-with-and-without-user-interaction.html >+ http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-user-interaction.html >+ http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-pop-window.html >+ http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe.html >+ http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame.html >+ http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-but-access-from-wrong-frame.html >+ http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction.html >+ http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction.html >+ http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe.html >+ http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-nested-iframe.html >+ >+ This patch removes cookie partitioning which reduces the model to just >+ blocked cookies (in third-party contexts) and first-party cookie access. >+ >+ Several of the changes are renaming to reflect that there are no more >+ cookie partitions. However, the compile-time check remains for now since >+ this change is not ready to ship. >+ >+ The test cases mentioned about are not new. They are just renamed to >+ reflect the code changes and to shorten their names (as requested by >+ non-Cocoa platforms). >+ >+ * loader/ResourceLoadStatistics.cpp: >+ (WebCore::ResourceLoadStatistics::toString const): >+ (WebCore::ResourceLoadStatistics::merge): >+ Removed the use of isMarkedForCookiePartitioning. >+ * loader/ResourceLoadStatistics.h: >+ Removed isMarkedForCookiePartitioning. >+ * platform/network/NetworkStorageSession.h: >+ * platform/network/ResourceHandle.h: >+ Renamed applySniffingPoliciesAndStoragePartitionIfNeeded() to >+ applySniffingPoliciesIfNeeded(). >+ * platform/network/cf/NetworkStorageSessionCFNet.cpp: >+ (WebCore::getPartitioningDomain): >+ (WebCore::NetworkStorageSession::shouldBlockCookies const): >+ Now takes a frame ID and a page ID to be able to support >+ the Storage Access API. This was previously handled by >+ shouldPartitionCookies() which is now deleted. >+ (WebCore::NetworkStorageSession::setPrevalentDomainsToBlockCookiesFor): >+ Renamed from setPrevalentDomainsToPartitionOrBlockCookies(). >+ (WebCore::NetworkStorageSession::removePrevalentDomains): >+ No longer needs to clear the member variable for partitioned cookie domains. >+ (WebCore::NetworkStorageSession::setCookieStoragePartitioningEnabled): Deleted. >+ (WebCore::NetworkStorageSession::cookieStoragePartition const): Deleted. >+ (WebCore::NetworkStorageSession::shouldPartitionCookies const): Deleted. >+ (WebCore::NetworkStorageSession::setPrevalentDomainsToPartitionOrBlockCookies): Deleted. >+ Renamed to setPrevalentDomainsToBlockCookiesFor(). >+ * platform/network/mac/CookieJarMac.mm: >+ (WebCore::cookiesForURL): >+ Now calls session.shouldBlockCookies() instead of the >+ wrapper cookiesAreBlockedForURL(). >+ (WebCore::setCookiesFromDOM): >+ No longer checks for partition. >+ (WebCore::applyPartitionToCookies): Deleted. >+ (WebCore::cookiesAreBlockedForURL): Deleted. >+ This was just a wrapper for session.shouldBlockCookies(). >+ (WebCore::cookiesInPartitionForURL): Deleted. >+ * platform/network/mac/ResourceHandleMac.mm: >+ (WebCore::ResourceHandle::applySniffingPoliciesIfNeeded): >+ Renamed from applySniffingPoliciesAndStoragePartitionIfNeeded(). >+ (WebCore::ResourceHandle::createNSURLConnection): >+ Consequence of function name change. >+ (WebCore::ResourceHandle::applySniffingPoliciesAndStoragePartitionIfNeeded): Deleted. >+ Renamed to applySniffingPoliciesIfNeeded(). >+ > 2018-07-31 Yusuke Suzuki <utatane.tea@gmail.com> > > Clean up TransformationMatrix implementation >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 713ea7341df292025245b0a6b3a5e84829e0d24c..bd1d97fc333c8d0e52f987711855f12eb731bc6a 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,186 @@ >+2018-07-31 John Wilander <wilander@apple.com> >+ >+ Resource Load Statistics: Remove partitioned cookies for reduced complexity, lower memory footprint, and ability to support more platforms >+ https://bugs.webkit.org/show_bug.cgi?id=188109 >+ <rdar://problem/42664391> >+ >+ Reviewed by Brent Fulgham, Chris Dumez, and Alex Christensen. >+ >+ This patch removes cookie partitioning which reduces the model to just >+ blocked cookies (in third-party contexts) and first-party cookie access. >+ >+ Several of the changes are renaming to reflect that there are no more >+ cookie partitions. However, the compile-time check remains for now since >+ this change is not ready to ship. >+ >+ The API changes are mostly in C APIs used for layout tests. The slight >+ change in Cocoa API is that there no longer is a functionality to >+ "enable" cookie partitioning. The boolean member is still there but it >+ no longer does anything. >+ >+ The functional changes are in WebKit::ResourceLoadStatisticsMemoryStore >+ and WebKit::NetworkDataTaskCocoa where cookie partitioning used to be >+ managed and applied respectively. The IPC communication has changed to >+ reflect this. >+ >+ * NetworkProcess/NetworkProcess.cpp: >+ (WebKit::NetworkProcess::updatePrevalentDomainsToBlockCookiesFor): >+ Name change from updatePrevalentDomainsToPartitionOrBlockCookies(). >+ No longer supports the partitioned category. >+ (WebKit::NetworkProcess::removeAllStorageAccess): >+ Now supports a completion handler. This change was made to address >+ flakiness that came after layout test changes that were needed because >+ of the removal of partitioned cookies. >+ (WebKit::NetworkProcess::updatePrevalentDomainsToPartitionOrBlockCookies): Deleted. >+ * NetworkProcess/NetworkProcess.h: >+ * NetworkProcess/NetworkProcess.messages.in: >+ Partitioning removed from message name. >+ RemoveAllStorageAccess message now supports a completion handler >+ as explained above >+ * NetworkProcess/NetworkProcessCreationParameters.cpp: >+ (WebKit::NetworkProcessCreationParameters::encode const): >+ Removed parameter cookieStoragePartitioningEnabled. >+ (WebKit::NetworkProcessCreationParameters::decode): >+ Removed parameter cookieStoragePartitioningEnabled. >+ * NetworkProcess/NetworkProcessCreationParameters.h: >+ * NetworkProcess/NetworkResourceLoader.cpp: >+ (WebKit::NetworkResourceLoader::logCookieInformation): >+ No longer takes partitioning into account. >+ * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: >+ * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: >+ (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): >+ Now only applies cookie blocking. >+ (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): >+ Now only applies cookie blocking. >+ (WebKit::NetworkDataTaskCocoa::applyCookiePartitioningPolicy): Deleted. >+ * NetworkProcess/cocoa/NetworkProcessCocoa.mm: >+ (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa): >+ Removed the call to setCookieStoragePartitioningEnabled(). >+ (WebKit::NetworkProcess::setCookieStoragePartitioningEnabled): Deleted. >+ * NetworkProcess/cocoa/NetworkSessionCocoa.mm: >+ (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]): >+ (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]): >+ WebCore::NetworkStorageSession::shouldBlockCookies() now takes a >+ frame ID and page ID to resolve cookie access with the Storage >+ Access API. This was previously handled by >+ WebCore::NetworkStorageSession::cookieStoragePartition(). >+ * UIProcess/API/C/WKCookieManager.cpp: >+ (WKCookieManagerSetCookieStoragePartitioningEnabled): Deleted. >+ * UIProcess/API/C/WKCookieManager.h: >+ * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: >+ (WKWebsiteDataStoreStatisticsUpdateCookieBlocking): >+ (WKWebsiteDataStoreSetStatisticsHasHadNonRecentUserInteraction): Deleted. >+ There is no longer a difference between recent and non-recent >+ user interaction so this test function was removed. >+ (WKWebsiteDataStoreSetStatisticsTimeToLiveCookiePartitionFree): Deleted. >+ (WKWebsiteDataStoreStatisticsUpdateCookiePartitioning): Deleted. >+ (WKWebsiteDataStoreSetStatisticsShouldPartitionCookiesForHost): Deleted. >+ Deleted because partitioning is no longer a thing. >+ * UIProcess/API/C/WKWebsiteDataStoreRef.h: >+ * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: >+ Deprecated _isCookieStoragePartitioningEnabled() and >+ _setCookieStoragePartitioningEnabled() via WK_API_DEPRECATED. >+ * UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm: >+ (WebKit::ResourceLoadStatisticsMemoryStore::registerUserDefaultsIfNeeded): >+ Removed support for ResourceLoadStatisticsTimeToLiveCookiePartitionFree. >+ * UIProcess/Cocoa/WebProcessPoolCocoa.mm: >+ (WebKit::WebProcessPool::platformInitializeNetworkProcess): >+ No longer sets a parameter based on cookieStoragePartitioningEnabled(). >+ (WebKit::WebProcessPool::setCookieStoragePartitioningEnabled): >+ Added a FIXME comment that this setter no longer does anything meaningful. >+ Removed the IPC call to the network process to propagate the setting. >+ * UIProcess/Network/NetworkProcessProxy.cpp: >+ (WebKit::NetworkProcessProxy::clearCallbackStates): >+ Name change from m_updatePartitionOrBlockCookiesCallbackMap to >+ m_updateBlockCookiesCallbackMap. >+ (WebKit::NetworkProcessProxy::updatePrevalentDomainsToBlockCookiesFor): >+ Name change plus it now just takes one vector of strings named domainsToBlock. >+ (WebKit::NetworkProcessProxy::didUpdateBlockCookies): >+ Name change from didUpdatePartitionOrBlockCookies(). >+ (WebKit::NetworkProcessProxy::storageAccessRequestResult): >+ Just moved to its right place. >+ (WebKit::NetworkProcessProxy::removeAllStorageAccess): >+ Now take a completion handler. >+ (WebKit::NetworkProcessProxy::didRemoveAllStorageAccess): >+ To call the completion handler. >+ (WebKit::NetworkProcessProxy::updatePrevalentDomainsToPartitionOrBlockCookies): Deleted. >+ Name change. >+ (WebKit::NetworkProcessProxy::didUpdatePartitionOrBlockCookies): Deleted. >+ Name change. >+ * UIProcess/Network/NetworkProcessProxy.h: >+ * UIProcess/Network/NetworkProcessProxy.messages.in: >+ Name change and added completion handler message for removeAllStorageAccess(). >+ * UIProcess/ResourceLoadStatisticsMemoryStore.cpp: >+ (WebKit::ResourceLoadStatisticsMemoryStore::hasStorageAccess): >+ (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess): >+ (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener): >+ (WebKit::ResourceLoadStatisticsMemoryStore::scheduleStatisticsProcessingRequestIfNecessary): >+ (WebKit::ResourceLoadStatisticsMemoryStore::logUserInteraction): >+ (WebKit::ResourceLoadStatisticsMemoryStore::mergeWithDataFromDecoder): >+ (WebKit::ResourceLoadStatisticsMemoryStore::clear): >+ (WebKit::ResourceLoadStatisticsMemoryStore::wasAccessedAsFirstPartyDueToUserInteraction const): >+ (WebKit::ResourceLoadStatisticsMemoryStore::shouldBlockAndKeepCookies): >+ (WebKit::ResourceLoadStatisticsMemoryStore::shouldBlockAndPurgeCookies): >+ (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlocking): >+ (WebKit::ResourceLoadStatisticsMemoryStore::updateCookieBlockingForDomains): >+ (WebKit::ResourceLoadStatisticsMemoryStore::clearBlockingStateForDomains): >+ (WebKit::ResourceLoadStatisticsMemoryStore::resetCookieBlockingState): >+ (WebKit::ResourceLoadStatisticsMemoryStore::removeAllStorageAccess): >+ (WebKit::ResourceLoadStatisticsMemoryStore::logNonRecentUserInteraction): Deleted. >+ There is no longer a difference between recent and non-recent >+ user interaction so this test function was removed. >+ (WebKit::ResourceLoadStatisticsMemoryStore::setTimeToLiveCookiePartitionFree): Deleted. >+ (WebKit::ResourceLoadStatisticsMemoryStore::shouldPartitionCookies): Deleted. >+ (WebKit::ResourceLoadStatisticsMemoryStore::shouldBlockCookies): Deleted. >+ Now split into shouldBlockAndKeepCookies() and shouldBlockAndPurgeCookies(). >+ (WebKit::ResourceLoadStatisticsMemoryStore::updateCookiePartitioning): Deleted. >+ (WebKit::ResourceLoadStatisticsMemoryStore::updateCookiePartitioningForDomains): Deleted. >+ (WebKit::ResourceLoadStatisticsMemoryStore::clearPartitioningStateForDomains): Deleted. >+ (WebKit::ResourceLoadStatisticsMemoryStore::resetCookiePartitioningState): Deleted. >+ * UIProcess/ResourceLoadStatisticsMemoryStore.h: >+ * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp: >+ (WebKit::ResourceLoadStatisticsPersistentStorage::startMonitoringDisk): >+ Added an empty completion handler to the m_memoryStore.clear() call. >+ * UIProcess/WebCookieManagerProxy.cpp: >+ (WebKit::WebCookieManagerProxy::setCookieStoragePartitioningEnabled): Deleted. >+ * UIProcess/WebCookieManagerProxy.h: >+ * UIProcess/WebResourceLoadStatisticsStore.cpp: >+ (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated): >+ (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess): >+ Now has a completion handler. >+ (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdate): >+ (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdateForDomains): >+ (WebKit::WebResourceLoadStatisticsStore::scheduleClearBlockingStateForDomains): >+ (WebKit::WebResourceLoadStatisticsStore::scheduleCookieBlockingStateReset): >+ (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemory): >+ Now supports a completion handler for removeAllStorageAccess(). >+ (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent): >+ (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler): >+ (WebKit::WebResourceLoadStatisticsStore::logNonRecentUserInteraction): Deleted. >+ There is no longer a difference between recent and non-recent >+ user interaction so this test function was removed. >+ (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdate): Deleted. >+ Renamed to scheduleCookieBlockingUpdate(). >+ (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdateForDomains): Deleted. >+ Renamed to scheduleCookieBlockingUpdateForDomains(). >+ (WebKit::WebResourceLoadStatisticsStore::scheduleClearPartitioningStateForDomains): Deleted. >+ Renamed to scheduleClearBlockingStateForDomains(). >+ (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningStateReset): Deleted. >+ Renamed to scheduleCookieBlockingStateReset(). >+ (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveCookiePartitionFree): Deleted. >+ (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToPartitionOrBlockCookiesHandler): Deleted. >+ Renamed callUpdatePrevalentDomainsToBlockCookiesForHandler(). >+ * UIProcess/WebResourceLoadStatisticsStore.h: >+ * UIProcess/WebsiteData/WebsiteDataStore.cpp: >+ (WebKit::WebsiteDataStore::updatePrevalentDomainsToBlockCookiesFor): >+ (WebKit::WebsiteDataStore::removeAllStorageAccessHandler): >+ Now supports a completion handler for removeAllStorageAccess(). >+ (WebKit::WebsiteDataStore::networkProcessDidCrash): >+ Name change in function called to get rid of "partitioning." >+ (WebKit::WebsiteDataStore::updatePrevalentDomainsToPartitionOrBlockCookies): Deleted. >+ Renamed updatePrevalentDomainsToBlockCookiesFor(). >+ * UIProcess/WebsiteData/WebsiteDataStore.h: >+ > 2018-07-31 Rob Buis <rbuis@igalia.com> > > Remove ResourceResponse::cacheBodyKey API >diff --git a/Source/WebCore/loader/ResourceLoadStatistics.cpp b/Source/WebCore/loader/ResourceLoadStatistics.cpp >index 96b7eb9b0b40d57b9a36cd92fcbfbe8e959d028b..d75639c62c0385e655c6b91d9e9cdf0748443af4 100644 >--- a/Source/WebCore/loader/ResourceLoadStatistics.cpp >+++ b/Source/WebCore/loader/ResourceLoadStatistics.cpp >@@ -265,7 +265,6 @@ String ResourceLoadStatistics::toString() const > builder.append('\n'); > > // In-memory only >- appendBoolean(builder, "isMarkedForCookiePartitioning", isMarkedForCookiePartitioning); > appendBoolean(builder, "isMarkedForCookieBlocking", isMarkedForCookieBlocking); > builder.append('\n'); > >@@ -330,7 +329,6 @@ void ResourceLoadStatistics::merge(const ResourceLoadStatistics& other) > dataRecordsRemoved = std::max(dataRecordsRemoved, other.dataRecordsRemoved); > > // In-memory only >- isMarkedForCookiePartitioning |= other.isMarkedForCookiePartitioning; > isMarkedForCookieBlocking |= other.isMarkedForCookieBlocking; > } > >diff --git a/Source/WebCore/loader/ResourceLoadStatistics.h b/Source/WebCore/loader/ResourceLoadStatistics.h >index f047c77cddbff2c62d262b97dbd8ad6b5fc814dd..eb9c7b6906493dd9e78b45d8c1b87e7431d9b033 100644 >--- a/Source/WebCore/loader/ResourceLoadStatistics.h >+++ b/Source/WebCore/loader/ResourceLoadStatistics.h >@@ -96,7 +96,6 @@ struct ResourceLoadStatistics { > unsigned timesAccessedAsFirstPartyDueToStorageAccessAPI { 0 }; > > // In-memory only >- bool isMarkedForCookiePartitioning { false }; > bool isMarkedForCookieBlocking { false }; > }; > >diff --git a/Source/WebCore/platform/network/NetworkStorageSession.h b/Source/WebCore/platform/network/NetworkStorageSession.h >index 08a82dd5a3d089b3ba4f8b0dd5416354287e2517..986f7e439279911a9654761c756c4c22bef0ef26 100644 >--- a/Source/WebCore/platform/network/NetworkStorageSession.h >+++ b/Source/WebCore/platform/network/NetworkStorageSession.h >@@ -98,14 +98,11 @@ public: > // May be null, in which case a Foundation default should be used. > CFURLStorageSessionRef platformSession() { return m_platformSession.get(); } > WEBCORE_EXPORT RetainPtr<CFHTTPCookieStorageRef> cookieStorage() const; >- WEBCORE_EXPORT static void setCookieStoragePartitioningEnabled(bool); > WEBCORE_EXPORT static void setStorageAccessAPIEnabled(bool); > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >- WEBCORE_EXPORT String cookieStoragePartition(const ResourceRequest&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID) const; >- WEBCORE_EXPORT bool shouldBlockCookies(const ResourceRequest&) const; >- WEBCORE_EXPORT bool shouldBlockCookies(const URL& firstPartyForCookies, const URL& resource) const; >- WEBCORE_EXPORT 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 bool shouldBlockCookies(const ResourceRequest&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID) const; >+ WEBCORE_EXPORT bool shouldBlockCookies(const URL& firstPartyForCookies, const URL& resource, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID) const; >+ WEBCORE_EXPORT void setPrevalentDomainsToBlockCookiesFor(const Vector<String>& domainsToBlock, bool clearFirst); > WEBCORE_EXPORT void removePrevalentDomains(const Vector<String>& domains); > WEBCORE_EXPORT bool hasStorageAccess(const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID) const; > WEBCORE_EXPORT Vector<String> getAllStorageAccessEntries() const; >@@ -186,9 +183,7 @@ private: > CredentialStorage m_credentialStorage; > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >- bool shouldPartitionCookies(const String& topPrivatelyControlledDomain) const; > bool shouldBlockThirdPartyCookies(const String& topPrivatelyControlledDomain) const; >- HashSet<String> m_topPrivatelyControlledDomainsToPartition; > HashSet<String> m_topPrivatelyControlledDomainsToBlock; > 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; > HashMap<uint64_t, HashMap<String, String>, DefaultHash<uint64_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>> m_pagesGrantedStorageAccess; >diff --git a/Source/WebCore/platform/network/ResourceHandle.h b/Source/WebCore/platform/network/ResourceHandle.h >index 127286271d8ab7f8649efad5aa01fa0292c1eca4..f3609d0ea62ac062d3dc52d3fe4047da81568be5 100644 >--- a/Source/WebCore/platform/network/ResourceHandle.h >+++ b/Source/WebCore/platform/network/ResourceHandle.h >@@ -249,7 +249,7 @@ private: > #endif > > #if PLATFORM(COCOA) >- NSURLRequest *applySniffingPoliciesAndStoragePartitionIfNeeded(NSURLRequest *, bool shouldContentSniff, bool shouldContentEncodingSniff); >+ NSURLRequest *applySniffingPoliciesIfNeeded(NSURLRequest *, bool shouldContentSniff, bool shouldContentEncodingSniff); > #endif > > #if USE(CURL) >diff --git a/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp b/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp >index f942ec943e8fb18bf113bcf0d3d61defcaf78604..8119fd5e556e6c1d7bfc1fbab4b5b88910c39e5f 100644 >--- a/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp >+++ b/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp >@@ -79,7 +79,6 @@ DECLARE_CF_TYPE_TRAIT(CFHTTPCookie); > > namespace WebCore { > >-static bool cookieStoragePartitioningEnabled; > static bool storageAccessAPIEnabled; > > static RetainPtr<CFURLStorageSessionRef> createCFStorageSessionForIdentifier(CFStringRef identifier) >@@ -217,11 +216,6 @@ RetainPtr<CFHTTPCookieStorageRef> NetworkStorageSession::cookieStorage() const > #endif > } > >-void NetworkStorageSession::setCookieStoragePartitioningEnabled(bool enabled) >-{ >- cookieStoragePartitioningEnabled = enabled; >-} >- > void NetworkStorageSession::setStorageAccessAPIEnabled(bool enabled) > { > storageAccessAPIEnabled = enabled; >@@ -229,12 +223,7 @@ void NetworkStorageSession::setStorageAccessAPIEnabled(bool enabled) > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) > >-String NetworkStorageSession::cookieStoragePartition(const ResourceRequest& request, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID) const >-{ >- return cookieStoragePartition(request.firstPartyForCookies(), request.url(), frameID, pageID); >-} >- >-static inline String getPartitioningDomain(const URL& url) >+static inline String getPartitioningDomain(const URL& url) > { > #if ENABLE(PUBLIC_SUFFIX_LIST) > auto domain = topPrivatelyControlledDomain(url.host().toString()); >@@ -246,33 +235,6 @@ static inline String getPartitioningDomain(const URL& url) > return domain; > } > >-String NetworkStorageSession::cookieStoragePartition(const URL& firstPartyForCookies, const URL& resource, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID) const >-{ >- if (!cookieStoragePartitioningEnabled) >- return emptyString(); >- >- auto resourceDomain = getPartitioningDomain(resource); >- if (!shouldPartitionCookies(resourceDomain)) >- return emptyString(); >- >- auto firstPartyDomain = getPartitioningDomain(firstPartyForCookies); >- if (firstPartyDomain == resourceDomain) >- return emptyString(); >- >- if (pageID && hasStorageAccess(resourceDomain, firstPartyDomain, frameID, pageID.value())) >- return emptyString(); >- >- return firstPartyDomain; >-} >- >-bool NetworkStorageSession::shouldPartitionCookies(const String& topPrivatelyControlledDomain) const >-{ >- if (topPrivatelyControlledDomain.isEmpty()) >- return false; >- >- return m_topPrivatelyControlledDomainsToPartition.contains(topPrivatelyControlledDomain); >-} >- > bool NetworkStorageSession::shouldBlockThirdPartyCookies(const String& topPrivatelyControlledDomain) const > { > if (topPrivatelyControlledDomain.isEmpty()) >@@ -281,19 +243,13 @@ bool NetworkStorageSession::shouldBlockThirdPartyCookies(const String& topPrivat > return m_topPrivatelyControlledDomainsToBlock.contains(topPrivatelyControlledDomain); > } > >-bool NetworkStorageSession::shouldBlockCookies(const ResourceRequest& request) const >+bool NetworkStorageSession::shouldBlockCookies(const ResourceRequest& request, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID) const > { >- if (!cookieStoragePartitioningEnabled) >- return false; >- >- return shouldBlockCookies(request.firstPartyForCookies(), request.url()); >+ return shouldBlockCookies(request.firstPartyForCookies(), request.url(), frameID, pageID); > } > >-bool NetworkStorageSession::shouldBlockCookies(const URL& firstPartyForCookies, const URL& resource) const >+bool NetworkStorageSession::shouldBlockCookies(const URL& firstPartyForCookies, const URL& resource, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID) const > { >- if (!cookieStoragePartitioningEnabled) >- return false; >- > auto firstPartyDomain = getPartitioningDomain(firstPartyForCookies); > if (firstPartyDomain.isEmpty()) > return false; >@@ -305,43 +261,26 @@ bool NetworkStorageSession::shouldBlockCookies(const URL& firstPartyForCookies, > if (firstPartyDomain == resourceDomain) > return false; > >+ if (pageID && hasStorageAccess(resourceDomain, firstPartyDomain, frameID, pageID.value())) >+ return false; >+ > return shouldBlockThirdPartyCookies(resourceDomain); > } > >-void NetworkStorageSession::setPrevalentDomainsToPartitionOrBlockCookies(const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, bool clearFirst) >+void NetworkStorageSession::setPrevalentDomainsToBlockCookiesFor(const Vector<String>& domains, bool clearFirst) > { > if (clearFirst) { >- m_topPrivatelyControlledDomainsToPartition.clear(); > m_topPrivatelyControlledDomainsToBlock.clear(); > m_framesGrantedStorageAccess.clear(); > } > >- for (auto& domain : domainsToPartition) { >- m_topPrivatelyControlledDomainsToPartition.add(domain); >- if (!clearFirst) >- m_topPrivatelyControlledDomainsToBlock.remove(domain); >- } >- >- for (auto& domain : domainsToBlock) { >- m_topPrivatelyControlledDomainsToBlock.add(domain); >- if (!clearFirst) >- m_topPrivatelyControlledDomainsToPartition.remove(domain); >- } >- >- if (!clearFirst) { >- for (auto& domain : domainsToNeitherPartitionNorBlock) { >- m_topPrivatelyControlledDomainsToPartition.remove(domain); >- m_topPrivatelyControlledDomainsToBlock.remove(domain); >- } >- } >+ m_topPrivatelyControlledDomainsToBlock.add(domains.begin(), domains.end()); > } > > void NetworkStorageSession::removePrevalentDomains(const Vector<String>& domains) > { >- for (auto& domain : domains) { >- m_topPrivatelyControlledDomainsToPartition.remove(domain); >+ for (auto& domain : domains) > m_topPrivatelyControlledDomainsToBlock.remove(domain); >- } > } > > bool NetworkStorageSession::hasStorageAccess(const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID) const >diff --git a/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm b/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm >index 385c44b99ff5cb633142e3381fa2ade12111c14b..315e50e5d5e1bd70df9fa82e255d4a512de79ee7 100644 >--- a/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm >+++ b/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm >@@ -285,57 +285,11 @@ static RetainPtr<NSArray> filterCookies(NSArray *unfilteredCookies) > return filteredCookies; > } > >-#if HAVE(CFNETWORK_STORAGE_PARTITIONING) >- >-static NSArray *applyPartitionToCookies(NSString *partition, NSArray *cookies) >-{ >- ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies)); >- >- // FIXME 24747739: CFNetwork should expose this key as SPI >- static NSString * const partitionKey = @"StoragePartition"; >- >- NSMutableArray *partitionedCookies = [NSMutableArray arrayWithCapacity:cookies.count]; >- for (NSHTTPCookie *cookie in cookies) { >- RetainPtr<NSMutableDictionary> properties = adoptNS([cookie.properties mutableCopy]); >- [properties setObject:partition forKey:partitionKey]; >- [partitionedCookies addObject:[NSHTTPCookie cookieWithProperties:properties.get()]]; >- } >- >- return partitionedCookies; >-} >- >-static bool cookiesAreBlockedForURL(const NetworkStorageSession& session, const URL& firstParty, const URL& url) >-{ >- return session.shouldBlockCookies(firstParty, url); >-} >- >-static NSArray *cookiesInPartitionForURL(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID) >-{ >- ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies)); >- String partition = session.cookieStoragePartition(firstParty, url, frameID, pageID); >- if (partition.isEmpty()) >- return nil; >- >- // FIXME: Stop creating a new NSHTTPCookieStorage object each time we want to query the cookie jar. >- // NetworkStorageSession could instead keep a NSHTTPCookieStorage object for us. >- RetainPtr<NSHTTPCookieStorage> cookieStorage; >- if (auto storage = session.cookieStorage()) >- cookieStorage = adoptNS([[NSHTTPCookieStorage alloc] _initWithCFHTTPCookieStorage:storage.get()]); >- else >- cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage]; >- return cookiesForURL(cookieStorage.get(), url, firstParty, sameSiteInfo, partition); >-} >- >-#endif // HAVE(CFNETWORK_STORAGE_PARTITIONING) >- > static NSArray *cookiesForURL(const NetworkStorageSession& session, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID) > { > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >- if (cookiesAreBlockedForURL(session, firstParty, url)) >+ if (session.shouldBlockCookies(firstParty, url, frameID, pageID)) > return nil; >- >- if (NSArray *cookies = cookiesInPartitionForURL(session, firstParty, sameSiteInfo, url, frameID, pageID)) >- return cookies; > #else > UNUSED_PARAM(frameID); > UNUSED_PARAM(pageID); >@@ -443,12 +397,8 @@ void NetworkStorageSession::setCookiesFromDOM(const URL& firstParty, const SameS > ASSERT([filteredCookies.get() count] <= 1); > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >- if (shouldBlockCookies(firstParty, url)) >+ if (shouldBlockCookies(firstParty, url, frameID, pageID)) > return; >- >- String partition = cookieStoragePartition(firstParty, url, frameID, pageID); >- if (!partition.isEmpty()) >- filteredCookies = applyPartitionToCookies(partition, filteredCookies.get()); > #else > UNUSED_PARAM(frameID); > UNUSED_PARAM(pageID); >diff --git a/Source/WebCore/platform/network/mac/ResourceHandleMac.mm b/Source/WebCore/platform/network/mac/ResourceHandleMac.mm >index 1b73407dadac350e33cbbfcc43dc53a798f35bca..1d7b6e78742ee17866907e54d625481274ca9054 100644 >--- a/Source/WebCore/platform/network/mac/ResourceHandleMac.mm >+++ b/Source/WebCore/platform/network/mac/ResourceHandleMac.mm >@@ -111,20 +111,14 @@ static bool synchronousWillSendRequestEnabled() > > #if PLATFORM(COCOA) > >-NSURLRequest *ResourceHandle::applySniffingPoliciesAndStoragePartitionIfNeeded(NSURLRequest *request, bool shouldContentSniff, bool shouldContentEncodingSniff) >+NSURLRequest *ResourceHandle::applySniffingPoliciesIfNeeded(NSURLRequest *request, bool shouldContentSniff, bool shouldContentEncodingSniff) > { > #if !PLATFORM(MAC) > UNUSED_PARAM(shouldContentEncodingSniff); > #elif __MAC_OS_X_VERSION_MIN_REQUIRED < 101302 > shouldContentEncodingSniff = true; > #endif >- >-#if HAVE(CFNETWORK_STORAGE_PARTITIONING) >- String storagePartition = d->m_context->storageSession().cookieStoragePartition(firstRequest(), std::nullopt, std::nullopt); >-#else >- String storagePartition; >-#endif >- if (shouldContentSniff && shouldContentEncodingSniff && storagePartition.isEmpty()) >+ if (shouldContentSniff && shouldContentEncodingSniff) > return request; > > auto mutableRequest = adoptNS([request mutableCopy]); >@@ -137,11 +131,6 @@ NSURLRequest *ResourceHandle::applySniffingPoliciesAndStoragePartitionIfNeeded(N > if (!shouldContentSniff) > [mutableRequest _setProperty:@(NO) forKey:(__bridge NSString *)_kCFURLConnectionPropertyShouldSniff]; > >-#if HAVE(CFNETWORK_STORAGE_PARTITIONING) >- if (!storagePartition.isEmpty()) >- [mutableRequest _setProperty:storagePartition forKey:@"__STORAGE_PARTITION_IDENTIFIER"]; >-#endif >- > return mutableRequest.autorelease(); > } > >@@ -184,7 +173,7 @@ void ResourceHandle::createNSURLConnection(id delegate, bool shouldUseCredential > } > > NSURLRequest *nsRequest = firstRequest().nsURLRequest(HTTPBodyUpdatePolicy::UpdateHTTPBody); >- nsRequest = applySniffingPoliciesAndStoragePartitionIfNeeded(nsRequest, shouldContentSniff, shouldContentEncodingSniff); >+ nsRequest = applySniffingPoliciesIfNeeded(nsRequest, shouldContentSniff, shouldContentEncodingSniff); > > if (d->m_storageSession) > nsRequest = [copyRequestWithStorageSession(d->m_storageSession.get(), nsRequest) autorelease]; >diff --git a/Source/WebKit/NetworkProcess/NetworkProcess.cpp b/Source/WebKit/NetworkProcess/NetworkProcess.cpp >index 3a039e676f00179a23e184f16b22f93cd7eb9d3c..7c0cdd41fc1d2c59b73fc46be337e57a6a150e8b 100644 >--- a/Source/WebKit/NetworkProcess/NetworkProcess.cpp >+++ b/Source/WebKit/NetworkProcess/NetworkProcess.cpp >@@ -408,11 +408,11 @@ void NetworkProcess::writeBlobToFilePath(const WebCore::URL& url, const String& > } > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >-void NetworkProcess::updatePrevalentDomainsToPartitionOrBlockCookies(PAL::SessionID sessionID, const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, bool shouldClearFirst, uint64_t callbackId) >+void NetworkProcess::updatePrevalentDomainsToBlockCookiesFor(PAL::SessionID sessionID, const Vector<String>& domainsToBlock, bool shouldClearFirst, uint64_t contextId) > { > if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID)) >- networkStorageSession->setPrevalentDomainsToPartitionOrBlockCookies(domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, shouldClearFirst); >- parentProcessConnection()->send(Messages::NetworkProcessProxy::DidUpdatePartitionOrBlockCookies(callbackId), 0); >+ networkStorageSession->setPrevalentDomainsToBlockCookiesFor(domainsToBlock, shouldClearFirst); >+ parentProcessConnection()->send(Messages::NetworkProcessProxy::DidUpdateBlockCookies(contextId), 0); > } > > void NetworkProcess::hasStorageAccessForFrame(PAL::SessionID sessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, uint64_t contextId) >@@ -444,12 +444,13 @@ void NetworkProcess::grantStorageAccess(PAL::SessionID sessionID, const String& > parentProcessConnection()->send(Messages::NetworkProcessProxy::StorageAccessRequestResult(isStorageGranted, contextId), 0); > } > >-void NetworkProcess::removeAllStorageAccess(PAL::SessionID sessionID) >+void NetworkProcess::removeAllStorageAccess(PAL::SessionID sessionID, uint64_t contextId) > { > if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID)) > networkStorageSession->removeAllStorageAccess(); > else > ASSERT_NOT_REACHED(); >+ parentProcessConnection()->send(Messages::NetworkProcessProxy::DidRemoveAllStorageAccess(contextId), 0); > } > > void NetworkProcess::removePrevalentDomains(PAL::SessionID sessionID, const Vector<String>& domains) >diff --git a/Source/WebKit/NetworkProcess/NetworkProcess.h b/Source/WebKit/NetworkProcess/NetworkProcess.h >index d2917d8147f507be76b52b8c3c725f8622cd8be9..c9e9da2b0eeb56a1dba7df87061af7de05f3020d 100644 >--- a/Source/WebKit/NetworkProcess/NetworkProcess.h >+++ b/Source/WebKit/NetworkProcess/NetworkProcess.h >@@ -136,11 +136,11 @@ public: > void grantSandboxExtensionsToStorageProcessForBlobs(const Vector<String>& filenames, Function<void ()>&& completionHandler); > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >- void updatePrevalentDomainsToPartitionOrBlockCookies(PAL::SessionID, const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, bool shouldClearFirst, uint64_t callbackId); >+ void updatePrevalentDomainsToBlockCookiesFor(PAL::SessionID, const Vector<String>& domainsToBlock, bool shouldClearFirst, uint64_t contextId); > void hasStorageAccessForFrame(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, uint64_t contextId); > void getAllStorageAccessEntries(PAL::SessionID, uint64_t contextId); > void grantStorageAccess(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, uint64_t contextId); >- void removeAllStorageAccess(PAL::SessionID); >+ void removeAllStorageAccess(PAL::SessionID, uint64_t contextId); > void removePrevalentDomains(PAL::SessionID, const Vector<String>& domains); > #endif > >@@ -291,7 +291,6 @@ private: > > #if PLATFORM(COCOA) > void platformInitializeNetworkProcessCocoa(const NetworkProcessCreationParameters&); >- void setCookieStoragePartitioningEnabled(bool); > void setStorageAccessAPIEnabled(bool); > > // FIXME: We'd like to be able to do this without the #ifdef, but WorkQueue + BinarySemaphore isn't good enough since >diff --git a/Source/WebKit/NetworkProcess/NetworkProcess.messages.in b/Source/WebKit/NetworkProcess/NetworkProcess.messages.in >index ac5a81933d382183dd32e24c68d0aa0150084101..be9878613fbaea45d0b44bcb1bb1a16bcd762366 100644 >--- a/Source/WebKit/NetworkProcess/NetworkProcess.messages.in >+++ b/Source/WebKit/NetworkProcess/NetworkProcess.messages.in >@@ -54,7 +54,6 @@ messages -> NetworkProcess LegacyReceiver { > > #if PLATFORM(COCOA) > SetQOS(int latencyQOS, int throughputQOS) >- SetCookieStoragePartitioningEnabled(bool enabled) > SetStorageAccessAPIEnabled(bool enabled) > #endif > SetAllowsAnySSLCertificateForWebSocket(bool enabled) -> () >@@ -84,11 +83,11 @@ messages -> NetworkProcess LegacyReceiver { > PreconnectTo(WebCore::URL url, enum WebCore::StoredCredentialsPolicy storedCredentialsPolicy); > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >- UpdatePrevalentDomainsToPartitionOrBlockCookies(PAL::SessionID sessionID, Vector<String> domainsToPartition, Vector<String> domainsToBlock, Vector<String> domainsToNeitherPartitionNorBlock, bool shouldClearFirst, uint64_t callbackId) >+ UpdatePrevalentDomainsToBlockCookiesFor(PAL::SessionID sessionID, Vector<String> domainsToBlock, bool shouldClearFirst, uint64_t contextId) > HasStorageAccessForFrame(PAL::SessionID sessionID, String resourceDomain, String firstPartyDomain, uint64_t frameID, uint64_t pageID, uint64_t contextId) > GetAllStorageAccessEntries(PAL::SessionID sessionID, uint64_t contextId) > GrantStorageAccess(PAL::SessionID sessionID, String resourceDomain, String firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, uint64_t contextId) >- RemoveAllStorageAccess(PAL::SessionID sessionID) >+ RemoveAllStorageAccess(PAL::SessionID sessionID, uint64_t contextId) > RemovePrevalentDomains(PAL::SessionID sessionID, Vector<String> domainsWithInteraction); > #endif > >diff --git a/Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.cpp b/Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.cpp >index 8374dd3f94bbfab6965c1e8f92436b2acc18424f..4fe2f83f157f2ed17c221b349469263213b0fe58 100644 >--- a/Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.cpp >+++ b/Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.cpp >@@ -77,7 +77,6 @@ void NetworkProcessCreationParameters::encode(IPC::Encoder& encoder) const > encoder << httpProxy; > encoder << httpsProxy; > IPC::encode(encoder, networkATSContext.get()); >- encoder << cookieStoragePartitioningEnabled; > encoder << storageAccessAPIEnabled; > encoder << suppressesConnectionTerminationOnSystemChange; > #endif >@@ -198,8 +197,6 @@ bool NetworkProcessCreationParameters::decode(IPC::Decoder& decoder, NetworkProc > return false; > if (!IPC::decode(decoder, result.networkATSContext)) > return false; >- if (!decoder.decode(result.cookieStoragePartitioningEnabled)) >- return false; > if (!decoder.decode(result.storageAccessAPIEnabled)) > return false; > if (!decoder.decode(result.suppressesConnectionTerminationOnSystemChange)) >diff --git a/Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h b/Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h >index 6bfdaec8c04a3a0d594f62148b2efaa6f94b3156..12ffb5012a4d7fc94a66c750266bbb59d44b6c86 100644 >--- a/Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h >+++ b/Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h >@@ -90,7 +90,6 @@ struct NetworkProcessCreationParameters { > String httpProxy; > String httpsProxy; > RetainPtr<CFDataRef> networkATSContext; >- bool cookieStoragePartitioningEnabled; > bool storageAccessAPIEnabled; > bool suppressesConnectionTerminationOnSystemChange; > #endif >diff --git a/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp b/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp >index caa7cd5ebe8d5acc850177955e0fb5196e9a1a9c..1b1bf272a00b7694611d0edea8aab6733ab06924 100644 >--- a/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp >+++ b/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp >@@ -1008,21 +1008,21 @@ static void logBlockedCookieInformation(const String& label, const void* loggedO > #undef LOCAL_LOG_IF_ALLOWED > } > >-static void logCookieInformationInternal(const String& label, const void* loggedObject, const WebCore::NetworkStorageSession& networkStorageSession, const WebCore::URL& partition, const WebCore::SameSiteInfo& sameSiteInfo, const WebCore::URL& url, const String& referrer, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, std::optional<uint64_t> identifier) >+static void logCookieInformationInternal(const String& label, const void* loggedObject, const WebCore::NetworkStorageSession& networkStorageSession, const WebCore::URL& firstParty, const WebCore::SameSiteInfo& sameSiteInfo, const WebCore::URL& url, const String& referrer, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID, std::optional<uint64_t> identifier) > { > ASSERT(NetworkResourceLoader::shouldLogCookieInformation()); > > Vector<WebCore::Cookie> cookies; >- if (!networkStorageSession.getRawCookies(partition, sameSiteInfo, url, frameID, pageID, cookies)) >+ if (!networkStorageSession.getRawCookies(firstParty, sameSiteInfo, url, frameID, pageID, cookies)) > return; > > auto escapedURL = escapeForJSON(url.string()); >- auto escapedPartition = escapeForJSON(partition.string()); >+ auto escapedPartition = escapeForJSON(emptyString()); > auto escapedReferrer = escapeForJSON(referrer); > auto escapedFrameID = escapeIDForJSON(frameID); > auto escapedPageID = escapeIDForJSON(pageID); > auto escapedIdentifier = escapeIDForJSON(identifier); >- bool hasStorageAccess = (frameID && pageID) ? networkStorageSession.hasStorageAccess(url.string(), partition.string(), frameID.value(), pageID.value()) : false; >+ bool hasStorageAccess = (frameID && pageID) ? networkStorageSession.hasStorageAccess(url.string(), firstParty.string(), frameID.value(), pageID.value()) : false; > > #define LOCAL_LOG_IF_ALLOWED(fmt, ...) RELEASE_LOG_IF(networkStorageSession.sessionID().isAlwaysOnLoggingAllowed(), Network, "%p - %s::" fmt, loggedObject, label.utf8().data(), ##__VA_ARGS__) > #define LOCAL_LOG(str, ...) \ >@@ -1073,12 +1073,10 @@ void NetworkResourceLoader::logCookieInformation(const String& label, const void > { > ASSERT(shouldLogCookieInformation()); > >- if (networkStorageSession.shouldBlockCookies(firstParty, url)) >+ if (networkStorageSession.shouldBlockCookies(firstParty, url, frameID, pageID)) > logBlockedCookieInformation(label, loggedObject, networkStorageSession, firstParty, sameSiteInfo, url, referrer, frameID, pageID, identifier); >- else { >- auto partition = URL(ParsedURLString, networkStorageSession.cookieStoragePartition(firstParty, url, frameID, pageID)); >- logCookieInformationInternal(label, loggedObject, networkStorageSession, partition, sameSiteInfo, url, referrer, frameID, pageID, identifier); >- } >+ else >+ logCookieInformationInternal(label, loggedObject, networkStorageSession, firstParty, sameSiteInfo, url, referrer, frameID, pageID, identifier); > } > #endif > >diff --git a/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.h b/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.h >index 4fcdba42b5a3f1ef9f03852a6c17a3f6aaffc697..36aaf73d19c82432dc5fa41b5b476fe27da2d3b9 100644 >--- a/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.h >+++ b/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.h >@@ -92,7 +92,6 @@ private: > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) > static NSHTTPCookieStorage *statelessCookieStorage(); > void applyCookieBlockingPolicy(bool shouldBlock); >- void applyCookiePartitioningPolicy(const String& requiredStoragePartition, const String& currentStoragePartition); > #endif > bool isThirdPartyRequest(const WebCore::ResourceRequest&); > bool isAlwaysOnLoggingAllowed() const; >diff --git a/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm b/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm >index f0ebead80f8dfec133612a5a932420204bc4012b..cdcfeddb7fb33943fa39ebec1bda4c6c93feeb37 100644 >--- a/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm >+++ b/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm >@@ -151,18 +151,6 @@ void NetworkDataTaskCocoa::applyCookieBlockingPolicy(bool shouldBlock) > [m_task performSelector:NSSelectorFromString(@"_setExplicitCookieStorage:") withObject:(NSObject*)storage._cookieStorage]; > m_hasBeenSetToUseStatelessCookieStorage = shouldBlock; > } >- >-void NetworkDataTaskCocoa::applyCookiePartitioningPolicy(const String& requiredStoragePartition, const String& currentStoragePartition) >-{ >- // The need for a partion change is according to the following: >- // currentStoragePartition: null "" abc >- // requiredStoragePartition: "" false false true >- // abc true true false >- // xyz true true true >- auto shouldChangePartition = !((requiredStoragePartition.isEmpty() && currentStoragePartition.isEmpty()) || currentStoragePartition == requiredStoragePartition); >- if (shouldChangePartition) >- m_task.get()._storagePartitionIdentifier = requiredStoragePartition; >-} > #endif > > bool NetworkDataTaskCocoa::isThirdPartyRequest(const WebCore::ResourceRequest& request) >@@ -218,7 +206,7 @@ NetworkDataTaskCocoa::NetworkDataTaskCocoa(NetworkSession& session, NetworkDataT > > bool shouldBlockCookies = false; > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >- shouldBlockCookies = session.networkStorageSession().shouldBlockCookies(request); >+ shouldBlockCookies = session.networkStorageSession().shouldBlockCookies(request, frameID, pageID); > #endif > if (shouldBlockCookies || (m_session->sessionID().isEphemeral() && isThirdPartyRequest(request))) > request.setExistingHTTPReferrerToOriginString(); >@@ -252,24 +240,13 @@ NetworkDataTaskCocoa::NetworkDataTaskCocoa(NetworkSession& session, NetworkDataT > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) > if (shouldBlockCookies) { >-#if HAVE(CFNETWORK_STORAGE_PARTITIONING) && !RELEASE_LOG_DISABLED >+#if !RELEASE_LOG_DISABLED > if (NetworkProcess::singleton().shouldLogCookieInformation()) > RELEASE_LOG_IF(isAlwaysOnLoggingAllowed(), Network, "%p - NetworkDataTaskCocoa::logCookieInformation: pageID = %llu, frameID = %llu, taskID = %lu: Blocking cookies for URL %s", this, pageID, frameID, (unsigned long)[m_task taskIdentifier], nsRequest.URL.absoluteString.UTF8String); > #else > LOG(NetworkSession, "%llu Blocking cookies for URL %s", [m_task taskIdentifier], nsRequest.URL.absoluteString.UTF8String); > #endif > applyCookieBlockingPolicy(shouldBlockCookies); >- } else { >- auto storagePartition = session.networkStorageSession().cookieStoragePartition(request, m_frameID, m_pageID); >- if (!storagePartition.isEmpty()) { >-#if HAVE(CFNETWORK_STORAGE_PARTITIONING) && !RELEASE_LOG_DISABLED >- if (NetworkProcess::singleton().shouldLogCookieInformation()) >- RELEASE_LOG_IF(isAlwaysOnLoggingAllowed(), Network, "%p - NetworkDataTaskCocoa::logCookieInformation: pageID = %llu, frameID = %llu, taskID = %lu: Partitioning cookies for URL %s", this, pageID, frameID, (unsigned long)[m_task taskIdentifier], nsRequest.URL.absoluteString.UTF8String); >-#else >- LOG(NetworkSession, "%llu Partitioning cookies for URL %s", [m_task taskIdentifier], nsRequest.URL.absoluteString.UTF8String); >-#endif >- applyCookiePartitioningPolicy(storagePartition, emptyString()); >- } > } > #endif > >@@ -379,7 +356,7 @@ void NetworkDataTaskCocoa::willPerformHTTPRedirection(WebCore::ResourceResponse& > > bool shouldBlockCookies = false; > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >- shouldBlockCookies = m_session->networkStorageSession().shouldBlockCookies(request); >+ shouldBlockCookies = m_session->networkStorageSession().shouldBlockCookies(request, m_frameID, m_pageID); > #if !RELEASE_LOG_DISABLED > if (NetworkProcess::singleton().shouldLogCookieInformation()) > RELEASE_LOG_IF(isAlwaysOnLoggingAllowed(), Network, "%p - NetworkDataTaskCocoa::willPerformHTTPRedirection::logCookieInformation: pageID = %llu, frameID = %llu, taskID = %lu: %s cookies for redirect URL %s", this, m_pageID, m_frameID, (unsigned long)[m_task taskIdentifier], (shouldBlockCookies ? "Blocking" : "Not blocking"), request.url().string().utf8().data()); >@@ -396,14 +373,12 @@ void NetworkDataTaskCocoa::willPerformHTTPRedirection(WebCore::ResourceResponse& > applyCookieBlockingPolicy(shouldBlockCookies); > > if (!shouldBlockCookies) { >- auto requiredStoragePartition = m_session->networkStorageSession().cookieStoragePartition(request, m_frameID, m_pageID); > #if !RELEASE_LOG_DISABLED > if (NetworkProcess::singleton().shouldLogCookieInformation()) >- RELEASE_LOG_IF(isAlwaysOnLoggingAllowed(), Network, "%p - NetworkDataTaskCocoa::willPerformHTTPRedirection::logCookieInformation: pageID = %llu, frameID = %llu, taskID = %lu: %s cookies for redirect URL %s", this, m_pageID, m_frameID, (unsigned long)[m_task taskIdentifier], (requiredStoragePartition.isEmpty() ? "Not partitioning" : "Partitioning"), request.url().string().utf8().data()); >+ RELEASE_LOG_IF(isAlwaysOnLoggingAllowed(), Network, "%p - NetworkDataTaskCocoa::willPerformHTTPRedirection::logCookieInformation: pageID = %llu, frameID = %llu, taskID = %lu: Not partitioning cookies for redirect URL %s", this, m_pageID, m_frameID, (unsigned long)[m_task taskIdentifier], request.url().string().utf8().data()); > #else >- LOG(NetworkSession, "%llu %s cookies for redirect URL %s", [m_task taskIdentifier], (requiredStoragePartition.isEmpty() ? "Not partitioning" : "Partitioning"), request.url().string().utf8().data()); >+ LOG(NetworkSession, "%llu Not partitioning cookies for redirect URL %s", [m_task taskIdentifier], request.url().string().utf8().data()); > #endif >- applyCookiePartitioningPolicy(requiredStoragePartition, m_task.get()._storagePartitionIdentifier); > } > #endif > >diff --git a/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm b/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm >index 39f0011505cc3ada8e6bf666ccff50acdf4ee214..e316cefcd71956fe334dcb6d9ce3be59baca08b3 100644 >--- a/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm >+++ b/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm >@@ -99,7 +99,6 @@ void NetworkProcess::platformInitializeNetworkProcessCocoa(const NetworkProcessC > setSharedHTTPCookieStorage(parameters.uiProcessCookieStorageIdentifier); > #endif > >- WebCore::NetworkStorageSession::setCookieStoragePartitioningEnabled(parameters.cookieStoragePartitioningEnabled); > WebCore::NetworkStorageSession::setStorageAccessAPIEnabled(parameters.storageAccessAPIEnabled); > m_suppressesConnectionTerminationOnSystemChange = parameters.suppressesConnectionTerminationOnSystemChange; > >@@ -200,11 +199,6 @@ void NetworkProcess::setSharedHTTPCookieStorage(const Vector<uint8_t>& identifie > } > #endif > >-void NetworkProcess::setCookieStoragePartitioningEnabled(bool enabled) >-{ >- WebCore::NetworkStorageSession::setCookieStoragePartitioningEnabled(enabled); >-} >- > void NetworkProcess::setStorageAccessAPIEnabled(bool enabled) > { > WebCore::NetworkStorageSession::setStorageAccessAPIEnabled(enabled); >diff --git a/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm b/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm >index 9993a464ba8822f5e9682a4c85a1369db68eb470..1133403d50df2628877c35ff4ab2d51ad0d0ade4 100644 >--- a/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm >+++ b/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm >@@ -239,7 +239,7 @@ - (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task willPer > > bool shouldIgnoreHSTS = false; > #if USE(CFNETWORK_IGNORE_HSTS) >- shouldIgnoreHSTS = schemeWasUpgradedDueToDynamicHSTS(request) && WebCore::NetworkStorageSession::storageSession(_session->sessionID())->shouldBlockCookies(request); >+ shouldIgnoreHSTS = schemeWasUpgradedDueToDynamicHSTS(request) && WebCore::NetworkStorageSession::storageSession(_session->sessionID())->shouldBlockCookies(request, networkDataTask->frameID(), networkDataTask->pageID()); > if (shouldIgnoreHSTS) { > request = downgradeRequest(request); > ASSERT([request.URL.scheme isEqualToString:@"http"]); >@@ -272,7 +272,7 @@ - (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask*)task _schemeU > if (auto* networkDataTask = [self existingTask:task]) { > bool shouldIgnoreHSTS = false; > #if USE(CFNETWORK_IGNORE_HSTS) >- shouldIgnoreHSTS = schemeWasUpgradedDueToDynamicHSTS(request) && WebCore::NetworkStorageSession::storageSession(_session->sessionID())->shouldBlockCookies(request); >+ shouldIgnoreHSTS = schemeWasUpgradedDueToDynamicHSTS(request) && WebCore::NetworkStorageSession::storageSession(_session->sessionID())->shouldBlockCookies(request, networkDataTask->frameID(), networkDataTask->pageID()); > if (shouldIgnoreHSTS) { > request = downgradeRequest(request); > ASSERT([request.URL.scheme isEqualToString:@"http"]); >diff --git a/Source/WebKit/UIProcess/API/C/WKCookieManager.cpp b/Source/WebKit/UIProcess/API/C/WKCookieManager.cpp >index 1cc75a05e97a4c25bce21d02e97886c588e85683..490f3458ef80d4692c88f15a6a74cce743b64603 100644 >--- a/Source/WebKit/UIProcess/API/C/WKCookieManager.cpp >+++ b/Source/WebKit/UIProcess/API/C/WKCookieManager.cpp >@@ -72,11 +72,6 @@ void WKCookieManagerGetHTTPCookieAcceptPolicy(WKCookieManagerRef cookieManager, > toImpl(cookieManager)->getHTTPCookieAcceptPolicy(PAL::SessionID::defaultSessionID(), toGenericCallbackFunction<WKHTTPCookieAcceptPolicy, HTTPCookieAcceptPolicy>(context, callback)); > } > >-void WKCookieManagerSetCookieStoragePartitioningEnabled(WKCookieManagerRef cookieManager, bool enabled) >-{ >- toImpl(cookieManager)->setCookieStoragePartitioningEnabled(enabled); >-} >- > void WKCookieManagerSetStorageAccessAPIEnabled(WKCookieManagerRef cookieManager, bool enabled) > { > toImpl(cookieManager)->setStorageAccessAPIEnabled(enabled); >diff --git a/Source/WebKit/UIProcess/API/C/WKCookieManager.h b/Source/WebKit/UIProcess/API/C/WKCookieManager.h >index 34fa8258183df46a155eaa921aeeda8da1cb0c86..c6514e3fa07b3e238b04c4b9eb009ce8ee1bf93d 100644 >--- a/Source/WebKit/UIProcess/API/C/WKCookieManager.h >+++ b/Source/WebKit/UIProcess/API/C/WKCookieManager.h >@@ -72,7 +72,6 @@ WK_EXPORT void WKCookieManagerSetHTTPCookieAcceptPolicy(WKCookieManagerRef cooki > typedef void (*WKCookieManagerGetHTTPCookieAcceptPolicyFunction)(WKHTTPCookieAcceptPolicy, WKErrorRef, void*); > WK_EXPORT void WKCookieManagerGetHTTPCookieAcceptPolicy(WKCookieManagerRef cookieManager, void* context, WKCookieManagerGetHTTPCookieAcceptPolicyFunction callback); > >-WK_EXPORT void WKCookieManagerSetCookieStoragePartitioningEnabled(WKCookieManagerRef cookieManager, bool enabled); > WK_EXPORT void WKCookieManagerSetStorageAccessAPIEnabled(WKCookieManagerRef cookieManager, bool enabled); > > WK_EXPORT void WKCookieManagerStartObservingCookieChanges(WKCookieManagerRef cookieManager); >diff --git a/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp b/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp >index 073c10fd1b5ffdea7533caf006d7a471c12b86f5..4d84bcefab39b52bee825c1b9c97fd1aeccd8e98 100644 >--- a/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp >+++ b/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp >@@ -213,19 +213,6 @@ void WKWebsiteDataStoreSetStatisticsHasHadUserInteraction(WKWebsiteDataStoreRef > }); > } > >-void WKWebsiteDataStoreSetStatisticsHasHadNonRecentUserInteraction(WKWebsiteDataStoreRef dataStoreRef, WKStringRef host, void* context, WKWebsiteDataStoreStatisticsHasHadNonRecentUserInteractionFunction completionHandler) >-{ >- auto* store = WebKit::toImpl(dataStoreRef)->websiteDataStore().resourceLoadStatistics(); >- if (!store) { >- completionHandler(context); >- return; >- } >- >- store->logNonRecentUserInteraction(WebCore::URL(WebCore::URL(), WebKit::toImpl(host)->string()), [context, completionHandler] { >- completionHandler(context); >- }); >-} >- > void WKWebsiteDataStoreIsStatisticsHasHadUserInteraction(WKWebsiteDataStoreRef dataStoreRef, WKStringRef host, void* context, WKWebsiteDataStoreIsStatisticsHasHadUserInteractionFunction callback) > { > auto* store = WebKit::toImpl(dataStoreRef)->websiteDataStore().resourceLoadStatistics(); >@@ -324,15 +311,6 @@ void WKWebsiteDataStoreSetStatisticsTimeToLiveUserInteraction(WKWebsiteDataStore > store->setTimeToLiveUserInteraction(Seconds { seconds }); > } > >-void WKWebsiteDataStoreSetStatisticsTimeToLiveCookiePartitionFree(WKWebsiteDataStoreRef dataStoreRef, double seconds) >-{ >- auto* store = WebKit::toImpl(dataStoreRef)->websiteDataStore().resourceLoadStatistics(); >- if (!store) >- return; >- >- store->setTimeToLiveCookiePartitionFree(Seconds { seconds }); >-} >- > void WKWebsiteDataStoreStatisticsProcessStatisticsAndDataRecords(WKWebsiteDataStoreRef dataStoreRef) > { > auto* store = WebKit::toImpl(dataStoreRef)->websiteDataStore().resourceLoadStatistics(); >@@ -342,37 +320,19 @@ void WKWebsiteDataStoreStatisticsProcessStatisticsAndDataRecords(WKWebsiteDataSt > store->scheduleStatisticsAndDataRecordsProcessing(); > } > >-void WKWebsiteDataStoreStatisticsUpdateCookiePartitioning(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreStatisticsUpdateCookiePartitioningFunction callback) >+void WKWebsiteDataStoreStatisticsUpdateCookieBlocking(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreStatisticsUpdateCookieBlockingFunction completionHandler) > { > auto* store = WebKit::toImpl(dataStoreRef)->websiteDataStore().resourceLoadStatistics(); > if (!store) { >- callback(context); >+ completionHandler(context); > return; > } > >- store->scheduleCookiePartitioningUpdate([context, callback]() { >- callback(context); >+ store->scheduleCookieBlockingUpdate([context, completionHandler]() { >+ completionHandler(context); > }); > } > >-void WKWebsiteDataStoreSetStatisticsShouldPartitionCookiesForHost(WKWebsiteDataStoreRef dataStoreRef, WKStringRef host, bool value, void* context, WKWebsiteDataStoreSetStatisticsShouldPartitionCookiesForHostFunction callback) >-{ >- auto* store = WebKit::toImpl(dataStoreRef)->websiteDataStore().resourceLoadStatistics(); >- if (!store) { >- callback(context); >- return; >- } >- >- if (value) >- store->scheduleCookiePartitioningUpdateForDomains({ WebKit::toImpl(host)->string() }, { }, { }, WebKit::ShouldClearFirst::No, [context, callback]() { >- callback(context); >- }); >- else >- store->scheduleClearPartitioningStateForDomains({ WebKit::toImpl(host)->string() }, [context, callback]() { >- callback(context); >- }); >-} >- > void WKWebsiteDataStoreStatisticsSubmitTelemetry(WKWebsiteDataStoreRef dataStoreRef) > { > auto* store = WebKit::toImpl(dataStoreRef)->websiteDataStore().resourceLoadStatistics(); >diff --git a/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h b/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h >index 50338b0b9b24bd94008bbade1a31ec57ba49d07d..8d01963c991f291c5e35b25d322216d62384bda2 100644 >--- a/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h >+++ b/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h >@@ -58,8 +58,6 @@ typedef void (*WKWebsiteDataStoreIsStatisticsRegisteredAsRedirectingToFunction)( > WK_EXPORT void WKWebsiteDataStoreIsStatisticsRegisteredAsRedirectingTo(WKWebsiteDataStoreRef dataStoreRef, WKStringRef hostRedirectedFrom, WKStringRef hostRedirectedTo, void* context, WKWebsiteDataStoreIsStatisticsRegisteredAsRedirectingToFunction callback); > typedef void (*WKWebsiteDataStoreStatisticsHasHadUserInteractionFunction)(void* functionContext); > WK_EXPORT void WKWebsiteDataStoreSetStatisticsHasHadUserInteraction(WKWebsiteDataStoreRef dataStoreRef, WKStringRef host, bool value, void* context, WKWebsiteDataStoreStatisticsHasHadUserInteractionFunction completionHandler); >-typedef void (*WKWebsiteDataStoreStatisticsHasHadNonRecentUserInteractionFunction)(void* functionContext); >-WK_EXPORT void WKWebsiteDataStoreSetStatisticsHasHadNonRecentUserInteraction(WKWebsiteDataStoreRef dataStoreRef, WKStringRef host, void* context, WKWebsiteDataStoreStatisticsHasHadNonRecentUserInteractionFunction completionHandler); > typedef void (*WKWebsiteDataStoreIsStatisticsHasHadUserInteractionFunction)(bool hasHadUserInteraction, void* functionContext); > WK_EXPORT void WKWebsiteDataStoreIsStatisticsHasHadUserInteraction(WKWebsiteDataStoreRef dataStoreRef, WKStringRef host, void* context, WKWebsiteDataStoreIsStatisticsHasHadUserInteractionFunction callback); > WK_EXPORT void WKWebsiteDataStoreSetStatisticsGrandfathered(WKWebsiteDataStoreRef dataStoreRef, WKStringRef host, bool value); >@@ -72,12 +70,9 @@ WK_EXPORT void WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectFrom(WKWe > WK_EXPORT void WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectTo(WKWebsiteDataStoreRef dataStoreRef, WKStringRef host, WKStringRef hostRedirectedTo); > WK_EXPORT void WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectFrom(WKWebsiteDataStoreRef dataStoreRef, WKStringRef host, WKStringRef hostRedirectedFrom); > WK_EXPORT void WKWebsiteDataStoreSetStatisticsTimeToLiveUserInteraction(WKWebsiteDataStoreRef dataStoreRef, double seconds); >-WK_EXPORT void WKWebsiteDataStoreSetStatisticsTimeToLiveCookiePartitionFree(WKWebsiteDataStoreRef dataStoreRef, double seconds); > WK_EXPORT void WKWebsiteDataStoreStatisticsProcessStatisticsAndDataRecords(WKWebsiteDataStoreRef dataStoreRef); >-typedef void (*WKWebsiteDataStoreStatisticsUpdateCookiePartitioningFunction)(void* functionContext); >-WK_EXPORT void WKWebsiteDataStoreStatisticsUpdateCookiePartitioning(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreStatisticsUpdateCookiePartitioningFunction callback); >-typedef void (*WKWebsiteDataStoreSetStatisticsShouldPartitionCookiesForHostFunction)(void* functionContext); >-WK_EXPORT void WKWebsiteDataStoreSetStatisticsShouldPartitionCookiesForHost(WKWebsiteDataStoreRef dataStoreRef, WKStringRef host, bool value, void* context, WKWebsiteDataStoreSetStatisticsShouldPartitionCookiesForHostFunction callback); >+typedef void (*WKWebsiteDataStoreStatisticsUpdateCookieBlockingFunction)(void* functionContext); >+WK_EXPORT void WKWebsiteDataStoreStatisticsUpdateCookieBlocking(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreStatisticsUpdateCookieBlockingFunction completionHandler); > WK_EXPORT void WKWebsiteDataStoreStatisticsSubmitTelemetry(WKWebsiteDataStoreRef dataStoreRef); > WK_EXPORT void WKWebsiteDataStoreSetStatisticsNotifyPagesWhenDataRecordsWereScanned(WKWebsiteDataStoreRef dataStoreRef, bool value); > WK_EXPORT void WKWebsiteDataStoreSetStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(WKWebsiteDataStoreRef dataStoreRef, bool value); >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h b/Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h >index 0f7ebd21c15b1bf3b6e6b85cf6248842b46d22b2..6d4b067f5be6cc92193ed5f1cd498c99a6bfcf0a 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h >@@ -112,7 +112,7 @@ > - (void)_registerURLSchemeServiceWorkersCanHandle:(NSString *)scheme WK_API_AVAILABLE(macosx(10.13.4), ios(11.3)); > - (void)_setMaximumNumberOfProcesses:(NSUInteger)value WK_API_AVAILABLE(macosx(10.13.4), ios(11.3)); > >-@property (nonatomic, getter=_isCookieStoragePartitioningEnabled, setter=_setCookieStoragePartitioningEnabled:) BOOL _cookieStoragePartitioningEnabled WK_API_AVAILABLE(macosx(10.12.3), ios(10.3)); >+@property (nonatomic, getter=_isCookieStoragePartitioningEnabled, setter=_setCookieStoragePartitioningEnabled:) BOOL _cookieStoragePartitioningEnabled WK_API_DEPRECATED("Partitioned cookies are no longer supported", macosx(10.12.3, WK_MAC_TBA), ios(10.3, WK_IOS_TBA)); > @property (nonatomic, getter=_isStorageAccessAPIEnabled, setter=_setStorageAccessAPIEnabled:) BOOL _storageAccessAPIEnabled WK_API_AVAILABLE(macosx(10.13.4), ios(11.3)); > > @end >diff --git a/Source/WebKit/UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm b/Source/WebKit/UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm >index 634582903e5cc2d1f630dd5dc75bbd91b4ded0ef..bfeedf94caaf3da6fdbd2aa631fb8fc5e456719f 100644 >--- a/Source/WebKit/UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm >+++ b/Source/WebKit/UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm >@@ -38,10 +38,6 @@ void ResourceLoadStatisticsMemoryStore::registerUserDefaultsIfNeeded() > if (timeToLiveUserInteraction > 0_s && timeToLiveUserInteraction <= 24_h * 30) > setTimeToLiveUserInteraction(timeToLiveUserInteraction); > >- Seconds timeToLiveCookiePartitionFree([[NSUserDefaults standardUserDefaults] doubleForKey:@"ResourceLoadStatisticsTimeToLiveCookiePartitionFree"]); >- if (timeToLiveCookiePartitionFree > 0_s && timeToLiveCookiePartitionFree <= 24_h) >- setTimeToLiveCookiePartitionFree(timeToLiveCookiePartitionFree); >- > Seconds minimumTimeBetweenDataRecordsRemoval([[NSUserDefaults standardUserDefaults] doubleForKey:@"ResourceLoadStatisticsMinimumTimeBetweenDataRecordsRemoval"]); > if (minimumTimeBetweenDataRecordsRemoval > 0_s && minimumTimeBetweenDataRecordsRemoval < 1_h) > setMinimumTimeBetweenDataRecordsRemoval(minimumTimeBetweenDataRecordsRemoval); >diff --git a/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm b/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm >index 0370afc98f5c1b1bc493c0707c8b734e43b3f1f1..e2b0119f193694b9ff0bd4806adbeefdf1533a79 100644 >--- a/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm >+++ b/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm >@@ -315,7 +315,6 @@ void WebProcessPool::platformInitializeNetworkProcess(NetworkProcessCreationPara > parameters.uiProcessCookieStorageIdentifier = identifyingDataFromCookieStorage([[NSHTTPCookieStorage sharedHTTPCookieStorage] _cookieStorage]); > #endif > >- parameters.cookieStoragePartitioningEnabled = cookieStoragePartitioningEnabled(); > parameters.storageAccessAPIEnabled = storageAccessAPIEnabled(); > parameters.suppressesConnectionTerminationOnSystemChange = m_configuration->suppressesConnectionTerminationOnSystemChange(); > >@@ -615,10 +614,10 @@ void WebProcessPool::resetHSTSHostsAddedAfterDate(double startDateIntervalSince1 > _CFNetworkResetHSTSHostsSinceDate(privateBrowsingSession(), (__bridge CFDateRef)startDate); > } > >+// FIXME: Deprecated. Left here until a final decision is made. > void WebProcessPool::setCookieStoragePartitioningEnabled(bool enabled) > { > m_cookieStoragePartitioningEnabled = enabled; >- sendToNetworkingProcess(Messages::NetworkProcess::SetCookieStoragePartitioningEnabled(enabled)); > } > > void WebProcessPool::setStorageAccessAPIEnabled(bool enabled) >diff --git a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp >index 27622147248f5481789c1ee0b676f36886c024c8..32430e8a81614f04ffaf5ebd2544c8e7c3dcd9c2 100644 >--- a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp >+++ b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp >@@ -221,8 +221,8 @@ void NetworkProcessProxy::clearCallbackStates() > while (!m_pendingDeleteWebsiteDataForOriginsCallbacks.isEmpty()) > m_pendingDeleteWebsiteDataForOriginsCallbacks.take(m_pendingDeleteWebsiteDataForOriginsCallbacks.begin()->key)(); > >- while (!m_updatePartitionOrBlockCookiesCallbackMap.isEmpty()) >- m_updatePartitionOrBlockCookiesCallbackMap.take(m_updatePartitionOrBlockCookiesCallbackMap.begin()->key)(); >+ while (!m_updateBlockCookiesCallbackMap.isEmpty()) >+ m_updateBlockCookiesCallbackMap.take(m_updateBlockCookiesCallbackMap.begin()->key)(); > > while (!m_storageAccessResponseCallbackMap.isEmpty()) > m_storageAccessResponseCallbackMap.take(m_storageAccessResponseCallbackMap.begin()->key)(false); >@@ -424,24 +424,24 @@ void NetworkProcessProxy::canAuthenticateAgainstProtectionSpace(uint64_t loaderI > #endif > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >-void NetworkProcessProxy::updatePrevalentDomainsToPartitionOrBlockCookies(PAL::SessionID sessionID, const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst shouldClearFirst, CompletionHandler<void()>&& callback) >+void NetworkProcessProxy::updatePrevalentDomainsToBlockCookiesFor(PAL::SessionID sessionID, const Vector<String>& domainsToBlock, ShouldClearFirst shouldClearFirst, CompletionHandler<void()>&& completionHandler) > { > if (!canSendMessage()) { >- callback(); >+ completionHandler(); > return; > } > > auto callbackId = generateCallbackID(); >- auto addResult = m_updatePartitionOrBlockCookiesCallbackMap.add(callbackId, [protectedThis = makeRef(*this), token = throttler().backgroundActivityToken(), callback = WTFMove(callback)] () mutable { >- callback(); >+ auto addResult = m_updateBlockCookiesCallbackMap.add(callbackId, [protectedThis = makeRef(*this), token = throttler().backgroundActivityToken(), completionHandler = WTFMove(completionHandler)]() mutable { >+ completionHandler(); > }); > ASSERT_UNUSED(addResult, addResult.isNewEntry); >- send(Messages::NetworkProcess::UpdatePrevalentDomainsToPartitionOrBlockCookies(sessionID, domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, shouldClearFirst == ShouldClearFirst::Yes, callbackId), 0); >+ send(Messages::NetworkProcess::UpdatePrevalentDomainsToBlockCookiesFor(sessionID, domainsToBlock, shouldClearFirst == ShouldClearFirst::Yes, callbackId), 0); > } > >-void NetworkProcessProxy::didUpdatePartitionOrBlockCookies(uint64_t callbackId) >+void NetworkProcessProxy::didUpdateBlockCookies(uint64_t callbackId) > { >- m_updatePartitionOrBlockCookiesCallbackMap.take(callbackId)(); >+ m_updateBlockCookiesCallbackMap.take(callbackId)(); > } > > static uint64_t nextRequestStorageAccessContextId() >@@ -466,18 +466,31 @@ void NetworkProcessProxy::grantStorageAccess(PAL::SessionID sessionID, const Str > send(Messages::NetworkProcess::GrantStorageAccess(sessionID, resourceDomain, firstPartyDomain, frameID, pageID, contextId), 0); > } > >-void NetworkProcessProxy::removeAllStorageAccess(PAL::SessionID sessionID) >-{ >- if (canSendMessage()) >- send(Messages::NetworkProcess::RemoveAllStorageAccess(sessionID), 0); >-} >- > void NetworkProcessProxy::storageAccessRequestResult(bool wasGranted, uint64_t contextId) > { > auto callback = m_storageAccessResponseCallbackMap.take(contextId); > callback(wasGranted); > } > >+void NetworkProcessProxy::removeAllStorageAccess(PAL::SessionID sessionID, CompletionHandler<void()>&& completionHandler) >+{ >+ if (!canSendMessage()) { >+ completionHandler(); >+ return; >+ } >+ >+ auto contextId = nextRequestStorageAccessContextId(); >+ auto addResult = m_removeAllStorageAccessCallbackMap.add(contextId, WTFMove(completionHandler)); >+ ASSERT_UNUSED(addResult, addResult.isNewEntry); >+ send(Messages::NetworkProcess::RemoveAllStorageAccess(sessionID, contextId), 0); >+} >+ >+void NetworkProcessProxy::didRemoveAllStorageAccess(uint64_t contextId) >+{ >+ auto completionHandler = m_removeAllStorageAccessCallbackMap.take(contextId); >+ completionHandler(); >+} >+ > void NetworkProcessProxy::getAllStorageAccessEntries(PAL::SessionID sessionID, CompletionHandler<void(Vector<String>&& domains)>&& callback) > { > auto contextId = nextRequestStorageAccessContextId(); >diff --git a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h >index 2fa9b1bce3f7c8f0123a301e6039ca67fd732a16..c314cd6cc660ad3f219b13dc31581715218d6ba9 100644 >--- a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h >+++ b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h >@@ -78,11 +78,11 @@ public: > void deleteWebsiteDataForOrigins(PAL::SessionID, OptionSet<WebKit::WebsiteDataType>, const Vector<WebCore::SecurityOriginData>& origins, const Vector<String>& cookieHostNames, const Vector<String>& HSTSCacheHostNames, CompletionHandler<void()>&&); > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >- void updatePrevalentDomainsToPartitionOrBlockCookies(PAL::SessionID, const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst, CompletionHandler<void()>&&); >+ void updatePrevalentDomainsToBlockCookiesFor(PAL::SessionID, const Vector<String>& domainsToBlock, ShouldClearFirst, CompletionHandler<void()>&&); > void hasStorageAccessForFrame(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& 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 removeAllStorageAccess(PAL::SessionID); >+ void removeAllStorageAccess(PAL::SessionID, CompletionHandler<void()>&&); > #endif > > void writeBlobToFilePath(const WebCore::URL&, const String& path, CompletionHandler<void(bool)>&& callback); >@@ -147,9 +147,10 @@ private: > void canAuthenticateAgainstProtectionSpace(uint64_t loaderID, uint64_t pageID, uint64_t frameID, const WebCore::ProtectionSpace&); > #endif > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >- void didUpdatePartitionOrBlockCookies(uint64_t callbackId); >+ void didUpdateBlockCookies(uint64_t contextId); > void storageAccessRequestResult(bool wasGranted, uint64_t contextId); > void allStorageAccessEntriesResult(Vector<String>&& domains, uint64_t contextId); >+ void didRemoveAllStorageAccess(uint64_t contextId); > #endif > void retrieveCacheStorageParameters(PAL::SessionID); > >@@ -180,8 +181,9 @@ private: > unsigned m_syncAllCookiesCounter { 0 }; > > HashMap<uint64_t, CompletionHandler<void(bool success)>> m_writeBlobToFilePathCallbackMap; >- HashMap<uint64_t, CompletionHandler<void()>> m_updatePartitionOrBlockCookiesCallbackMap; >+ HashMap<uint64_t, CompletionHandler<void()>> m_updateBlockCookiesCallbackMap; > HashMap<uint64_t, CompletionHandler<void(bool wasGranted)>> m_storageAccessResponseCallbackMap; >+ HashMap<uint64_t, CompletionHandler<void()>> m_removeAllStorageAccessCallbackMap; > HashMap<uint64_t, CompletionHandler<void(Vector<String>&& domains)>> m_allStorageAccessEntriesCallbackMap; > > #if ENABLE(CONTENT_EXTENSIONS) >diff --git a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in >index b1ba92959b88ce8f3ff3e90acac070c380ec0efc..0c4de33351601c94b4e0f43a1349791cc4993c55 100644 >--- a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in >+++ b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in >@@ -47,9 +47,10 @@ messages -> NetworkProcessProxy LegacyReceiver { > CanAuthenticateAgainstProtectionSpace(uint64_t loaderID, uint64_t pageID, uint64_t frameID, WebCore::ProtectionSpace protectionSpace) > #endif > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >- DidUpdatePartitionOrBlockCookies(uint64_t callbackId) >+ DidUpdateBlockCookies(uint64_t callbackId) > StorageAccessRequestResult(bool wasGranted, uint64_t contextId) > AllStorageAccessEntriesResult(Vector<String> domains, uint64_t contextId) >+ DidRemoveAllStorageAccess(uint64_t contextId) > #endif > #if ENABLE(CONTENT_EXTENSIONS) > ContentExtensionRules(WebKit::UserContentControllerIdentifier identifier) >diff --git a/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp b/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp >index 9ea40112aa8e5a07e4a4b6e9a70c7965c859d838..348cacd3be5115cd797ced8856ee546a31faf007 100644 >--- a/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp >+++ b/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp >@@ -35,6 +35,7 @@ > #include "WebsiteDataStore.h" > #include <WebCore/KeyedCoding.h> > #include <WebCore/ResourceLoadStatistics.h> >+#include <wtf/CallbackAggregator.h> > #include <wtf/DateMath.h> > #include <wtf/MathExtras.h> > >@@ -377,12 +378,12 @@ void ResourceLoadStatisticsMemoryStore::hasStorageAccess(const String& subFrameP > ASSERT(!RunLoop::isMain()); > > auto& subFrameStatistic = ensureResourceStatisticsForPrimaryDomain(subFramePrimaryDomain); >- if (shouldBlockCookies(subFrameStatistic)) { >+ if (shouldBlockAndPurgeCookies(subFrameStatistic)) { > completionHandler(false); > return; > } > >- if (!shouldPartitionCookies(subFrameStatistic)) { >+ if (!shouldBlockAndKeepCookies(subFrameStatistic)) { > completionHandler(true); > return; > } >@@ -401,17 +402,17 @@ void ResourceLoadStatisticsMemoryStore::requestStorageAccess(String&& subFramePr > ASSERT(!RunLoop::isMain()); > > auto& subFrameStatistic = ensureResourceStatisticsForPrimaryDomain(subFramePrimaryDomain); >- if (shouldBlockCookies(subFrameStatistic)) { >+ if (shouldBlockAndPurgeCookies(subFrameStatistic)) { > #if !RELEASE_LOG_DISABLED >- RELEASE_LOG_INFO_IF(m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "Cannot grant storage access to %{public}s since its cookies are blocked in third-party contexts.", subFramePrimaryDomain.utf8().data()); >+ RELEASE_LOG_INFO_IF(m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "Cannot grant storage access to %{public}s since its cookies are blocked in third-party contexts and it has not received user interaction as first-party.", subFramePrimaryDomain.utf8().data()); > #endif > completionHandler(StorageAccessStatus::CannotRequestAccess); > return; > } > >- if (!shouldPartitionCookies(subFrameStatistic)) { >+ if (!shouldBlockAndKeepCookies(subFrameStatistic)) { > #if !RELEASE_LOG_DISABLED >- RELEASE_LOG_INFO_IF(m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "No need to grant storage access to %{public}s since its cookies are neither blocked nor partitioned in third-party contexts.", subFramePrimaryDomain.utf8().data()); >+ RELEASE_LOG_INFO_IF(m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "No need to grant storage access to %{public}s since its cookies are not blocked in third-party contexts.", subFramePrimaryDomain.utf8().data()); > #endif > completionHandler(StorageAccessStatus::HasAccess); > return; >@@ -446,14 +447,14 @@ void ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener(String&& > return; > > auto& domainInNeedOfStorageAccessStatistic = ensureResourceStatisticsForPrimaryDomain(primaryDomainInNeedOfStorageAccess); >- auto cookiesBlocked = shouldBlockCookies(domainInNeedOfStorageAccessStatistic); >+ auto cookiesBlockedAndPurged = shouldBlockAndPurgeCookies(domainInNeedOfStorageAccessStatistic); > > // There are no cookies to get access to if the domain has its cookies blocked and did not get user interaction now. >- if (cookiesBlocked && !isTriggeredByUserGesture) >+ if (cookiesBlockedAndPurged && !isTriggeredByUserGesture) > return; > >- // The domain already has access if its cookies are neither blocked nor partitioned. >- if (!cookiesBlocked && !shouldPartitionCookies(domainInNeedOfStorageAccessStatistic)) >+ // The domain already has access if its cookies are not blocked. >+ if (!cookiesBlockedAndPurged && !shouldBlockAndKeepCookies(domainInNeedOfStorageAccessStatistic)) > return; > > #if !RELEASE_LOG_DISABLED >@@ -589,7 +590,7 @@ void ResourceLoadStatisticsMemoryStore::scheduleStatisticsProcessingRequestIfNec > return; > } > >- updateCookiePartitioning([]() { }); >+ updateCookieBlocking([]() { }); > processStatisticsAndDataRecords(); > }); > } >@@ -642,20 +643,6 @@ void ResourceLoadStatisticsMemoryStore::logUserInteraction(const String& primary > auto& statistics = ensureResourceStatisticsForPrimaryDomain(primaryDomain); > statistics.hadUserInteraction = true; > statistics.mostRecentUserInteractionTime = WallTime::now(); >- >- if (statistics.isMarkedForCookieBlocking) >- updateCookiePartitioningForDomains({ primaryDomain }, { }, { }, ShouldClearFirst::No, []() { }); >-} >- >-void ResourceLoadStatisticsMemoryStore::logNonRecentUserInteraction(const String& primaryDomain) >-{ >- ASSERT(!RunLoop::isMain()); >- >- auto& statistics = ensureResourceStatisticsForPrimaryDomain(primaryDomain); >- statistics.hadUserInteraction = true; >- statistics.mostRecentUserInteractionTime = WallTime::now() - (m_parameters.timeToLiveCookiePartitionFree + Seconds::fromHours(1)); >- >- updateCookiePartitioningForDomains({ primaryDomain }, { }, { }, ShouldClearFirst::No, []() { }); > } > > void ResourceLoadStatisticsMemoryStore::clearUserInteraction(const String& primaryDomain) >@@ -817,14 +804,6 @@ void ResourceLoadStatisticsMemoryStore::setTimeToLiveUserInteraction(Seconds sec > m_parameters.timeToLiveUserInteraction = seconds; > } > >-void ResourceLoadStatisticsMemoryStore::setTimeToLiveCookiePartitionFree(Seconds seconds) >-{ >- ASSERT(!RunLoop::isMain()); >- ASSERT(seconds >= 0_s); >- >- m_parameters.timeToLiveCookiePartitionFree = seconds; >-} >- > void ResourceLoadStatisticsMemoryStore::setMinimumTimeBetweenDataRecordsRemoval(Seconds seconds) > { > ASSERT(!RunLoop::isMain()); >@@ -923,7 +902,7 @@ void ResourceLoadStatisticsMemoryStore::mergeWithDataFromDecoder(KeyedDecoder& d > return; > > mergeStatistics(WTFMove(loadedStatistics)); >- updateCookiePartitioning([]() { }); >+ updateCookieBlocking([]() { }); > > Vector<OperatingDate> operatingDates; > succeeded = decoder.decodeObjects("operatingDates", operatingDates, [](KeyedDecoder& decoder, OperatingDate& date) { >@@ -941,17 +920,19 @@ void ResourceLoadStatisticsMemoryStore::mergeWithDataFromDecoder(KeyedDecoder& d > m_operatingDates = mergeOperatingDates(m_operatingDates, WTFMove(operatingDates)); > } > >-void ResourceLoadStatisticsMemoryStore::clear() >+void ResourceLoadStatisticsMemoryStore::clear(CompletionHandler<void()>&& completionHandler) > { > ASSERT(!RunLoop::isMain()); > > m_resourceStatisticsMap.clear(); > m_operatingDates.clear(); > >- removeAllStorageAccess(); >+ auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); >+ >+ removeAllStorageAccess([callbackAggregator = callbackAggregator.copyRef()] { }); > > auto primaryDomainsToBlock = ensurePrevalentResourcesForDebugMode(); >- updateCookiePartitioningForDomains({ }, primaryDomainsToBlock, { }, ShouldClearFirst::Yes, []() { }); >+ updateCookieBlockingForDomains(primaryDomainsToBlock, ShouldClearFirst::Yes, [callbackAggregator = callbackAggregator.copyRef()] { }); > } > > bool ResourceLoadStatisticsMemoryStore::wasAccessedAsFirstPartyDueToUserInteraction(const ResourceLoadStatistics& current, const ResourceLoadStatistics& updated) const >@@ -961,7 +942,7 @@ bool ResourceLoadStatisticsMemoryStore::wasAccessedAsFirstPartyDueToUserInteract > > auto mostRecentUserInteractionTime = std::max(current.mostRecentUserInteractionTime, updated.mostRecentUserInteractionTime); > >- return updated.lastSeen <= mostRecentUserInteractionTime + m_parameters.timeToLiveCookiePartitionFree; >+ return updated.lastSeen <= mostRecentUserInteractionTime + 24_h; > } > > void ResourceLoadStatisticsMemoryStore::mergeStatistics(Vector<ResourceLoadStatistics>&& statistics) >@@ -980,12 +961,12 @@ void ResourceLoadStatisticsMemoryStore::mergeStatistics(Vector<ResourceLoadStati > } > } > >-bool ResourceLoadStatisticsMemoryStore::shouldPartitionCookies(const ResourceLoadStatistics& statistic) >+bool ResourceLoadStatisticsMemoryStore::shouldBlockAndKeepCookies(const ResourceLoadStatistics& statistic) > { > return statistic.isPrevalentResource && statistic.hadUserInteraction; > } > >-bool ResourceLoadStatisticsMemoryStore::shouldBlockCookies(const ResourceLoadStatistics& statistic) >+bool ResourceLoadStatisticsMemoryStore::shouldBlockAndPurgeCookies(const ResourceLoadStatistics& statistic) > { > return statistic.isPrevalentResource && !statistic.hadUserInteraction; > } >@@ -1028,85 +1009,57 @@ static void debugLogDomainsInBatches(const char* action, const Vector<String>& d > #endif > } > >-void ResourceLoadStatisticsMemoryStore::updateCookiePartitioning(CompletionHandler<void()>&& completionHandler) >+void ResourceLoadStatisticsMemoryStore::updateCookieBlocking(CompletionHandler<void()>&& completionHandler) > { > ASSERT(!RunLoop::isMain()); > >- Vector<String> domainsToPartition; > Vector<String> domainsToBlock; >- Vector<String> domainsToNeitherPartitionNorBlock; > for (auto& resourceStatistic : m_resourceStatisticsMap.values()) { >- >- bool shouldPartition = shouldPartitionCookies(resourceStatistic); >- bool shouldBlock = shouldBlockCookies(resourceStatistic); >- >- if (shouldPartition && !resourceStatistic.isMarkedForCookiePartitioning) { >- domainsToPartition.append(resourceStatistic.highLevelDomain); >- resourceStatistic.isMarkedForCookiePartitioning = true; >- } else if (shouldBlock && !resourceStatistic.isMarkedForCookieBlocking) { >+ if (resourceStatistic.isPrevalentResource && !resourceStatistic.isMarkedForCookieBlocking) { > domainsToBlock.append(resourceStatistic.highLevelDomain); > resourceStatistic.isMarkedForCookieBlocking = true; >- } else if (!shouldPartition && !shouldBlock && resourceStatistic.isPrevalentResource) { >- domainsToNeitherPartitionNorBlock.append(resourceStatistic.highLevelDomain); >- resourceStatistic.isMarkedForCookiePartitioning = false; >- resourceStatistic.isMarkedForCookieBlocking = false; > } > } > >- if (domainsToPartition.isEmpty() && domainsToBlock.isEmpty() && domainsToNeitherPartitionNorBlock.isEmpty()) { >+ if (domainsToBlock.isEmpty()) { > completionHandler(); > return; > } > >- if (m_debugLoggingEnabled) { >- if (!domainsToPartition.isEmpty()) >- debugLogDomainsInBatches("partition", domainsToPartition); >- if (!domainsToBlock.isEmpty()) >+ if (m_debugLoggingEnabled && !domainsToBlock.isEmpty()) > debugLogDomainsInBatches("block", domainsToBlock); >- if (!domainsToNeitherPartitionNorBlock.isEmpty()) >- debugLogDomainsInBatches("neither partition nor block", domainsToNeitherPartitionNorBlock); >- } > >- RunLoop::main().dispatch([this, store = makeRef(m_store), domainsToPartition = crossThreadCopy(domainsToPartition), domainsToBlock = crossThreadCopy(domainsToBlock), domainsToNeitherPartitionNorBlock = crossThreadCopy(domainsToNeitherPartitionNorBlock), completionHandler = WTFMove(completionHandler)] () mutable { >- store->callUpdatePrevalentDomainsToPartitionOrBlockCookiesHandler(domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, ShouldClearFirst::No, [this, store = store.copyRef(), completionHandler = WTFMove(completionHandler)] () mutable { >- store->statisticsQueue().dispatch([this, completionHandler = WTFMove(completionHandler)] () mutable { >+ RunLoop::main().dispatch([this, weakThis = makeWeakPtr(*this), store = makeRef(m_store), domainsToBlock = crossThreadCopy(domainsToBlock), completionHandler = WTFMove(completionHandler)] () mutable { >+ store->callUpdatePrevalentDomainsToBlockCookiesForHandler(domainsToBlock, ShouldClearFirst::No, [this, weakThis = WTFMove(weakThis), store = store.copyRef(), completionHandler = WTFMove(completionHandler)]() mutable { >+ store->statisticsQueue().dispatch([this, weakThis = WTFMove(weakThis), completionHandler = WTFMove(completionHandler)]() mutable { > completionHandler(); >- >+ if (!weakThis) >+ return; > #if !RELEASE_LOG_DISABLED >- RELEASE_LOG_INFO_IF(m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "Done updating cookie partitioning and blocking."); >+ RELEASE_LOG_INFO_IF(m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "Done updating cookie blocking."); > #endif > }); > }); > }); > } > >-void ResourceLoadStatisticsMemoryStore::updateCookiePartitioningForDomains(const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst shouldClearFirst, CompletionHandler<void()>&& completionHandler) >+void ResourceLoadStatisticsMemoryStore::updateCookieBlockingForDomains(const Vector<String>& domainsToBlock, ShouldClearFirst shouldClearFirst, CompletionHandler<void()>&& completionHandler) > { > ASSERT(!RunLoop::isMain()); > >- if (domainsToPartition.isEmpty() && domainsToBlock.isEmpty() && domainsToNeitherPartitionNorBlock.isEmpty() && shouldClearFirst == ShouldClearFirst::No) { >+ if (domainsToBlock.isEmpty() && shouldClearFirst == ShouldClearFirst::No) { > completionHandler(); > return; > } > > if (shouldClearFirst == ShouldClearFirst::Yes) >- resetCookiePartitioningState(); >- else { >- for (auto& domain : domainsToNeitherPartitionNorBlock) { >- auto& statistic = ensureResourceStatisticsForPrimaryDomain(domain); >- statistic.isMarkedForCookiePartitioning = false; >- statistic.isMarkedForCookieBlocking = false; >- } >- } >- >- for (auto& domain : domainsToPartition) >- ensureResourceStatisticsForPrimaryDomain(domain).isMarkedForCookiePartitioning = true; >+ resetCookieBlockingState(); > > for (auto& domain : domainsToBlock) > ensureResourceStatisticsForPrimaryDomain(domain).isMarkedForCookieBlocking = true; > >- RunLoop::main().dispatch([store = makeRef(m_store), shouldClearFirst, domainsToPartition = crossThreadCopy(domainsToPartition), domainsToBlock = crossThreadCopy(domainsToBlock), domainsToNeitherPartitionNorBlock = crossThreadCopy(domainsToNeitherPartitionNorBlock), completionHandler = WTFMove(completionHandler)] () mutable { >- store->callUpdatePrevalentDomainsToPartitionOrBlockCookiesHandler(domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, shouldClearFirst, [store = store.copyRef(), completionHandler = WTFMove(completionHandler)]() mutable { >+ RunLoop::main().dispatch([store = makeRef(m_store), shouldClearFirst, domainsToBlock = crossThreadCopy(domainsToBlock), completionHandler = WTFMove(completionHandler)] () mutable { >+ store->callUpdatePrevalentDomainsToBlockCookiesForHandler(domainsToBlock, shouldClearFirst, [store = store.copyRef(), completionHandler = WTFMove(completionHandler)]() mutable { > store->statisticsQueue().dispatch([completionHandler = WTFMove(completionHandler)]() mutable { > completionHandler(); > }); >@@ -1114,7 +1067,7 @@ void ResourceLoadStatisticsMemoryStore::updateCookiePartitioningForDomains(const > }); > } > >-void ResourceLoadStatisticsMemoryStore::clearPartitioningStateForDomains(const Vector<String>& domains, CompletionHandler<void()>&& completionHandler) >+void ResourceLoadStatisticsMemoryStore::clearBlockingStateForDomains(const Vector<String>& domains, CompletionHandler<void()>&& completionHandler) > { > ASSERT(!RunLoop::isMain()); > >@@ -1129,21 +1082,18 @@ void ResourceLoadStatisticsMemoryStore::clearPartitioningStateForDomains(const V > > for (auto& domain : domains) { > auto& statistic = ensureResourceStatisticsForPrimaryDomain(domain); >- statistic.isMarkedForCookiePartitioning = false; > statistic.isMarkedForCookieBlocking = false; > } > > completionHandler(); > } > >-void ResourceLoadStatisticsMemoryStore::resetCookiePartitioningState() >+void ResourceLoadStatisticsMemoryStore::resetCookieBlockingState() > { > ASSERT(!RunLoop::isMain()); > >- for (auto& resourceStatistic : m_resourceStatisticsMap.values()) { >- resourceStatistic.isMarkedForCookiePartitioning = false; >+ for (auto& resourceStatistic : m_resourceStatisticsMap.values()) > resourceStatistic.isMarkedForCookieBlocking = false; >- } > } > > void ResourceLoadStatisticsMemoryStore::processStatistics(const Function<void(const ResourceLoadStatistics&)>& processFunction) const >@@ -1300,11 +1250,15 @@ void ResourceLoadStatisticsMemoryStore::setVeryPrevalentResource(const String& p > setPrevalentResource(resourceStatistic, ResourceLoadPrevalence::VeryHigh); > } > >-void ResourceLoadStatisticsMemoryStore::removeAllStorageAccess() >+void ResourceLoadStatisticsMemoryStore::removeAllStorageAccess(CompletionHandler<void()>&& completionHandler) > { > ASSERT(!RunLoop::isMain()); >- RunLoop::main().dispatch([store = makeRef(m_store)] () { >- store->removeAllStorageAccess(); >+ RunLoop::main().dispatch([store = makeRef(m_store), completionHandler = WTFMove(completionHandler)]() mutable { >+ store->removeAllStorageAccess([store = store.copyRef(), completionHandler = WTFMove(completionHandler)]() mutable { >+ store->statisticsQueue().dispatch([completionHandler = WTFMove(completionHandler)]() mutable { >+ completionHandler(); >+ }); >+ }); > }); > } > >diff --git a/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.h b/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.h >index b6fc6ad0819e1f03dc41a6cf83a9930e7b83a26e..25787f9c05af54ce253287af5e07377eba043a92 100644 >--- a/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.h >+++ b/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.h >@@ -55,7 +55,7 @@ public: > > void setPersistentStorage(ResourceLoadStatisticsPersistentStorage&); > >- void clear(); >+ void clear(CompletionHandler<void()>&&); > bool isEmpty() const { return m_resourceStatisticsMap.isEmpty(); } > > std::unique_ptr<WebCore::KeyedEncoder> createEncoderFromData() const; >@@ -64,16 +64,16 @@ public: > void mergeStatistics(Vector<WebCore::ResourceLoadStatistics>&&); > void processStatistics(const Function<void(const WebCore::ResourceLoadStatistics&)>&) const; > >- void resetCookiePartitioningState(); >- void updateCookiePartitioning(CompletionHandler<void()>&&); >- void updateCookiePartitioningForDomains(const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst, CompletionHandler<void()>&&); >- void clearPartitioningStateForDomains(const Vector<String>& domains, CompletionHandler<void()>&&); >+ void resetCookieBlockingState(); >+ void updateCookieBlocking(CompletionHandler<void()>&&); >+ void updateCookieBlockingForDomains(const Vector<String>& domainsToBlock, ShouldClearFirst, CompletionHandler<void()>&&); >+ void clearBlockingStateForDomains(const Vector<String>& domains, CompletionHandler<void()>&&); > > void includeTodayAsOperatingDateIfNecessary(); > void processStatisticsAndDataRecords(); > > void requestStorageAccessUnderOpener(String&& primaryDomainInNeedOfStorageAccess, uint64_t openerPageID, String&& openerPrimaryDomain, bool isTriggeredByUserGesture); >- void removeAllStorageAccess(); >+ void removeAllStorageAccess(CompletionHandler<void()>&&); > > void grandfatherExistingWebsiteData(CompletionHandler<void()>&&); > void cancelPendingStatisticsProcessingRequest(); >@@ -109,7 +109,6 @@ public: > void setShouldClassifyResourcesBeforeDataRecordsRemoval(bool); > void setShouldSubmitTelemetry(bool); > void setTimeToLiveUserInteraction(Seconds); >- void setTimeToLiveCookiePartitionFree(Seconds); > void setMinimumTimeBetweenDataRecordsRemoval(Seconds); > void setGrandfatheringTime(Seconds); > void setResourceLoadStatisticsDebugMode(bool); >@@ -120,7 +119,6 @@ public: > void requestStorageAccess(String&& subFramePrimaryDomain, String&& topFramePrimaryDomain, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&&); > void grantStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool userWasPromptedNow, CompletionHandler<void(bool)>&&); > >- void logNonRecentUserInteraction(const String& primaryDomain); > void logFrameNavigation(const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, const String& sourcePrimaryDomain, const String& targetHost, const String& mainFrameHost, bool areTargetAndMainFrameDomainsAssociated, bool areTargetAndSourceDomainsAssociated, bool isRedirect, bool isMainFrame); > void logUserInteraction(const String& primaryDomain); > >@@ -130,8 +128,8 @@ public: > void setLastSeen(const String& primaryDomain, Seconds); > > private: >- static bool shouldPartitionCookies(const WebCore::ResourceLoadStatistics&); >- static bool shouldBlockCookies(const WebCore::ResourceLoadStatistics&); >+ static bool shouldBlockAndKeepCookies(const WebCore::ResourceLoadStatistics&); >+ static bool shouldBlockAndPurgeCookies(const WebCore::ResourceLoadStatistics&); > static bool hasUserGrantedStorageAccessThroughPrompt(const WebCore::ResourceLoadStatistics&, const String& firstPartyPrimaryDomain); > bool hasHadUnexpiredRecentUserInteraction(WebCore::ResourceLoadStatistics&) const; > bool hasStatisticsExpired(const WebCore::ResourceLoadStatistics&) const; >@@ -160,7 +158,6 @@ private: > size_t pruneEntriesDownTo { 800 }; > size_t maxStatisticsEntries { 1000 }; > std::optional<Seconds> timeToLiveUserInteraction; >- Seconds timeToLiveCookiePartitionFree { 24_h }; > Seconds minimumTimeBetweenDataRecordsRemoval { 1_h }; > Seconds grandfatheringTime { 24_h * 7 }; > bool shouldNotifyPagesWhenDataRecordsWereScanned { false }; >diff --git a/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.cpp b/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.cpp >index df1505fd7c5710f3897fdfe4bd792d36b1c7bce5..707f61f34bfcffb2c037603c624f4ea3245dbcab 100644 >--- a/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.cpp >+++ b/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.cpp >@@ -137,7 +137,7 @@ void ResourceLoadStatisticsPersistentStorage::startMonitoringDisk() > refreshMemoryStoreFromDisk(); > break; > case FileMonitor::FileChangeType::Removal: >- m_memoryStore.clear(); >+ m_memoryStore.clear([] { }); > m_fileMonitor = nullptr; > monitorDirectoryForNewStatistics(); > break; >diff --git a/Source/WebKit/UIProcess/WebCookieManagerProxy.cpp b/Source/WebKit/UIProcess/WebCookieManagerProxy.cpp >index af0e3ee25483620020d2ffb6d5d64c45e872259b..c94efd8f69c52fd320cc22a6c5095045f124d938 100644 >--- a/Source/WebKit/UIProcess/WebCookieManagerProxy.cpp >+++ b/Source/WebKit/UIProcess/WebCookieManagerProxy.cpp >@@ -272,15 +272,6 @@ void WebCookieManagerProxy::didSetHTTPCookieAcceptPolicy(WebKit::CallbackID call > m_callbacks.take<VoidCallback>(callbackID)->performCallback(); > } > >-void WebCookieManagerProxy::setCookieStoragePartitioningEnabled(bool enabled) >-{ >-#if PLATFORM(COCOA) >- processPool()->sendToNetworkingProcess(Messages::NetworkProcess::SetCookieStoragePartitioningEnabled(enabled)); >-#else >- UNUSED_PARAM(enabled); >-#endif >-} >- > void WebCookieManagerProxy::setStorageAccessAPIEnabled(bool enabled) > { > #if PLATFORM(COCOA) >diff --git a/Source/WebKit/UIProcess/WebCookieManagerProxy.h b/Source/WebKit/UIProcess/WebCookieManagerProxy.h >index 97f14add6dfed3bc096dfbd095550435a2942b49..e33167a8950c168f01c032ceb9e5f8f981e51380 100644 >--- a/Source/WebKit/UIProcess/WebCookieManagerProxy.h >+++ b/Source/WebKit/UIProcess/WebCookieManagerProxy.h >@@ -79,7 +79,6 @@ public: > void setHTTPCookieAcceptPolicy(PAL::SessionID, HTTPCookieAcceptPolicy, Function<void (CallbackBase::Error)>&&); > void getHTTPCookieAcceptPolicy(PAL::SessionID, Function<void (HTTPCookieAcceptPolicy, CallbackBase::Error)>&&); > >- void setCookieStoragePartitioningEnabled(bool); > void setStorageAccessAPIEnabled(bool); > > void startObservingCookieChanges(PAL::SessionID); >diff --git a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp >index 1a7abda70bfd35e865fb0aee0befc3e5a50d81a2..2877cad114308cb2cec1d8605ec9168044847933 100644 >--- a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp >+++ b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp >@@ -216,7 +216,7 @@ void WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated(Vector<WebCor > m_memoryStore->cancelPendingStatisticsProcessingRequest(); > > // Fire before processing statistics to propagate user interaction as fast as possible to the network process. >- m_memoryStore->updateCookiePartitioning([]() { }); >+ m_memoryStore->updateCookieBlocking([]() { }); > m_memoryStore->processStatisticsAndDataRecords(); > }); > } >@@ -327,13 +327,17 @@ void WebResourceLoadStatisticsStore::callGrantStorageAccessHandler(const String& > callback(false); > } > >-void WebResourceLoadStatisticsStore::removeAllStorageAccess() >+void WebResourceLoadStatisticsStore::removeAllStorageAccess(CompletionHandler<void()>&& completionHandler) > { > ASSERT(RunLoop::isMain()); > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) > if (m_websiteDataStore) >- m_websiteDataStore->removeAllStorageAccessHandler(); >+ m_websiteDataStore->removeAllStorageAccessHandler(WTFMove(completionHandler)); >+ else >+ completionHandler(); >+#else >+ completionHandler(); > #endif > } > >@@ -418,22 +422,6 @@ void WebResourceLoadStatisticsStore::logUserInteraction(const URL& url, Completi > }); > } > >-void WebResourceLoadStatisticsStore::logNonRecentUserInteraction(const URL& url, CompletionHandler<void()>&& completionHandler) >-{ >- ASSERT(RunLoop::isMain()); >- >- if (url.isBlankURL() || url.isEmpty()) { >- completionHandler(); >- return; >- } >- >- postTask([this, primaryDomain = isolatedPrimaryDomain(url), completionHandler = WTFMove(completionHandler)]() mutable { >- if (m_memoryStore) >- m_memoryStore->logNonRecentUserInteraction(primaryDomain); >- postTaskReply(WTFMove(completionHandler)); >- }); >-} >- > void WebResourceLoadStatisticsStore::clearUserInteraction(const URL& url, CompletionHandler<void()>&& completionHandler) > { > ASSERT(RunLoop::isMain()); >@@ -697,7 +685,7 @@ void WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom(const URL& to > }); > } > >-void WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdate(CompletionHandler<void()>&& completionHandler) >+void WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdate(CompletionHandler<void()>&& completionHandler) > { > // Helper function used by testing system. Should only be called from the main thread. > ASSERT(RunLoop::isMain()); >@@ -707,29 +695,29 @@ void WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdate(Completion > postTaskReply(WTFMove(completionHandler)); > return; > } >- m_memoryStore->updateCookiePartitioning([completionHandler = WTFMove(completionHandler)] () mutable { >+ m_memoryStore->updateCookieBlocking([completionHandler = WTFMove(completionHandler)] () mutable { > postTaskReply(WTFMove(completionHandler)); > }); > }); > } > >-void WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdateForDomains(const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst shouldClearFirst, CompletionHandler<void()>&& completionHandler) >+void WebResourceLoadStatisticsStore::scheduleCookieBlockingUpdateForDomains(const Vector<String>& domainsToBlock, ShouldClearFirst shouldClearFirst, CompletionHandler<void()>&& completionHandler) > { > // Helper function used by testing system. Should only be called from the main thread. > ASSERT(RunLoop::isMain()); >- postTask([this, domainsToPartition = crossThreadCopy(domainsToPartition), domainsToBlock = crossThreadCopy(domainsToBlock), domainsToNeitherPartitionNorBlock = crossThreadCopy(domainsToNeitherPartitionNorBlock), shouldClearFirst, completionHandler = WTFMove(completionHandler)] () mutable { >+ postTask([this, domainsToBlock = crossThreadCopy(domainsToBlock), shouldClearFirst, completionHandler = WTFMove(completionHandler)] () mutable { > if (!m_memoryStore) { > postTaskReply(WTFMove(completionHandler)); > return; > } > >- m_memoryStore->updateCookiePartitioningForDomains(domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, shouldClearFirst, [completionHandler = WTFMove(completionHandler)]() mutable { >+ m_memoryStore->updateCookieBlockingForDomains(domainsToBlock, shouldClearFirst, [completionHandler = WTFMove(completionHandler)]() mutable { > postTaskReply(WTFMove(completionHandler)); > }); > }); > } > >-void WebResourceLoadStatisticsStore::scheduleClearPartitioningStateForDomains(const Vector<String>& domains, CompletionHandler<void()>&& completionHandler) >+void WebResourceLoadStatisticsStore::scheduleClearBlockingStateForDomains(const Vector<String>& domains, CompletionHandler<void()>&& completionHandler) > { > // Helper function used by testing system. Should only be called from the main thread. > ASSERT(RunLoop::isMain()); >@@ -739,19 +727,19 @@ void WebResourceLoadStatisticsStore::scheduleClearPartitioningStateForDomains(co > return; > } > >- m_memoryStore->clearPartitioningStateForDomains(domains, [completionHandler = WTFMove(completionHandler)]() mutable { >+ m_memoryStore->clearBlockingStateForDomains(domains, [completionHandler = WTFMove(completionHandler)]() mutable { > postTaskReply(WTFMove(completionHandler)); > }); > }); > } > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >-void WebResourceLoadStatisticsStore::scheduleCookiePartitioningStateReset() >+void WebResourceLoadStatisticsStore::scheduleCookieBlockingStateReset() > { > ASSERT(RunLoop::isMain()); > postTask([this] { > if (m_memoryStore) >- m_memoryStore->resetCookiePartitioningState(); >+ m_memoryStore->resetCookieBlockingState(); > }); > } > #endif >@@ -759,11 +747,18 @@ void WebResourceLoadStatisticsStore::scheduleCookiePartitioningStateReset() > void WebResourceLoadStatisticsStore::scheduleClearInMemory(CompletionHandler<void()>&& completionHandler) > { > ASSERT(RunLoop::isMain()); >- postTask([this, completionHandler = WTFMove(completionHandler)] () mutable { >- if (m_memoryStore) >- m_memoryStore->clear(); >+ postTask([this, completionHandler = WTFMove(completionHandler)]() mutable { > >- postTaskReply(WTFMove(completionHandler)); >+ CompletionHandler<void()> callCompletionHandlerOnMainThread = [completionHandler = WTFMove(completionHandler)]() mutable { >+ postTaskReply(WTFMove(completionHandler)); >+ }; >+ >+ if (!m_memoryStore) { >+ callCompletionHandlerOnMainThread(); >+ return; >+ } >+ >+ m_memoryStore->clear(WTFMove(callCompletionHandlerOnMainThread)); > }); > } > >@@ -772,7 +767,7 @@ void WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent(ShouldGr > ASSERT(RunLoop::isMain()); > postTask([this, shouldGrandfather, completionHandler = WTFMove(completionHandler)] () mutable { > if (m_memoryStore) >- m_memoryStore->clear(); >+ m_memoryStore->clear([] { }); > if (m_persistentStorage) > m_persistentStorage->clear(); > >@@ -805,15 +800,6 @@ void WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction(Seconds second > }); > } > >-void WebResourceLoadStatisticsStore::setTimeToLiveCookiePartitionFree(Seconds seconds) >-{ >- ASSERT(RunLoop::isMain()); >- postTask([this, seconds] { >- if (m_memoryStore) >- m_memoryStore->setTimeToLiveCookiePartitionFree(seconds); >- }); >-} >- > void WebResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval(Seconds seconds) > { > ASSERT(RunLoop::isMain()); >@@ -832,13 +818,13 @@ void WebResourceLoadStatisticsStore::setGrandfatheringTime(Seconds seconds) > }); > } > >-void WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToPartitionOrBlockCookiesHandler(const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst shouldClearFirst, CompletionHandler<void()>&& completionHandler) >+void WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler(const Vector<String>& domainsToBlock, ShouldClearFirst shouldClearFirst, CompletionHandler<void()>&& completionHandler) > { > ASSERT(RunLoop::isMain()); > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) > if (m_websiteDataStore) { >- m_websiteDataStore->updatePrevalentDomainsToPartitionOrBlockCookies(domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, shouldClearFirst, WTFMove(completionHandler)); >+ m_websiteDataStore->updatePrevalentDomainsToBlockCookiesFor(domainsToBlock, shouldClearFirst, WTFMove(completionHandler)); > return; > } > #endif >diff --git a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h >index 76f19decd80327dc4cc3454acfd75fe604b1328a..244bfa310a3e31a1c4a172beef2b9d2b9544d6f7 100644 >--- a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h >+++ b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h >@@ -86,7 +86,6 @@ public: > > void logFrameNavigation(const WebFrameProxy&, const WebCore::URL& pageURL, const WebCore::ResourceRequest&, const WebCore::URL& redirectURL); > void logUserInteraction(const WebCore::URL&, CompletionHandler<void()>&&); >- void logNonRecentUserInteraction(const WebCore::URL&, CompletionHandler<void()>&&); > void clearUserInteraction(const WebCore::URL&, CompletionHandler<void()>&&); > void hasHadUserInteraction(const WebCore::URL&, CompletionHandler<void(bool)>&&); > void setLastSeen(const WebCore::URL&, Seconds, CompletionHandler<void()>&&); >@@ -105,12 +104,12 @@ public: > void setSubresourceUniqueRedirectFrom(const WebCore::URL& subresource, const WebCore::URL& hostNameRedirectedFrom); > void setTopFrameUniqueRedirectTo(const WebCore::URL& topFrameHostName, const WebCore::URL& hostNameRedirectedTo); > void setTopFrameUniqueRedirectFrom(const WebCore::URL& topFrameHostName, const WebCore::URL& hostNameRedirectedFrom); >- void scheduleCookiePartitioningUpdate(CompletionHandler<void()>&&); >- void scheduleCookiePartitioningUpdateForDomains(const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst, CompletionHandler<void()>&&); >- void scheduleClearPartitioningStateForDomains(const Vector<String>& domains, CompletionHandler<void()>&&); >+ void scheduleCookieBlockingUpdate(CompletionHandler<void()>&&); >+ void scheduleCookieBlockingUpdateForDomains(const Vector<String>& domainsToBlock, ShouldClearFirst, CompletionHandler<void()>&&); >+ void scheduleClearBlockingStateForDomains(const Vector<String>& domains, CompletionHandler<void()>&&); > void scheduleStatisticsAndDataRecordsProcessing(); > void submitTelemetry(); >- void scheduleCookiePartitioningStateReset(); >+ void scheduleCookieBlockingStateReset(); > > void scheduleClearInMemory(CompletionHandler<void()>&&); > >@@ -122,7 +121,6 @@ public: > void scheduleClearInMemoryAndPersistent(WallTime modifiedSince, ShouldGrandfather, CompletionHandler<void()>&&); > > void setTimeToLiveUserInteraction(Seconds); >- void setTimeToLiveCookiePartitionFree(Seconds); > void setMinimumTimeBetweenDataRecordsRemoval(Seconds); > void setGrandfatheringTime(Seconds); > void setMaxStatisticsEntries(size_t); >@@ -136,8 +134,8 @@ public: > void setStatisticsTestingCallback(WTF::Function<void(const String&)>&& callback) { m_statisticsTestingCallback = WTFMove(callback); } > void logTestingEvent(const String&); > void callGrantStorageAccessHandler(const String& subFramePrimaryDomain, const String& topFramePrimaryDomain, std::optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&&); >- void removeAllStorageAccess(); >- void callUpdatePrevalentDomainsToPartitionOrBlockCookiesHandler(const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst, CompletionHandler<void()>&&); >+ void removeAllStorageAccess(CompletionHandler<void()>&&); >+ void callUpdatePrevalentDomainsToBlockCookiesForHandler(const Vector<String>& domainsToBlock, ShouldClearFirst, CompletionHandler<void()>&&); > void callRemoveDomainsHandler(const Vector<String>& domains); > void callHasStorageAccessForFrameHandler(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&&); > >diff --git a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >index 17a5890981ad7597cdbde95615d4fd1a6cdaa2b8..a1372b1d7dd8be1b6dffc8be1a959707f70dff97 100644 >--- a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >+++ b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >@@ -1249,13 +1249,13 @@ void WebsiteDataStore::removeDataForTopPrivatelyControlledDomains(OptionSet<Webs > } > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >-void WebsiteDataStore::updatePrevalentDomainsToPartitionOrBlockCookies(const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst shouldClearFirst, CompletionHandler<void()>&& completionHandler) >+void WebsiteDataStore::updatePrevalentDomainsToBlockCookiesFor(const Vector<String>& domainsToBlock, ShouldClearFirst shouldClearFirst, CompletionHandler<void()>&& completionHandler) > { > auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); > > for (auto& processPool : processPools()) { > if (auto* process = processPool->networkProcess()) >- process->updatePrevalentDomainsToPartitionOrBlockCookies(m_sessionID, domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, shouldClearFirst, [callbackAggregator = callbackAggregator.copyRef()] { }); >+ process->updatePrevalentDomainsToBlockCookiesFor(m_sessionID, domainsToBlock, shouldClearFirst, [callbackAggregator = callbackAggregator.copyRef()] { }); > } > } > >@@ -1295,11 +1295,13 @@ void WebsiteDataStore::grantStorageAccessHandler(const String& resourceDomain, c > networkProcess.grantStorageAccess(m_sessionID, resourceDomain, firstPartyDomain, frameID, pageID, WTFMove(completionHandler)); > } > >-void WebsiteDataStore::removeAllStorageAccessHandler() >+void WebsiteDataStore::removeAllStorageAccessHandler(CompletionHandler<void()>&& completionHandler) > { >+ auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); >+ > for (auto& processPool : processPools()) { > if (auto networkProcess = processPool->networkProcess()) >- networkProcess->removeAllStorageAccess(m_sessionID); >+ networkProcess->removeAllStorageAccess(m_sessionID, [callbackAggregator = callbackAggregator.copyRef()] { }); > } > } > >@@ -1344,7 +1346,7 @@ void WebsiteDataStore::networkProcessDidCrash() > { > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) > if (m_resourceLoadStatistics) >- m_resourceLoadStatistics->scheduleCookiePartitioningStateReset(); >+ m_resourceLoadStatistics->scheduleCookieBlockingStateReset(); > #endif > } > >diff --git a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h >index 31f505f7c5fe004c00acd1ac59bcf508885c733d..94ef4e301841b449040c5ff020fff80f3783be24 100644 >--- a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h >+++ b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h >@@ -131,11 +131,11 @@ public: > void removeDataForTopPrivatelyControlledDomains(OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, const Vector<String>& topPrivatelyControlledDomains, Function<void(HashSet<String>&&)>&& completionHandler); > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >- void updatePrevalentDomainsToPartitionOrBlockCookies(const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst, CompletionHandler<void()>&&); >+ void updatePrevalentDomainsToBlockCookiesFor(const Vector<String>& domainsToBlock, ShouldClearFirst, CompletionHandler<void()>&&); > void hasStorageAccessForFrameHandler(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool hasAccess)>&&); > void getAllStorageAccessEntries(uint64_t pageID, CompletionHandler<void(Vector<String>&& domains)>&&); > void grantStorageAccessHandler(const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool wasGranted)>&&); >- void removeAllStorageAccessHandler(); >+ void removeAllStorageAccessHandler(CompletionHandler<void()>&&); > void removePrevalentDomains(const Vector<String>& domains); > void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&&); > void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&&); >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 314e54d6b7d8c9176ecb1a28a3083cc6ccd83ffb..830e7d667eda2de7c43f17dc831dc550333e1581 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,49 @@ >+2018-07-31 John Wilander <wilander@apple.com> >+ >+ Resource Load Statistics: Remove partitioned cookies for reduced complexity, lower memory footprint, and ability to support more platforms >+ https://bugs.webkit.org/show_bug.cgi?id=188109 >+ <rdar://problem/42664391> >+ >+ Reviewed by Brent Fulgham, Chris Dumez, and Alex Christensen. >+ >+ This patch removes cookie partitioning which reduces the model to just >+ blocked cookies (in third-party contexts) and first-party cookie access. >+ >+ Several of the changes are renaming to reflect that there are no more >+ cookie partitions. >+ >+ * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: >+ Removed or renamed functions to reflect that there are no more >+ partitioned cookies. >+ * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: >+ (WTR::InjectedBundle::didReceiveMessageToPage): >+ * WebKitTestRunner/InjectedBundle/TestRunner.cpp: >+ (WTR::TestRunner::statisticsUpdateCookieBlocking): >+ (WTR::TestRunner::statisticsCallDidSetBlockCookiesForHostCallback): >+ (WTR::TestRunner::setCookieStoragePartitioningEnabled): Deleted. >+ (WTR::TestRunner::setStatisticsHasHadNonRecentUserInteraction): Deleted. >+ (WTR::TestRunner::setStatisticsTimeToLiveCookiePartitionFree): Deleted. >+ (WTR::TestRunner::statisticsUpdateCookiePartitioning): Deleted. >+ (WTR::TestRunner::statisticsSetShouldPartitionCookiesForHost): Deleted. >+ (WTR::TestRunner::statisticsCallDidSetPartitionOrBlockCookiesForHostCallback): Deleted. >+ * WebKitTestRunner/InjectedBundle/TestRunner.h: >+ * WebKitTestRunner/TestController.cpp: >+ (WTR::TestController::statisticsUpdateCookieBlocking): >+ (WTR::TestController::setStatisticsHasHadNonRecentUserInteraction): Deleted. >+ (WTR::TestController::setStatisticsTimeToLiveCookiePartitionFree): Deleted. >+ (WTR::TestController::statisticsUpdateCookiePartitioning): Deleted. >+ (WTR::TestController::statisticsSetShouldPartitionCookiesForHost): Deleted. >+ * WebKitTestRunner/TestController.h: >+ * WebKitTestRunner/TestInvocation.cpp: >+ (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): >+ (WTR::TestInvocation::didSetBlockCookiesForHost): >+ (WTR::TestInvocation::didSetHasHadUserInteraction): >+ (WTR::TestInvocation::didSetPartitionOrBlockCookiesForHost): Deleted. >+ (WTR::TestInvocation::didSetHasHadNonRecentUserInteraction): Deleted. >+ * WebKitTestRunner/TestInvocation.h: >+ * WebKitTestRunner/cocoa/TestControllerCocoa.mm: >+ (WTR::initializeWebViewConfiguration): >+ > 2018-07-31 Fujii Hironori <Hironori.Fujii@sony.com> > > server_process.py should print returncode in debug log if the process crashed >diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl b/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl >index bd81ac9a585a8d3ea701e038982464f9359da0f1..a9545c62f1e7e4c61104579f63754d03c86b3955 100644 >--- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl >+++ b/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl >@@ -181,7 +181,6 @@ interface TestRunner { > > // Cookies testing > void setAlwaysAcceptCookies(boolean accept); >- void setCookieStoragePartitioningEnabled(boolean enabled); > > void overridePreference(DOMString preference, DOMString value); > >@@ -282,7 +281,6 @@ interface TestRunner { > boolean isStatisticsRegisteredAsSubFrameUnder(DOMString subFrameHost, DOMString topFrameHost); > boolean isStatisticsRegisteredAsRedirectingTo(DOMString hostRedirectedFrom, DOMString hostRedirectedTo); > void setStatisticsHasHadUserInteraction(DOMString hostName, boolean value, object completionHandler); >- void setStatisticsHasHadNonRecentUserInteraction(DOMString hostName, object completionHandler); > boolean isStatisticsHasHadUserInteraction(DOMString hostName); > void setStatisticsGrandfathered(DOMString hostName, boolean value); > boolean isStatisticsGrandfathered(DOMString hostName); >@@ -293,11 +291,9 @@ interface TestRunner { > void setStatisticsTopFrameUniqueRedirectTo(DOMString hostName, DOMString hostNameRedirectedTo); > void setStatisticsTopFrameUniqueRedirectFrom(DOMString hostName, DOMString hostNameRedirectedTo); > void setStatisticsTimeToLiveUserInteraction(double seconds); >- void setStatisticsTimeToLiveCookiePartitionFree(double seconds); > void statisticsNotifyObserver(); > void statisticsProcessStatisticsAndDataRecords(); >- void statisticsUpdateCookiePartitioning(object callback); >- void statisticsSetShouldPartitionCookiesForHost(DOMString hostName, boolean value, object callback); >+ void statisticsUpdateCookieBlocking(object completionHandler); > void statisticsSubmitTelemetry(); > void setStatisticsNotifyPagesWhenDataRecordsWereScanned(boolean value); > void setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(boolean value); >diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp >index 443070028ae7d0caa24b6b141d3430dd5c8d7beb..e6b55e58deb713465dbc5887ceeb6f5888684669 100644 >--- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp >+++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp >@@ -310,8 +310,8 @@ void InjectedBundle::didReceiveMessageToPage(WKBundlePageRef page, WKStringRef m > return; > } > >- if (WKStringIsEqualToUTF8CString(messageName, "CallDidSetPartitionOrBlockCookiesForHost")) { >- m_testRunner->statisticsCallDidSetPartitionOrBlockCookiesForHostCallback(); >+ if (WKStringIsEqualToUTF8CString(messageName, "CallDidSetBlockCookiesForHost")) { >+ m_testRunner->statisticsCallDidSetBlockCookiesForHostCallback(); > return; > } > >@@ -345,11 +345,6 @@ void InjectedBundle::didReceiveMessageToPage(WKBundlePageRef page, WKStringRef m > return; > } > >- if (WKStringIsEqualToUTF8CString(messageName, "CallDidSetHasHadNonRecentUserInteraction")) { >- m_testRunner->statisticsCallDidSetHasHadUserInteractionCallback(); >- return; >- } >- > if (WKStringIsEqualToUTF8CString(messageName, "CallDidReceiveAllStorageAccessEntries")) { > ASSERT(messageBody); > ASSERT(WKGetTypeID(messageBody) == WKArrayGetTypeID()); >diff --git a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp >index 41a7668d43eb3f9af66574e610d0ad668ac16b3a..27f0dd285b540ecff45825c63ee9dfd5972ce95a 100644 >--- a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp >+++ b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp >@@ -747,7 +747,7 @@ enum { > StatisticsDidRunTelemetryCallbackID, > StatisticsDidClearThroughWebsiteDataRemovalCallbackID, > StatisticsDidResetToConsistentStateCallbackID, >- StatisticsDidSetPartitionOrBlockCookiesForHostCallbackID, >+ StatisticsDidSetBlockCookiesForHostCallbackID, > AllStorageAccessEntriesCallbackID, > DidRemoveAllSessionCredentialsCallbackID, > GetApplicationManifestCallbackID, >@@ -876,15 +876,6 @@ void TestRunner::setAlwaysAcceptCookies(bool accept) > WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); > } > >-void TestRunner::setCookieStoragePartitioningEnabled(bool enabled) >-{ >- WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetCookieStoragePartitioningEnabled")); >- >- WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(enabled)); >- >- WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); >-} >- > double TestRunner::preciseTime() > { > return WallTime::now().secondsSinceEpoch().seconds(); >@@ -1561,15 +1552,6 @@ void TestRunner::setStatisticsHasHadUserInteraction(JSStringRef hostName, bool v > WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); > } > >-void TestRunner::setStatisticsHasHadNonRecentUserInteraction(JSStringRef hostName, JSValueRef completionHandler) >-{ >- cacheTestRunnerCallback(SetStatisticsHasHadUserInteractionCallbackID, completionHandler); >- >- WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetStatisticsHasHadNonRecentUserInteraction")); >- WKRetainPtr<WKStringRef> messageBody(AdoptWK, WKStringCreateWithJSString(hostName)); >- WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); >-} >- > void TestRunner::statisticsCallDidSetHasHadUserInteractionCallback() > { > callTestRunnerCallback(SetStatisticsHasHadUserInteractionCallbackID); >@@ -1773,13 +1755,6 @@ void TestRunner::setStatisticsTimeToLiveUserInteraction(double seconds) > WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); > } > >-void TestRunner::setStatisticsTimeToLiveCookiePartitionFree(double seconds) >-{ >- WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetStatisticsTimeToLiveCookiePartitionFree")); >- WKRetainPtr<WKDoubleRef> messageBody(AdoptWK, WKDoubleCreate(seconds)); >- WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); >-} >- > void TestRunner::installStatisticsDidModifyDataRecordsCallback(JSValueRef callback) > { > cacheTestRunnerCallback(StatisticsDidModifyDataRecordsCallbackID, callback); >@@ -1835,44 +1810,17 @@ void TestRunner::statisticsProcessStatisticsAndDataRecords() > WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), 0, nullptr); > } > >-void TestRunner::statisticsUpdateCookiePartitioning(JSValueRef callback) >+void TestRunner::statisticsUpdateCookieBlocking(JSValueRef completionHandler) > { >- cacheTestRunnerCallback(StatisticsDidSetPartitionOrBlockCookiesForHostCallbackID, callback); >+ cacheTestRunnerCallback(StatisticsDidSetBlockCookiesForHostCallbackID, completionHandler); > >- WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("StatisticsUpdateCookiePartitioning")); >+ WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("StatisticsUpdateCookieBlocking")); > WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), 0, nullptr); > } > >-void TestRunner::statisticsSetShouldPartitionCookiesForHost(JSStringRef hostName, bool value, JSValueRef callback) >-{ >- cacheTestRunnerCallback(StatisticsDidSetPartitionOrBlockCookiesForHostCallbackID, callback); >- >- Vector<WKRetainPtr<WKStringRef>> keys; >- Vector<WKRetainPtr<WKTypeRef>> values; >- >- keys.append({ AdoptWK, WKStringCreateWithUTF8CString("HostName") }); >- values.append({ AdoptWK, WKStringCreateWithJSString(hostName) }); >- >- keys.append({ AdoptWK, WKStringCreateWithUTF8CString("Value") }); >- values.append({ AdoptWK, WKBooleanCreate(value) }); >- >- Vector<WKStringRef> rawKeys(keys.size()); >- Vector<WKTypeRef> rawValues(values.size()); >- >- for (size_t i = 0; i < keys.size(); ++i) { >- rawKeys[i] = keys[i].get(); >- rawValues[i] = values[i].get(); >- } >- >- WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("StatisticsSetShouldPartitionCookiesForHost")); >- WKRetainPtr<WKDictionaryRef> messageBody(AdoptWK, WKDictionaryCreate(rawKeys.data(), rawValues.data(), rawKeys.size())); >- >- WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); >-} >- >-void TestRunner::statisticsCallDidSetPartitionOrBlockCookiesForHostCallback() >+void TestRunner::statisticsCallDidSetBlockCookiesForHostCallback() > { >- callTestRunnerCallback(StatisticsDidSetPartitionOrBlockCookiesForHostCallbackID); >+ callTestRunnerCallback(StatisticsDidSetBlockCookiesForHostCallbackID); > } > > void TestRunner::statisticsSubmitTelemetry() >diff --git a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h >index 413aebee10a28a9db145c0dbdca7bfd9e8dde5ac..a4bfc50d0f12e2fa60ba212ac982d8b74724ff80 100644 >--- a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h >+++ b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h >@@ -286,7 +286,6 @@ public: > > // Cookies testing > void setAlwaysAcceptCookies(bool); >- void setCookieStoragePartitioningEnabled(bool); > > // Custom full screen behavior. > void setHasCustomFullScreenBehavior(bool value) { m_customFullScreenBehavior = value; } >@@ -378,9 +377,8 @@ public: > void statisticsDidRunTelemetryCallback(unsigned totalPrevalentResources, unsigned totalPrevalentResourcesWithUserInteraction, unsigned top3SubframeUnderTopFrameOrigins); > void statisticsNotifyObserver(); > void statisticsProcessStatisticsAndDataRecords(); >- void statisticsUpdateCookiePartitioning(JSValueRef callback); >- void statisticsSetShouldPartitionCookiesForHost(JSStringRef hostName, bool value, JSValueRef callback); >- void statisticsCallDidSetPartitionOrBlockCookiesForHostCallback(); >+ void statisticsUpdateCookieBlocking(JSValueRef completionHandler); >+ void statisticsCallDidSetBlockCookiesForHostCallback(); > void statisticsSubmitTelemetry(); > void setStatisticsDebugMode(bool value, JSValueRef completionHandler); > void statisticsCallDidSetDebugModeCallback(); >@@ -397,7 +395,6 @@ public: > bool isStatisticsRegisteredAsSubFrameUnder(JSStringRef subFrameHost, JSStringRef topFrameHost); > bool isStatisticsRegisteredAsRedirectingTo(JSStringRef hostRedirectedFrom, JSStringRef hostRedirectedTo); > void setStatisticsHasHadUserInteraction(JSStringRef hostName, bool value, JSValueRef completionHandler); >- void setStatisticsHasHadNonRecentUserInteraction(JSStringRef hostName, JSValueRef completionHandler); > void statisticsCallDidSetHasHadUserInteractionCallback(); > bool isStatisticsHasHadUserInteraction(JSStringRef hostName); > void setStatisticsGrandfathered(JSStringRef hostName, bool value); >@@ -409,7 +406,6 @@ public: > void setStatisticsTopFrameUniqueRedirectTo(JSStringRef hostName, JSStringRef hostNameRedirectedTo); > void setStatisticsTopFrameUniqueRedirectFrom(JSStringRef hostName, JSStringRef hostNameRedirectedFrom); > void setStatisticsTimeToLiveUserInteraction(double seconds); >- void setStatisticsTimeToLiveCookiePartitionFree(double seconds); > void setStatisticsNotifyPagesWhenDataRecordsWereScanned(bool); > void setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(bool); > void setStatisticsNotifyPagesWhenTelemetryWasCaptured(bool value); >diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp >index 75d2ddb7eb4ebbc5439df31c2357434320d6dbfa..7b3e0eeafdb13175be9bd60c06b0538d5c5ef52f 100644 >--- a/Tools/WebKitTestRunner/TestController.cpp >+++ b/Tools/WebKitTestRunner/TestController.cpp >@@ -2736,15 +2736,6 @@ void TestController::setStatisticsHasHadUserInteraction(WKStringRef host, bool v > m_currentInvocation->didSetHasHadUserInteraction(); > } > >-void TestController::setStatisticsHasHadNonRecentUserInteraction(WKStringRef host) >-{ >- auto* dataStore = WKContextGetWebsiteDataStore(platformContext()); >- ResourceStatisticsCallbackContext context(*this); >- WKWebsiteDataStoreSetStatisticsHasHadNonRecentUserInteraction(dataStore, host, &context, resourceStatisticsVoidResultCallback); >- runUntil(context.done, noTimeout); >- m_currentInvocation->didSetHasHadNonRecentUserInteraction(); >-} >- > bool TestController::isStatisticsHasHadUserInteraction(WKStringRef host) > { > auto* dataStore = WKContextGetWebsiteDataStore(platformContext()); >@@ -2811,34 +2802,19 @@ void TestController::setStatisticsTimeToLiveUserInteraction(double seconds) > WKWebsiteDataStoreSetStatisticsTimeToLiveUserInteraction(dataStore, seconds); > } > >-void TestController::setStatisticsTimeToLiveCookiePartitionFree(double seconds) >-{ >- auto* dataStore = WKContextGetWebsiteDataStore(platformContext()); >- WKWebsiteDataStoreSetStatisticsTimeToLiveCookiePartitionFree(dataStore, seconds); >-} >- > void TestController::statisticsProcessStatisticsAndDataRecords() > { > auto* dataStore = WKContextGetWebsiteDataStore(platformContext()); > WKWebsiteDataStoreStatisticsProcessStatisticsAndDataRecords(dataStore); > } > >-void TestController::statisticsUpdateCookiePartitioning() >-{ >- auto* dataStore = WKContextGetWebsiteDataStore(platformContext()); >- ResourceStatisticsCallbackContext context(*this); >- WKWebsiteDataStoreStatisticsUpdateCookiePartitioning(dataStore, &context, resourceStatisticsVoidResultCallback); >- runUntil(context.done, noTimeout); >- m_currentInvocation->didSetPartitionOrBlockCookiesForHost(); >-} >- >-void TestController::statisticsSetShouldPartitionCookiesForHost(WKStringRef host, bool value) >+void TestController::statisticsUpdateCookieBlocking() > { > auto* dataStore = WKContextGetWebsiteDataStore(platformContext()); > ResourceStatisticsCallbackContext context(*this); >- WKWebsiteDataStoreSetStatisticsShouldPartitionCookiesForHost(dataStore, host, value, &context, resourceStatisticsVoidResultCallback); >+ WKWebsiteDataStoreStatisticsUpdateCookieBlocking(dataStore, &context, resourceStatisticsVoidResultCallback); > runUntil(context.done, noTimeout); >- m_currentInvocation->didSetPartitionOrBlockCookiesForHost(); >+ m_currentInvocation->didSetBlockCookiesForHost(); > } > > void TestController::statisticsSubmitTelemetry() >diff --git a/Tools/WebKitTestRunner/TestController.h b/Tools/WebKitTestRunner/TestController.h >index 002ab4d0562801a2da6ab513d907e054e1e8b126..42a2b6f74227b0dec77743c72c94ba34ce25f76b 100644 >--- a/Tools/WebKitTestRunner/TestController.h >+++ b/Tools/WebKitTestRunner/TestController.h >@@ -166,7 +166,6 @@ public: > bool isStatisticsRegisteredAsSubFrameUnder(WKStringRef subFrameHost, WKStringRef topFrameHost); > bool isStatisticsRegisteredAsRedirectingTo(WKStringRef hostRedirectedFrom, WKStringRef hostRedirectedTo); > void setStatisticsHasHadUserInteraction(WKStringRef hostName, bool value); >- void setStatisticsHasHadNonRecentUserInteraction(WKStringRef hostName); > bool isStatisticsHasHadUserInteraction(WKStringRef hostName); > void setStatisticsGrandfathered(WKStringRef hostName, bool value); > bool isStatisticsGrandfathered(WKStringRef hostName); >@@ -177,10 +176,8 @@ public: > void setStatisticsTopFrameUniqueRedirectTo(WKStringRef host, WKStringRef hostRedirectedTo); > void setStatisticsTopFrameUniqueRedirectFrom(WKStringRef host, WKStringRef hostRedirectedFrom); > void setStatisticsTimeToLiveUserInteraction(double seconds); >- void setStatisticsTimeToLiveCookiePartitionFree(double seconds); > void statisticsProcessStatisticsAndDataRecords(); >- void statisticsUpdateCookiePartitioning(); >- void statisticsSetShouldPartitionCookiesForHost(WKStringRef hostName, bool value); >+ void statisticsUpdateCookieBlocking(); > void statisticsSubmitTelemetry(); > void setStatisticsNotifyPagesWhenDataRecordsWereScanned(bool); > void setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(bool); >diff --git a/Tools/WebKitTestRunner/TestInvocation.cpp b/Tools/WebKitTestRunner/TestInvocation.cpp >index 79b18411b42c92d9e36b7addba03888168c0e41c..7d4fdac1806adc75a9c07499101357956cf71a81 100644 >--- a/Tools/WebKitTestRunner/TestInvocation.cpp >+++ b/Tools/WebKitTestRunner/TestInvocation.cpp >@@ -877,12 +877,6 @@ WKRetainPtr<WKTypeRef> TestInvocation::didReceiveSynchronousMessageFromInjectedB > return nullptr; > } > >- if (WKStringIsEqualToUTF8CString(messageName, "SetCookieStoragePartitioningEnabled")) { >- WKBooleanRef accept = static_cast<WKBooleanRef>(messageBody); >- WKCookieManagerSetCookieStoragePartitioningEnabled(WKContextGetCookieManager(TestController::singleton().context()), WKBooleanGetValue(accept)); >- return nullptr; >- } >- > if (WKStringIsEqualToUTF8CString(messageName, "SetCustomUserAgent")) { > WKStringRef userAgent = static_cast<WKStringRef>(messageBody); > WKPageSetCustomUserAgent(TestController::singleton().mainWebView()->page(), userAgent); >@@ -1155,13 +1149,6 @@ WKRetainPtr<WKTypeRef> TestInvocation::didReceiveSynchronousMessageFromInjectedB > return nullptr; > } > >- if (WKStringIsEqualToUTF8CString(messageName, "SetStatisticsHasHadNonRecentUserInteraction")) { >- ASSERT(WKGetTypeID(messageBody) == WKStringGetTypeID()); >- WKStringRef hostName = static_cast<WKStringRef>(messageBody); >- TestController::singleton().setStatisticsHasHadNonRecentUserInteraction(hostName); >- return nullptr; >- } >- > if (WKStringIsEqualToUTF8CString(messageName, "IsStatisticsHasHadUserInteraction")) { > ASSERT(WKGetTypeID(messageBody) == WKStringGetTypeID()); > >@@ -1285,37 +1272,16 @@ WKRetainPtr<WKTypeRef> TestInvocation::didReceiveSynchronousMessageFromInjectedB > return nullptr; > } > >- if (WKStringIsEqualToUTF8CString(messageName, "SetStatisticsTimeToLiveCookiePartitionFree")) { >- ASSERT(WKGetTypeID(messageBody) == WKDoubleGetTypeID()); >- WKDoubleRef seconds = static_cast<WKDoubleRef>(messageBody); >- TestController::singleton().setStatisticsTimeToLiveCookiePartitionFree(WKDoubleGetValue(seconds)); >- return nullptr; >- } >- > if (WKStringIsEqualToUTF8CString(messageName, "StatisticsProcessStatisticsAndDataRecords")) { > TestController::singleton().statisticsProcessStatisticsAndDataRecords(); > return nullptr; > } > >- if (WKStringIsEqualToUTF8CString(messageName, "StatisticsUpdateCookiePartitioning")) { >- TestController::singleton().statisticsUpdateCookiePartitioning(); >+ if (WKStringIsEqualToUTF8CString(messageName, "StatisticsUpdateCookieBlocking")) { >+ TestController::singleton().statisticsUpdateCookieBlocking(); > return nullptr; > } > >- if (WKStringIsEqualToUTF8CString(messageName, "StatisticsSetShouldPartitionCookiesForHost")) { >- ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID()); >- >- WKDictionaryRef messageBodyDictionary = static_cast<WKDictionaryRef>(messageBody); >- WKRetainPtr<WKStringRef> hostNameKey(AdoptWK, WKStringCreateWithUTF8CString("HostName")); >- WKRetainPtr<WKStringRef> valueKey(AdoptWK, WKStringCreateWithUTF8CString("Value")); >- >- WKStringRef hostName = static_cast<WKStringRef>(WKDictionaryGetItemForKey(messageBodyDictionary, hostNameKey.get())); >- WKBooleanRef value = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(messageBodyDictionary, valueKey.get())); >- >- TestController::singleton().statisticsSetShouldPartitionCookiesForHost(hostName, WKBooleanGetValue(value)); >- return nullptr; >- } >- > if (WKStringIsEqualToUTF8CString(messageName, "StatisticsSubmitTelemetry")) { > TestController::singleton().statisticsSubmitTelemetry(); > return nullptr; >@@ -1535,9 +1501,9 @@ void TestInvocation::didResetStatisticsToConsistentState() > WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()->page(), messageName.get(), 0); > } > >-void TestInvocation::didSetPartitionOrBlockCookiesForHost() >+void TestInvocation::didSetBlockCookiesForHost() > { >- WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("CallDidSetPartitionOrBlockCookiesForHost")); >+ WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("CallDidSetBlockCookiesForHost")); > WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()->page(), messageName.get(), 0); > } > >@@ -1577,12 +1543,6 @@ void TestInvocation::didSetHasHadUserInteraction() > WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()->page(), messageName.get(), 0); > } > >-void TestInvocation::didSetHasHadNonRecentUserInteraction() >-{ >- WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("CallDidSetHasHadNonRecentUserInteraction")); >- WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()->page(), messageName.get(), 0); >-} >- > void TestInvocation::didReceiveAllStorageAccessEntries(Vector<String>& domains) > { > WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("CallDidReceiveAllStorageAccessEntries")); >diff --git a/Tools/WebKitTestRunner/TestInvocation.h b/Tools/WebKitTestRunner/TestInvocation.h >index 4e24cc01cf48f3ebdda4f7ab519c0de570686156..72173b7ebdd5a068211aab9f23a178b7ec72938b 100644 >--- a/Tools/WebKitTestRunner/TestInvocation.h >+++ b/Tools/WebKitTestRunner/TestInvocation.h >@@ -73,14 +73,13 @@ public: > > void didClearStatisticsThroughWebsiteDataRemoval(); > void didResetStatisticsToConsistentState(); >- void didSetPartitionOrBlockCookiesForHost(); >+ void didSetBlockCookiesForHost(); > void didSetStatisticsDebugMode(); > void didSetPrevalentResourceForDebugMode(); > void didSetLastSeen(); > void didSetPrevalentResource(); > void didSetVeryPrevalentResource(); > void didSetHasHadUserInteraction(); >- void didSetHasHadNonRecentUserInteraction(); > void didReceiveAllStorageAccessEntries(Vector<String>& domains); > > void didRemoveAllSessionCredentials(); >diff --git a/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm b/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm >index e40946de96e6e0c1c848710fe132323536987a27..5d495eb736e5af76634fb9b3d062ff434790db15 100644 >--- a/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm >+++ b/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm >@@ -66,7 +66,6 @@ void initializeWebViewConfiguration(const char* libraryPath, WKStringRef injecte > globalWebViewConfiguration._applePayEnabled = YES; > > #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || PLATFORM(IOS) >- WKCookieManagerSetCookieStoragePartitioningEnabled(WKContextGetCookieManager(context), true); > WKCookieManagerSetStorageAccessAPIEnabled(WKContextGetCookieManager(context), true); > #endif > >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index d0d2217a236d4cdf45f67051de6ba9dbeeaec821..625bc12001a221dd76f2005519343e8182aef419 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,116 @@ >+2018-07-31 John Wilander <wilander@apple.com> >+ >+ Resource Load Statistics: Remove partitioned cookies for reduced complexity, lower memory footprint, and ability to support more platforms >+ https://bugs.webkit.org/show_bug.cgi?id=188109 >+ <rdar://problem/42664391> >+ >+ Reviewed by Brent Fulgham, Chris Dumez, and Alex Christensen. >+ >+ This patch removes cookie partitioning which reduces the model to just >+ blocked cookies (in third-party contexts) and first-party cookie access. >+ >+ Several of the changes are renaming to reflect that there are no more >+ cookie partitions. >+ >+ The changes to the Storage Access API tests also involve fixes for potential >+ flakiness by adopting several completion handlers in test functions. >+ >+ * http/tests/resourceLoadStatistics/add-blocking-to-redirect.html: >+ * http/tests/resourceLoadStatistics/add-partitioning-to-redirect-expected.txt: Removed. >+ * http/tests/resourceLoadStatistics/add-partitioning-to-redirect.html: Removed. >+ * http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-redirect-collusion.html: >+ * http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-redirect-to-prevalent.html: >+ * http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-collusion.html: >+ * http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-to-prevalent.html: >+ * http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-unique-redirects-to.html: >+ * http/tests/resourceLoadStatistics/classify-as-very-prevalent-based-on-mixed-statistics.html: >+ * http/tests/resourceLoadStatistics/cookie-deletion-expected.txt: Renamed from LayoutTests/http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion-expected.txt. >+ * http/tests/resourceLoadStatistics/cookie-deletion.html: Renamed from LayoutTests/http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion.html. >+ * http/tests/resourceLoadStatistics/cookies-with-and-without-user-interaction-expected.txt: Added. >+ * http/tests/resourceLoadStatistics/cookies-with-and-without-user-interaction.html: Renamed from LayoutTests/http/tests/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html. >+ * http/tests/resourceLoadStatistics/do-not-block-top-level-navigation-redirect.html: >+ * http/tests/resourceLoadStatistics/enable-debug-mode.html: >+ * http/tests/resourceLoadStatistics/grandfathering.html: >+ * http/tests/resourceLoadStatistics/non-prevalent-resource-with-user-interaction.html: >+ * http/tests/resourceLoadStatistics/non-prevalent-resource-without-user-interaction.html: >+ * http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context-expected.txt: >+ * http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html: >+ * http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html: >+ * http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html: >+ * http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html: >+ * http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html: >+ * http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html: >+ * http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html: >+ * http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout-expected.txt: Removed. >+ * http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html: Removed. >+ * http/tests/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction-expected.txt: Removed. >+ * http/tests/resourceLoadStatistics/remove-blocking-in-redirect-expected.txt: >+ * http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html: >+ * http/tests/resourceLoadStatistics/remove-partitioning-in-redirect-expected.txt: Removed. >+ * http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html: Removed. >+ * http/tests/resourceLoadStatistics/resources/get-cookies.php: >+ * http/tests/resourceLoadStatistics/resources/set-cookie-on-redirect.php: Added. >+ * http/tests/resourceLoadStatistics/resources/util.js: Added. >+ (setEnableFeature): >+ * http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-ip-to-localhost-to-ip.html: >+ * http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html: >+ * http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html: >+ * http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html: >+ * http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html: >+ * http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html: >+ * http/tests/resourceLoadStatistics/set-custom-prevalent-resource-in-debug-mode.html: >+ * http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects.html: >+ * http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-requests.html: >+ * http/tests/resourceLoadStatistics/telemetry-generation.html: >+ * http/tests/resourceLoadStatistics/third-party-cookie-with-and-without-user-interaction-expected.txt: Removed. >+ * http/tests/resourceLoadStatistics/third-party-cookie-with-and-without-user-interaction.html: Removed. >+ * http/tests/resourceLoadStatistics/user-interaction-in-cross-origin-sub-frame.html: >+ * http/tests/resourceLoadStatistics/user-interaction-only-reported-once-within-short-period-of-time.html: >+ * http/tests/resourceLoadStatistics/user-interaction-reported-after-website-data-removal.html: >+ * http/tests/storageAccess/deny-storage-access-under-opener.html: >+ * http/tests/storageAccess/grant-storage-access-under-opener-expected.txt: >+ * http/tests/storageAccess/grant-storage-access-under-opener.html: >+ * http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction-expected.txt: Removed. >+ * http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction.html: Removed. >+ * http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction.html: Removed. >+ * http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-user-interaction-expected.txt: Renamed from LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction-expected.txt. >+ * http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-user-interaction.html: Added. >+ * http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-expected.txt: Renamed from LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe-expected.txt. >+ * http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-pop-window-expected.txt: Renamed from LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe-pop-window-expected.txt. >+ * http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-pop-window.html: Added. >+ * http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe.html: Renamed from LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe.html. >+ * http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-expected.txt: Renamed from LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-expected.txt. >+ * http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame-expected.txt: Renamed from LayoutTests/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-expected.txt. >+ * http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame.html: Renamed from LayoutTests/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. >+ * http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-but-access-from-wrong-frame-expected.txt: Renamed from LayoutTests/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-expected.txt. >+ * http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-but-access-from-wrong-frame.html: Renamed from LayoutTests/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. >+ * http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-expected.txt: Renamed from LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-recent-user-interaction-expected.txt. >+ * http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction.html: Renamed from LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-recent-user-interaction.html. >+ * http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction-expected.txt: Renamed from LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction-expected.txt. >+ * http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction.html: Renamed from LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction.html. >+ * http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe.html: Renamed from LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe.html. >+ * http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-nested-iframe-expected.txt: Renamed from LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-nested-iframe-expected.txt. >+ * http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-nested-iframe.html: Renamed from LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-nested-iframe.html. >+ * http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access-expected.txt: >+ * http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access.html: >+ * http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access.html: >+ * http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe-pop-window.html: Removed. >+ * http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin.html: >+ * http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-allow-token.html: >+ * http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-user-gesture.html: >+ * http/tests/storageAccess/request-storage-access-same-origin-iframe.html: >+ * http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe-without-allow-token.html: >+ * http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe.html: >+ * http/tests/storageAccess/request-storage-access-top-frame.html: >+ * http/tests/storageAccess/resources/nesting-iframe.html: >+ * platform/ios/TestExpectations: >+ Test case renaming. >+ webkit.org/b/183216 removed since it's resolved. >+ * platform/mac-wk2/TestExpectations: >+ Test case renaming. >+ * platform/wk2/TestExpectations: >+ Test case renaming. >+ > 2018-07-31 Alex Christensen <achristensen@webkit.org> > > Remove Yosemite test results. >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/add-blocking-to-redirect.html b/LayoutTests/http/tests/resourceLoadStatistics/add-blocking-to-redirect.html >index bbb3145fbb1a09098ad50497750960572d0d361a..013919516cdfd68096f0aca3fe2e8f9b88e20af5 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/add-blocking-to-redirect.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/add-blocking-to-redirect.html >@@ -3,21 +3,13 @@ > <head> > <meta charset="UTF-8"> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> > </head> > <body> > <script> > description("Tests that blocking is added mid-flight in redirects."); > jsTestIsAsync = true; > >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- > const partitionHost = "127.0.0.1:8000"; > const thirdPartyOrigin = "http://localhost:8000"; > const resourcePath = "/resourceLoadStatistics/resources"; >@@ -56,14 +48,12 @@ > openIframe(redirectChainUrl + "&message=Redirect case 1, should receive first-party cookie.", runTest); > break; > case "#step4": >- // Set localhost as prevalent and with no user interaction to put it in the blocking category. >+ // Set localhost as prevalent to put it in the blocking category. > document.location.hash = "step5"; >- testRunner.setStatisticsPrevalentResource("http://localhost", true, function() { >- if (!testRunner.isStatisticsPrevalentResource("http://localhost")) >+ testRunner.setStatisticsPrevalentResource(thirdPartyOrigin, true, function() { >+ if (!testRunner.isStatisticsPrevalentResource(thirdPartyOrigin)) > testFailed("Host did not get set as prevalent resource."); >- testRunner.statisticsUpdateCookiePartitioning(function() { >- runTest(); >- }); >+ testRunner.statisticsUpdateCookieBlocking(runTest); > }); > break; > case "#step5": >@@ -99,12 +89,11 @@ > > if (document.location.hash === "") { > setEnableFeature(true, function () { >- if (testRunner.isStatisticsPrevalentResource("http://localhost")) >+ if (testRunner.isStatisticsPrevalentResource(thirdPartyOrigin)) > testFailed("Localhost was classified as prevalent resource before the test starts."); > testRunner.dumpChildFramesAsText(); > document.location.hash = "step1"; >- // Make sure the network process is up-to-date. >- testRunner.statisticsSetShouldPartitionCookiesForHost("localhost", false, runTest); >+ runTest(); > }); > } else { > runTest(); >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/add-partitioning-to-redirect-expected.txt b/LayoutTests/http/tests/resourceLoadStatistics/add-partitioning-to-redirect-expected.txt >deleted file mode 100644 >index 5ad72987ace38a50a5ac3c6242e4128f0ef1d0d2..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/resourceLoadStatistics/add-partitioning-to-redirect-expected.txt >+++ /dev/null >@@ -1,63 +0,0 @@ >-Tests that partitioning is added mid-flight in redirects. >- >-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >- >- >-PASS successfullyParsed is true >- >-TEST COMPLETE >- >- >--------- >-Frame: '<!--frame1-->' >--------- >-Should receive first-party cookie. >-Received cookie named 'firstPartyCookie'. >-Did not receive cookie named 'partitionedCookie'. >-Client-side document.cookie: firstPartyCookie=value >- >--------- >-Frame: '<!--frame2-->' >--------- >-Redirect case, should receive first-party cookie. >-Received cookie named 'firstPartyCookie'. >-Did not receive cookie named 'partitionedCookie'. >-Client-side document.cookie: firstPartyCookie=value >- >--------- >-Frame: '<!--frame3-->' >--------- >-Should receive no cookies. >-Did not receive cookie named 'firstPartyCookie'. >-Did not receive cookie named 'partitionedCookie'. >-Client-side document.cookie: >- >--------- >-Frame: '<!--frame4-->' >--------- >-Redirect case, should receive no cookie. >-Did not receive cookie named 'firstPartyCookie'. >-Did not receive cookie named 'partitionedCookie'. >-Client-side document.cookie: >- >--------- >-Frame: '<!--frame5-->' >--------- >-Set partitioned, third-party cookie. >- >- >--------- >-Frame: '<!--frame6-->' >--------- >-Should receive partitioned cookie. >-Did not receive cookie named 'firstPartyCookie'. >-Received cookie named 'partitionedCookie'. >-Client-side document.cookie: partitionedCookie=value >- >--------- >-Frame: '<!--frame7-->' >--------- >-Redirect case, should receive partitioned cookie. >-Did not receive cookie named 'firstPartyCookie'. >-Received cookie named 'partitionedCookie'. >-Client-side document.cookie: partitionedCookie=value >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/add-partitioning-to-redirect.html b/LayoutTests/http/tests/resourceLoadStatistics/add-partitioning-to-redirect.html >deleted file mode 100644 >index 01f020b4b93aee050ab51949856318d7a5f6d506..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/resourceLoadStatistics/add-partitioning-to-redirect.html >+++ /dev/null >@@ -1,117 +0,0 @@ >-<!DOCTYPE html> >-<html lang="en"> >-<head> >- <meta charset="UTF-8"> >- <script src="/js-test-resources/js-test.js"></script> >-</head> >-<body> >-<script> >- description("Tests that partitioning is added mid-flight in redirects."); >- jsTestIsAsync = true; >- >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- >- const partitionHost = "127.0.0.1:8000"; >- const thirdPartyOrigin = "http://localhost:8000"; >- const resourcePath = "/resourceLoadStatistics/resources"; >- const thirdPartyBaseUrl = thirdPartyOrigin + resourcePath; >- const firstPartyCookieName = "firstPartyCookie"; >- const subPathToSetFirstPartyCookie = "/set-cookie.php?name=" + firstPartyCookieName + "&value=value"; >- const partitionedCookieName = "partitionedCookie"; >- const subPathToSetPartitionedCookie = "/set-cookie.php?name=" + partitionedCookieName + "&value=value"; >- const returnUrl = "http://" + partitionHost + "/resourceLoadStatistics/add-partitioning-to-redirect.html"; >- const subPathToGetCookies = "/get-cookies.php?name1=" + firstPartyCookieName + "&name2=" + partitionedCookieName; >- const redirectChainUrl = "http://" + partitionHost + resourcePath + "/redirect.php?redirectTo=" + thirdPartyBaseUrl + subPathToGetCookies; >- >- function openIframe(url, onLoadHandler) { >- const element = document.createElement("iframe"); >- element.src = url; >- if (onLoadHandler) { >- element.onload = onLoadHandler; >- } >- document.body.appendChild(element); >- } >- >- function runTest() { >- switch (document.location.hash) { >- case "#step1": >- // Set first-party cookie for localhost. >- document.location.href = thirdPartyBaseUrl + subPathToSetFirstPartyCookie + "#" + returnUrl + "#step2"; >- break; >- case "#step2": >- // Check that the cookie gets sent for localhost under 127.0.0.1 since localhost is not prevalent. >- document.location.hash = "step3"; >- openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive first-party cookie.", runTest); >- break; >- case "#step3": >- document.location.hash = "step4"; >- // Load an iframe in a redirect chain that starts with 127.0.0.1 and ends with localhost. Expect a cookie for localhost. >- openIframe(redirectChainUrl + "&message=Redirect case, should receive first-party cookie.", runTest); >- break; >- case "#step4": >- // Set localhost as prevalent and with non-recent user interaction to put it in the partitioning category. >- document.location.hash = "step5"; >- testRunner.setStatisticsPrevalentResource("http://localhost", true, function() { >- if (!testRunner.isStatisticsPrevalentResource("http://localhost")) >- testFailed("Host did not get set as prevalent resource."); >- testRunner.setStatisticsHasHadNonRecentUserInteraction("http://localhost", function() { >- testRunner.statisticsUpdateCookiePartitioning(function() { >- runTest(); >- }); >- }); >- }); >- break; >- case "#step5": >- // Check that no cookie gets sent for localhost under 127.0.0.1 since localhost is partitioned. >- document.location.hash = "step6"; >- openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive no cookies.", runTest); >- break; >- case "#step6": >- // Load an iframe in a redirect chain that starts with 127.0.0.1 and ends with localhost. Expect no cookie for localhost. >- document.location.hash = "step7"; >- openIframe(redirectChainUrl + "&message=Redirect case, should receive no cookie.", runTest); >- break; >- case "#step7": >- // Set partitioned cookie for localhost under 127.0.0.1. >- document.location.hash = "step8"; >- openIframe(thirdPartyBaseUrl + subPathToSetPartitionedCookie + "&message=Set partitioned, third-party cookie.", runTest); >- break; >- case "#step8": >- // Check that partitioned cookie gets sent for localhost under 127.0.0.1 since localhost is partitioned. >- document.location.hash = "step9"; >- openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive partitioned cookie.", runTest); >- break; >- case "#step9": >- // Load an iframe in a redirect chain that starts with 127.0.0.1 and ends with localhost. Expect the partitioned cookie for localhost. >- document.location.hash = "step10"; >- openIframe(redirectChainUrl + "&message=Redirect case, should receive partitioned cookie.", runTest); >- break; >- case "#step10": >- setEnableFeature(false); >- finishJSTest(); >- break; >- } >- } >- >- if (document.location.hash === "") { >- setEnableFeature(true, function () { >- if (testRunner.isStatisticsPrevalentResource("http://localhost")) >- testFailed("Localhost was classified as prevalent resource before the test started."); >- testRunner.dumpChildFramesAsText(); >- document.location.hash = "step1"; >- // Make sure the network process is up-to-date. >- testRunner.statisticsSetShouldPartitionCookiesForHost("localhost", false, runTest); >- }); >- } else { >- runTest(); >- } >-</script> >-</body> >-</html> >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-redirect-collusion.html b/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-redirect-collusion.html >index c3bcd6d33df650d658898fc66ad8a43afc2b1e95..4d0d7c9dc9243eac22bad42c65d29317d0eecf09 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-redirect-collusion.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-redirect-collusion.html >@@ -3,6 +3,7 @@ > <head> > <meta charset="UTF-8"> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> > </head> > <body> > <script> >@@ -16,15 +17,6 @@ > const subresourceOrigin3 = "http://127.0.0.4:8000/temp"; > const subresourceOrigin4 = "http://127.0.0.5:8000/temp"; > >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- > function runTest() { > testRunner.statisticsNotifyObserver(); > >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-redirect-to-prevalent.html b/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-redirect-to-prevalent.html >index 6980ab475aae48e1e5f415000325425f01609ec9..d9cacd4858e0371cd6791201d90a69d53cdf26cb 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-redirect-to-prevalent.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-redirect-to-prevalent.html >@@ -3,6 +3,7 @@ > <head> > <meta charset="UTF-8"> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> > </head> > <body> > <script> >@@ -13,15 +14,6 @@ > const statisticsUrl = "http://" + hostUnderTest + "/temp"; > const topFrameOrigin1 = "http://127.0.0.2:8000/temp"; > >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- > function completeTest() { > if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) > testFailed("Host did not get classified as prevalent resource."); >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-collusion.html b/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-collusion.html >index 459bb1753e1557da14d081959f70fdc89d7e014a..452fbf49a8fd91f6821a47cd0a6acd2f1a4b8f02 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-collusion.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-collusion.html >@@ -3,6 +3,7 @@ > <head> > <meta charset="UTF-8"> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> > </head> > <body> > <script> >@@ -17,15 +18,6 @@ > const topFrameOrigin4 = "http://127.0.0.5:8000/temp"; > const topFrameOrigin5 = "http://localhost:8000/"; > >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- > function runTest() { > testRunner.setStatisticsTopFrameUniqueRedirectFrom(statisticsUrl, topFrameOrigin1); > testRunner.setStatisticsTopFrameUniqueRedirectFrom(topFrameOrigin1, topFrameOrigin2); >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-to-prevalent.html b/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-to-prevalent.html >index 9cb8870f5ff3523860a0e7ee69f840d470cb46a7..7bff973bf45c88d6687f4ab8c9cc75fb83b9aa87 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-to-prevalent.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-to-prevalent.html >@@ -3,6 +3,7 @@ > <head> > <meta charset="UTF-8"> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> > </head> > <body> > <script> >@@ -13,15 +14,6 @@ > const statisticsUrl = "http://" + hostUnderTest + "/temp"; > const topFrameOrigin1 = "http://127.0.0.2:8000/temp"; > >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- > function completeTest() { > if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) > testFailed("Host did not get classified as prevalent resource."); >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-unique-redirects-to.html b/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-unique-redirects-to.html >index 95977f94258a75afbff1ad18c5711f8a1870e112..e513fbe61a92f5d5b67b0f22478c732a97139372 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-unique-redirects-to.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-unique-redirects-to.html >@@ -3,6 +3,7 @@ > <head> > <meta charset="UTF-8"> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> > </head> > <body> > <script> >@@ -16,15 +17,6 @@ > const topFrameOrigin3 = "http://127.0.0.4:8000/temp"; > const topFrameOrigin4 = "http://127.0.0.5:8000/temp"; > >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- > function completeTest() { > if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) > testFailed("Host did not get classified as prevalent resource."); >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/classify-as-very-prevalent-based-on-mixed-statistics.html b/LayoutTests/http/tests/resourceLoadStatistics/classify-as-very-prevalent-based-on-mixed-statistics.html >index 040ca6a159a2401c6237020b1c382dc75051791b..3359f60f731d54cdeca40e799f69736768af4518 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/classify-as-very-prevalent-based-on-mixed-statistics.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/classify-as-very-prevalent-based-on-mixed-statistics.html >@@ -3,6 +3,7 @@ > <head> > <meta charset="UTF-8"> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> > </head> > <body> > <script> >@@ -17,15 +18,6 @@ > for (var i = startNum; i < numberOfSubresourceDomains + startNum; ++i) > topFrameOrigins.push("http://127.0.0." + i + ":8000/temp") > >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- > function completeTest() { > if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) > testFailed("Host did not get classified as prevalent resource."); >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/cookie-deletion-expected.txt b/LayoutTests/http/tests/resourceLoadStatistics/cookie-deletion-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..8b3fcfa04938379962dcd7a7bda43955022ec2e9 >--- /dev/null >+++ b/LayoutTests/http/tests/resourceLoadStatistics/cookie-deletion-expected.txt >@@ -0,0 +1,55 @@ >+Test for partitioned and unpartitioned cookie deletion. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >+ >+-------- >+Frame: '<!--frame1-->' >+-------- >+Should receive first-party cookie. >+Received cookie named 'firstPartyCookie'. >+Did not receive cookie named 'thirdPartyCookie'. >+Client-side document.cookie: firstPartyCookie=value >+ >+-------- >+Frame: '<!--frame2-->' >+-------- >+Should receive no cookies. >+Did not receive cookie named 'firstPartyCookie'. >+Did not receive cookie named 'thirdPartyCookie'. >+Client-side document.cookie: >+ >+-------- >+Frame: '<!--frame3-->' >+-------- >+Try to set third party cookie. >+ >+ >+-------- >+Frame: '<!--frame4-->' >+-------- >+Should receive no cookies. >+Did not receive cookie named 'firstPartyCookie'. >+Did not receive cookie named 'thirdPartyCookie'. >+Client-side document.cookie: >+ >+-------- >+Frame: '<!--frame5-->' >+-------- >+After removal, should receive no cookies. >+Did not receive cookie named 'firstPartyCookie'. >+Did not receive cookie named 'thirdPartyCookie'. >+Client-side document.cookie: >+ >+-------- >+Frame: '<!--frame6-->' >+-------- >+After declassified, should receive no cookies. >+Did not receive cookie named 'firstPartyCookie'. >+Did not receive cookie named 'thirdPartyCookie'. >+Client-side document.cookie: >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/cookie-deletion.html b/LayoutTests/http/tests/resourceLoadStatistics/cookie-deletion.html >new file mode 100644 >index 0000000000000000000000000000000000000000..17d85300aacc5111bb69549617bec4d6e119db78 >--- /dev/null >+++ b/LayoutTests/http/tests/resourceLoadStatistics/cookie-deletion.html >@@ -0,0 +1,115 @@ >+<!DOCTYPE html> >+<html lang="en"> >+<head> >+ <meta charset="UTF-8"> >+ <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> >+</head> >+<body> >+<script> >+ description("Test for partitioned and unpartitioned cookie deletion."); >+ jsTestIsAsync = true; >+ >+ const partitionHost = "127.0.0.1:8000"; >+ const thirdPartyOrigin = "http://localhost:8000"; >+ const thirdPartyBaseUrl = thirdPartyOrigin + "/resourceLoadStatistics/resources"; >+ const firstPartyCookieName = "firstPartyCookie"; >+ const subPathToSetFirstPartyCookie = "/set-cookie.php?name=" + firstPartyCookieName + "&value=value"; >+ const thirdPartyCookieName = "thirdPartyCookie"; >+ const subPathToSetThirdPartyCookie = "/set-cookie.php?name=" + thirdPartyCookieName + "&value=value"; >+ const fragmentWithReturnUrl = "http://" + partitionHost + "/resourceLoadStatistics/cookie-deletion.html"; >+ const subPathToGetCookies = "/get-cookies.php?name1=" + firstPartyCookieName + "&name2=" + thirdPartyCookieName; >+ >+ function finishTest() { >+ setEnableFeature(false, finishJSTest); >+ } >+ >+ function openIframe(url, onLoadHandler) { >+ const element = document.createElement("iframe"); >+ element.src = url; >+ if (onLoadHandler) { >+ element.onload = onLoadHandler; >+ } >+ document.body.appendChild(element); >+ } >+ >+ >+ function fireDataModificationHandlerAndContinue() { >+ testRunner.installStatisticsDidScanDataRecordsCallback(function() { >+ setTimeout(runTest, 500); >+ }); >+ testRunner.statisticsProcessStatisticsAndDataRecords(); >+ } >+ >+ function setAsNonPrevalentAndContinue() { >+ testRunner.setStatisticsPrevalentResource(thirdPartyOrigin, false, function() { >+ if (testRunner.isStatisticsPrevalentResource(thirdPartyOrigin)) >+ testFailed("Host still set as prevalent resource."); >+ testRunner.statisticsUpdateCookieBlocking(runTest); >+ }); >+ } >+ >+ function runTest() { >+ switch (document.location.hash) { >+ case "#step1": >+ // Set first-party cookie for localhost. >+ document.location.href = thirdPartyBaseUrl + subPathToSetFirstPartyCookie + "#" + fragmentWithReturnUrl + "#step2"; >+ break; >+ case "#step2": >+ // Check that the third-party has access to its first-party cookies. >+ document.location.hash = "step3"; >+ openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive first-party cookie.", runTest); >+ break; >+ case "#step3": >+ // Classify localhost as prevalent. >+ document.location.hash = "step4"; >+ testRunner.setStatisticsPrevalentResource(thirdPartyOrigin, true, function() { >+ if (!testRunner.isStatisticsPrevalentResource(thirdPartyOrigin)) >+ testFailed("Host did not get set as prevalent resource."); >+ testRunner.statisticsUpdateCookieBlocking(runTest); >+ }); >+ break; >+ case "#step4": >+ // Check that the third-party no longer has access to its first-party cookies. >+ document.location.hash = "step5"; >+ openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive no cookies.", runTest); >+ break; >+ case "#step5": >+ // Try setting a cookie as third-party. >+ document.location.hash = "step6"; >+ openIframe(thirdPartyBaseUrl + subPathToSetThirdPartyCookie + "&message=Try to set third party cookie.", runTest); >+ break; >+ case "#step6": >+ // Check that the third-party still has no access to cookies and then fire data record removal. >+ document.location.hash = "step7"; >+ openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive no cookies.", fireDataModificationHandlerAndContinue); >+ break; >+ case "#step7": >+ // Check that the third-party still has no access to cookies and then declassify localhost. >+ document.location.hash = "step8"; >+ openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=After removal, should receive no cookies.", setAsNonPrevalentAndContinue); >+ break; >+ case "#step8": >+ // Check that the third-party still has no access to cookies. >+ openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=After declassified, should receive no cookies.", finishTest); >+ break; >+ } >+ } >+ >+ if (document.location.host === partitionHost && document.location.hash === "" && window.testRunner && window.internals) { >+ setEnableFeature(true, function() { >+ testRunner.setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(false); >+ testRunner.setStatisticsMinimumTimeBetweenDataRecordsRemoval(0); >+ >+ testRunner.dumpChildFramesAsText(); >+ document.location.hash = "step1"; >+ >+ runTest(); >+ }); >+ } else { >+ runTest(); >+ } >+ >+</script> >+</body> >+</html> >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/cookies-with-and-without-user-interaction-expected.txt b/LayoutTests/http/tests/resourceLoadStatistics/cookies-with-and-without-user-interaction-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..5d1092efdeee46fac6e36ac076d814d2bbe5c7b9 >--- /dev/null >+++ b/LayoutTests/http/tests/resourceLoadStatistics/cookies-with-and-without-user-interaction-expected.txt >@@ -0,0 +1,25 @@ >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >+ >+-------- >+Frame: '<!--frame1-->' >+-------- >+Should receive first-party cookie. >+Received cookie named 'firstPartyCookie'. >+Client-side document.cookie: firstPartyCookie=value >+ >+-------- >+Frame: '<!--frame2-->' >+-------- >+Should receive no cookies. >+Did not receive cookie named 'firstPartyCookie'. >+Client-side document.cookie: >+ >+-------- >+Frame: '<!--frame3-->' >+-------- >+After user interaction, should still receive no cookies. >+Did not receive cookie named 'firstPartyCookie'. >+Client-side document.cookie: >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/cookies-with-and-without-user-interaction.html b/LayoutTests/http/tests/resourceLoadStatistics/cookies-with-and-without-user-interaction.html >new file mode 100644 >index 0000000000000000000000000000000000000000..8267739c4bff3f72ef1048f628bdfff98add4c06 >--- /dev/null >+++ b/LayoutTests/http/tests/resourceLoadStatistics/cookies-with-and-without-user-interaction.html >@@ -0,0 +1,83 @@ >+<!DOCTYPE html> >+<html lang="en"> >+<head> >+ <meta charset="UTF-8"> >+ <title>Test for Partitioned Cookies With and Without User Interaction</title> >+ <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> >+</head> >+<body> >+<script> >+ const partitionHost = "127.0.0.1:8000"; >+ const thirdPartyOrigin = "http://localhost:8000"; >+ const thirdPartyBaseUrl = thirdPartyOrigin + "/resourceLoadStatistics/resources"; >+ const firstPartyCookieName = "firstPartyCookie"; >+ const subPathToSetFirstPartyCookie = "/set-cookie.php?name=" + firstPartyCookieName + "&value=value"; >+ const fragmentWithReturnUrl = "http://127.0.0.1:8000/resourceLoadStatistics/cookies-with-and-without-user-interaction.html"; >+ const subPathToGetCookies = "/get-cookies.php?name1=" + firstPartyCookieName; >+ >+ function finishTest() { >+ setEnableFeature(false, function() { >+ testRunner.notifyDone(); >+ }); >+ } >+ >+ function openIframe(url, onLoadHandler) { >+ const element = document.createElement("iframe"); >+ element.src = url; >+ if (onLoadHandler) { >+ element.onload = onLoadHandler; >+ } >+ document.body.appendChild(element); >+ } >+ >+ function setUserInteractionAndContinue() { >+ testRunner.setStatisticsHasHadUserInteraction(thirdPartyOrigin, true, function() { >+ if (!testRunner.isStatisticsHasHadUserInteraction(thirdPartyOrigin)) >+ testFailed("Third party did not get logged for user interaction."); >+ runTest(); >+ }); >+ } >+ >+ function runTest() { >+ switch (document.location.hash) { >+ case "#step1": >+ document.location.href = thirdPartyBaseUrl + subPathToSetFirstPartyCookie + "#" + fragmentWithReturnUrl + "#step2"; >+ break; >+ case "#step2": >+ document.location.hash = "step3"; >+ openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive first-party cookie.", runTest); >+ break; >+ case "#step3": >+ document.location.hash = "step4"; >+ testRunner.setStatisticsPrevalentResource(thirdPartyOrigin, true, function() { >+ if (!testRunner.isStatisticsPrevalentResource(thirdPartyOrigin)) >+ testFailed("Host did not get set as prevalent resource."); >+ testRunner.statisticsUpdateCookieBlocking(runTest); >+ }); >+ break; >+ case "#step4": >+ document.location.hash = "step5"; >+ openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive no cookies.", setUserInteractionAndContinue); >+ break; >+ case "#step5": >+ openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=After user interaction, should still receive no cookies.", finishTest); >+ break; >+ } >+ } >+ >+ if (document.location.host === partitionHost && document.location.hash == "" && window.testRunner && window.internals) { >+ setEnableFeature(true, function() { >+ testRunner.waitUntilDone(); >+ testRunner.dumpChildFramesAsText(); >+ document.location.hash = "step1"; >+ if (testRunner.isStatisticsPrevalentResource(thirdPartyOrigin)) >+ testFailed("Localhost was classified as prevalent resource before the test starts."); >+ runTest(); >+ }); >+ } else { >+ runTest(); >+ } >+</script> >+</body> >+</html> >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/do-not-block-top-level-navigation-redirect.html b/LayoutTests/http/tests/resourceLoadStatistics/do-not-block-top-level-navigation-redirect.html >index 01a37819d433371e19b9f4e27e51b25feeb4db93..5183e69f18de832c944a5eab5f8460651856b39f 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/do-not-block-top-level-navigation-redirect.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/do-not-block-top-level-navigation-redirect.html >@@ -8,7 +8,6 @@ > jsTestIsAsync = true; > > internals.setResourceLoadStatisticsEnabled(true); >- testRunner.setCookieStoragePartitioningEnabled(true); > > function doRedirect() > { >@@ -18,7 +17,7 @@ > finishJSTest(); > } > else >- window.location = "http://localhost:8000/cookies/resources/set-cookie-on-redirect.php?step=1"; >+ document.location.href = "http://localhost:8000/resourceLoadStatistics/resources/set-cookie-on-redirect.php?step=1"; > }); > } > </script> >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/enable-debug-mode.html b/LayoutTests/http/tests/resourceLoadStatistics/enable-debug-mode.html >index 0250d529905c219dc4b96cdf07984a4f40d28d32..0161565f6224fdde6b03c331619844bce3a20283 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/enable-debug-mode.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/enable-debug-mode.html >@@ -3,6 +3,7 @@ > <head> > <meta charset="UTF-8"> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> > </head> > <body> > <script> >@@ -11,16 +12,6 @@ > > const thirdPartyOrigin = "http://3rdpartytestwebkit.org"; > >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- > if (window.testRunner && window.internals) { > setEnableFeature(true, function() { > if (testRunner.isStatisticsPrevalentResource(thirdPartyOrigin)) >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/grandfathering.html b/LayoutTests/http/tests/resourceLoadStatistics/grandfathering.html >index 6cbd8723351f2c880f1be82bf43470770862d7b3..b1ba5e7025ff81955e2e681bb70180845aac50ba 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/grandfathering.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/grandfathering.html >@@ -4,6 +4,7 @@ > <meta charset="UTF-8"> > <title>Test for Grandfathering</title> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> > </head> > <body> > <script> >@@ -18,16 +19,6 @@ > const thirdPartyBaseUrl = thirdPartyOrigin + "/resourceLoadStatistics/resources"; > const subPathToSetThirdPartyCookie = "/set-cookie.php?name=" + thirdPartyCookieName + "&value=" + cookieValue; > >- function setEnableFeature(enable, completionHandler) { >- testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(enable); >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- > function finishTest() { > setEnableFeature(false, function() { > testRunner.notifyDone(); >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/non-prevalent-resource-with-user-interaction.html b/LayoutTests/http/tests/resourceLoadStatistics/non-prevalent-resource-with-user-interaction.html >index e4adbde829c8ee7a8ad045d8f8d793665ad8bd8f..69dd4c4266eae6f811909798b07bfef162af9ad3 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/non-prevalent-resource-with-user-interaction.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/non-prevalent-resource-with-user-interaction.html >@@ -4,6 +4,7 @@ > <meta charset="UTF-8"> > <title>Tests for Non-Prevalent Resource With User Interaction</title> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> > </head> > <body> > <script> >@@ -11,15 +12,6 @@ > const statisticsUrl = "http://" + hostUnderTest + "/temp"; > const otherPrevalentUrl = "http://localhost:8000/temp"; > >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- > function runTestRunnerTest() { > if (document.cookie !== "") > testFailed("document.cookie not empty."); >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/non-prevalent-resource-without-user-interaction.html b/LayoutTests/http/tests/resourceLoadStatistics/non-prevalent-resource-without-user-interaction.html >index 3b9aff4025577f359e67e4b7f08437fd3d1c3c8a..f346d3b376868e116af782730c2c630f943ff954 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/non-prevalent-resource-without-user-interaction.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/non-prevalent-resource-without-user-interaction.html >@@ -4,6 +4,7 @@ > <meta charset="UTF-8"> > <title>Tests for Non-Prevalent Resource Without User Interaction</title> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> > </head> > <body> > <script> >@@ -11,15 +12,6 @@ > const statisticsUrl = "http://" + hostUnderTest + "/temp"; > const otherPrevalentUrl = "http://localhost:8000/temp"; > >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- > function runTestRunnerTest() { > if (document.cookie !== "") > testFailed("document.cookie not empty."); >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context-expected.txt b/LayoutTests/http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context-expected.txt >index 73f18d01366d2387278412e88c10fa42764b03d7..0fb97f91fcd33cc978979cd48a55a49474d27711 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context-expected.txt >+++ b/LayoutTests/http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context-expected.txt >@@ -1,34 +1,11 @@ > PASS successfullyParsed is true > > TEST COMPLETE >- >+ > > -------- > Frame: '<!--frame1-->' > -------- > Should receive one cookie. > Received cookie named 'firstPartyCookie'. >-Did not receive cookie named 'partitionedCookie'. > Client-side document.cookie: firstPartyCookie=value >- >--------- >-Frame: '<!--frame2-->' >--------- >-Setting partitioned, third party cookie. >- >- >--------- >-Frame: '<!--frame3-->' >--------- >-Should receive one partitioned, third party cookie. >-Did not receive cookie named 'firstPartyCookie'. >-Received cookie named 'partitionedCookie'. >-Client-side document.cookie: partitionedCookie=value >- >--------- >-Frame: '<!--frame4-->' >--------- >-After user interaction, should still only receive one partitioned, third party cookie. >-Did not receive cookie named 'firstPartyCookie'. >-Received cookie named 'partitionedCookie'. >-Client-side document.cookie: partitionedCookie=value >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html b/LayoutTests/http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html >index 4669c571534b3d39801f138833e4bcd072d30016..02fc923a8551776a073708f96477b81fb8fb3d69 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html >@@ -4,29 +4,17 @@ > <meta charset="UTF-8"> > <title>Test to ensure non-prevalent resources can access their cookies in a third party context</title> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> > </head> > <body> > <script> > const partitionHost = "127.0.0.1:8000"; >- const thirdPartyHostname = "localhost"; >- const thirdPartyOrigin = "http://" + thirdPartyHostname + ":8000"; >+ const thirdPartyOrigin = "http://localhost:8000"; > const thirdPartyBaseUrl = thirdPartyOrigin + "/resourceLoadStatistics/resources"; > const firstPartyCookieName = "firstPartyCookie"; > const subPathToSetFirstPartyCookie = "/set-cookie.php?name=" + firstPartyCookieName + "&value=value"; >- const partitionedCookieName = "partitionedCookie"; >- const subPathToSetPartitionedCookie = "/set-cookie.php?name=" + partitionedCookieName + "&value=value"; > const fragmentWithReturnUrl = "http://127.0.0.1:8000/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html"; >- const subPathToGetCookies = "/get-cookies.php?name1=" + firstPartyCookieName + "&name2=" + partitionedCookieName; >- >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >+ const subPathToGetCookies = "/get-cookies.php?name1=" + firstPartyCookieName; > > function finishTest() { > setEnableFeature(false, function() { >@@ -43,14 +31,6 @@ > document.body.appendChild(element); > } > >- function setUserInteractionAndContinue() { >- testRunner.setStatisticsHasHadUserInteraction(thirdPartyOrigin, true, function() { >- if (!testRunner.isStatisticsHasHadUserInteraction(thirdPartyOrigin)) >- testFailed("Third party did not get logged for user interaction."); >- runTest(); >- }); >- } >- > function runTest() { > switch (document.location.hash) { > case "#step1": >@@ -59,27 +39,7 @@ > break; > case "#step2": > // Load localhost under 127.0.0.1 and check that it gets its cookie. >- document.location.hash = "step3"; >- openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive one cookie.", runTest); >- break; >- case "#step3": >- // Setup localhost for partitioning. >- document.location.hash = "step4"; >- testRunner.statisticsSetShouldPartitionCookiesForHost(thirdPartyHostname, true, runTest); >- break; >- case "#step4": >- // Set a partitioned cookie for localhost under 127.0.0.1. >- document.location.hash = "step5"; >- openIframe(thirdPartyBaseUrl + subPathToSetPartitionedCookie + "&message=Setting partitioned, third party cookie.", runTest); >- break; >- case "#step5": >- // Load localhost under 127.0.0.1 and check that it gets only the partitioned cookie. End by acquiring user interaction for localhost. >- document.location.hash = "step6"; >- openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive one partitioned, third party cookie.", setUserInteractionAndContinue); >- break; >- case "#step6": >- // Load localhost under 127.0.0.1 and check that it still gets partitioned cookie after user interaction. >- openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=After user interaction, should still only receive one partitioned, third party cookie.", finishTest); >+ openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive one cookie.", finishTest); > break; > } > } >@@ -88,11 +48,10 @@ > testRunner.waitUntilDone(); > testRunner.dumpChildFramesAsText(); > setEnableFeature(true, function() { >- testRunner.setStatisticsPrevalentResource(thirdPartyHostname, false, function() { >+ testRunner.setStatisticsPrevalentResource(thirdPartyOrigin, false, function() { > testRunner.setStatisticsHasHadUserInteraction(thirdPartyOrigin, false, function() { > document.location.hash = "step1"; >- >- testRunner.statisticsSetShouldPartitionCookiesForHost(thirdPartyHostname, false, runTest); >+ testRunner.statisticsUpdateCookieBlocking(runTest); > }); > }); > }); >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html b/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html >index 47523952b4ee429dc840ca459aa7df0550c3731a..176ece0a991caec152b112a3c2bb95e927110ecc 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html >@@ -2,20 +2,12 @@ > <html> > <head> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> > <script> > description("Tests that redirects for a non-sandboxed iframe get counted properly."); > jsTestIsAsync = true; > window.addEventListener("message", receiveMessage, false); > >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- > function finishTest() { > setEnableFeature(false, finishJSTest); > } >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html b/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html >index 67fa05c26d90a36df5df64ead0ef35f98da5980d..91ec5772f1939a4d143455d3a3cec676c931f349 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html >@@ -2,20 +2,12 @@ > <html> > <head> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> > <script> > description("Tests that redirects for a non-sandboxed iframe get counted properly."); > jsTestIsAsync = true; > window.addEventListener("message", receiveMessage, false); > >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- > function finishTest() { > setEnableFeature(false, finishJSTest); > } >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html b/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html >index 5fb23a18de601fe8fc50ecc07c385a0ec62acbb2..2bf1f85ba47962283af3a38cee8dd70688a0862f 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html >@@ -2,20 +2,12 @@ > <html> > <head> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> > <script> > description("Tests that redirects for a non-sandboxed iframe nested in a non-sandboxed iframe get counted properly."); > jsTestIsAsync = true; > window.addEventListener("message", receiveMessage, false); > >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- > function finishTest() { > setEnableFeature(false, finishJSTest); > } >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html b/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html >index 3a123e8555fb2ce5a13e5c48bd8fb3f7d8aef294..000785fb7e7353a57f022685c9f682026a3e1ed8 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html >@@ -2,20 +2,12 @@ > <html> > <head> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> > <script> > description("Tests that redirects for a non-sandboxed iframe nested in a non-sandboxed iframe get counted properly."); > jsTestIsAsync = true; > window.addEventListener("message", receiveMessage, false); > >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- > function finishTest() { > setEnableFeature(false, finishJSTest); > } >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html b/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html >index c1b37b96f6b2ef443f5f86777acc167fe62e75e1..a7640f313bd8c23292024a0dd20ae7df95549728 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html >@@ -2,20 +2,12 @@ > <html> > <head> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> > <script> > description("Tests that redirects for a sandboxed iframe nested in a non-sandboxed iframe get counted properly."); > jsTestIsAsync = true; > window.addEventListener("message", receiveMessage, false); > >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- > function finishTest() { > setEnableFeature(false, finishJSTest); > } >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html b/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html >index 9ece22742b787edc2c582f30712cb82afa709b0a..ba965b97c0f1ad2db111157b3c2e46952548b81e 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html >@@ -2,20 +2,12 @@ > <html> > <head> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> > <script> > description("Tests that redirects for a sandboxed iframe nested in a non-sandboxed iframe get counted properly."); > jsTestIsAsync = true; > window.addEventListener("message", receiveMessage, false); > >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- > function finishTest() { > setEnableFeature(false, finishJSTest); > } >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion-expected.txt b/LayoutTests/http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion-expected.txt >deleted file mode 100644 >index 24cdd2c7b066e90d71f99b89f09aa10410057f8a..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion-expected.txt >+++ /dev/null >@@ -1,47 +0,0 @@ >-Test for partitioned and unpartitioned cookie deletion. >- >-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >- >- >-PASS successfullyParsed is true >- >-TEST COMPLETE >- >- >--------- >-Frame: '<!--frame1-->' >--------- >-Should receive no cookies. >-Did not receive cookie named 'firstPartyCookie'. >-Did not receive cookie named 'thirdPartyCookie'. >-Client-side document.cookie: >- >--------- >-Frame: '<!--frame2-->' >--------- >-Setting partitioned, third party cookie. >- >- >--------- >-Frame: '<!--frame3-->' >--------- >-Should only receive partitioned, third party cookie. >-Did not receive cookie named 'firstPartyCookie'. >-Received cookie named 'thirdPartyCookie'. >-Client-side document.cookie: thirdPartyCookie=value >- >--------- >-Frame: '<!--frame4-->' >--------- >-After removal, should receive no cookies. >-Did not receive cookie named 'firstPartyCookie'. >-Did not receive cookie named 'thirdPartyCookie'. >-Client-side document.cookie: >- >--------- >-Frame: '<!--frame5-->' >--------- >-After user interaction, should receive no cookies. >-Did not receive cookie named 'firstPartyCookie'. >-Did not receive cookie named 'thirdPartyCookie'. >-Client-side document.cookie: >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion.html b/LayoutTests/http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion.html >deleted file mode 100644 >index 28fa0b5a0f811d452f8d30aa5665bf124b89f22b..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion.html >+++ /dev/null >@@ -1,113 +0,0 @@ >-<!DOCTYPE html> >-<html lang="en"> >-<head> >- <meta charset="UTF-8"> >- <script src="/js-test-resources/js-test.js"></script> >-</head> >-<body> >-<script> >- description("Test for partitioned and unpartitioned cookie deletion."); >- jsTestIsAsync = true; >- >- const partitionHost = "127.0.0.1:8000"; >- const thirdPartyOrigin = "http://localhost:8000"; >- const thirdPartyBaseUrl = thirdPartyOrigin + "/resourceLoadStatistics/resources"; >- const firstPartyCookieName = "firstPartyCookie"; >- const subPathToSetFirstPartyCookie = "/set-cookie.php?name=" + firstPartyCookieName + "&value=value"; >- const thirdPartyCookieName = "thirdPartyCookie"; >- const subPathToSetThirdPartyCookie = "/set-cookie.php?name=" + thirdPartyCookieName + "&value=value"; >- const fragmentWithReturnUrl = "http://" + partitionHost + "/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion.html"; >- const subPathToGetCookies = "/get-cookies.php?name1=" + firstPartyCookieName + "&name2=" + thirdPartyCookieName; >- >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- >- function finishTest() { >- setEnableFeature(false, finishJSTest); >- } >- >- function openIframe(url, onLoadHandler) { >- const element = document.createElement("iframe"); >- element.src = url; >- if (onLoadHandler) { >- element.onload = onLoadHandler; >- } >- document.body.appendChild(element); >- } >- >- >- function fireDataModificationHandlerAndContinue() { >- testRunner.installStatisticsDidScanDataRecordsCallback(function() { >- setTimeout(runTest, 500); >- }); >- testRunner.statisticsProcessStatisticsAndDataRecords(); >- } >- >- function setUserInteractionAndContinue() { >- testRunner.setStatisticsHasHadUserInteraction(thirdPartyOrigin, true, function() { >- if (!testRunner.isStatisticsHasHadUserInteraction(thirdPartyOrigin)) >- testFailed("Third party did not get logged for user interaction."); >- runTest(); >- }); >- } >- >- function runTest() { >- switch (document.location.hash) { >- case "#step1": >- document.location.href = thirdPartyBaseUrl + subPathToSetFirstPartyCookie + "#" + fragmentWithReturnUrl + "#step2"; >- break; >- case "#step2": >- document.location.hash = "step3"; >- openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive no cookies.", runTest); >- break; >- case "#step3": >- document.location.hash = "step4"; >- openIframe(thirdPartyBaseUrl + subPathToSetThirdPartyCookie + "&message=Setting partitioned, third party cookie.", runTest); >- break; >- case "#step4": >- document.location.hash = "step5"; >- openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should only receive partitioned, third party cookie.", fireDataModificationHandlerAndContinue); >- break; >- case "#step5": >- document.location.hash = "step6"; >- setTimeout(runTest, 10); >- break; >- case "#step6": >- document.location.hash = "step7"; >- openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=After removal, should receive no cookies.", setUserInteractionAndContinue); >- break; >- case "#step7": >- openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=After user interaction, should receive no cookies.", finishTest); >- break; >- } >- } >- >- if (document.location.host === partitionHost && document.location.hash === "" && window.testRunner && window.internals) { >- setEnableFeature(true, function() { >- testRunner.setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(false); >- testRunner.setStatisticsMinimumTimeBetweenDataRecordsRemoval(0); >- >- testRunner.dumpChildFramesAsText(); >- document.location.hash = "step1"; >- >- testRunner.setStatisticsPrevalentResource("http://localhost", true, function() { >- if (!testRunner.isStatisticsPrevalentResource("http://localhost")) >- testFailed("Host did not get set as prevalent resource."); >- >- testRunner.statisticsSetShouldPartitionCookiesForHost("localhost", true, runTest); >- }); >- }); >- } else { >- runTest(); >- } >- >-</script> >-</body> >-</html> >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout-expected.txt b/LayoutTests/http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout-expected.txt >deleted file mode 100644 >index 50e82c81652ca42bdf0598f59ba8e946907cde2a..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout-expected.txt >+++ /dev/null >@@ -1,50 +0,0 @@ >-PASS successfullyParsed is true >- >-TEST COMPLETE >- >- >--------- >-Frame: '<!--frame1-->' >--------- >-Should receive no cookies. >-Did not receive cookie named 'firstPartyCookie'. >-Did not receive cookie named 'thirdPartyCookie'. >-Client-side document.cookie: >- >--------- >-Frame: '<!--frame2-->' >--------- >-Setting partitioned, third-party cookie. >- >- >--------- >-Frame: '<!--frame3-->' >--------- >-Should only receive partitioned, third-party cookie. >-Did not receive cookie named 'firstPartyCookie'. >-Received cookie named 'thirdPartyCookie'. >-Client-side document.cookie: thirdPartyCookie=value >- >--------- >-Frame: '<!--frame4-->' >--------- >-After first user interaction, should still only receive a partitioned, third-party cookie. >-Did not receive cookie named 'firstPartyCookie'. >-Received cookie named 'thirdPartyCookie'. >-Client-side document.cookie: thirdPartyCookie=value >- >--------- >-Frame: '<!--frame5-->' >--------- >-Should only receive partitioned, third-party cookie. >-Did not receive cookie named 'firstPartyCookie'. >-Received cookie named 'thirdPartyCookie'. >-Client-side document.cookie: thirdPartyCookie=value >- >--------- >-Frame: '<!--frame6-->' >--------- >-After second user interaction, should still only receive a partitioned, third-party cookie. >-Did not receive cookie named 'firstPartyCookie'. >-Received cookie named 'thirdPartyCookie'. >-Client-side document.cookie: thirdPartyCookie=value >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html b/LayoutTests/http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html >deleted file mode 100644 >index beff3a39be1e77c00d6f45f9fde6d33b1b7e04a6..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html >+++ /dev/null >@@ -1,129 +0,0 @@ >-<!DOCTYPE html> >-<html lang="en"> >-<head> >- <meta charset="UTF-8"> >- <title>Test for Partitioned and Unpartitioned Cookie With User Interaction</title> >- <script src="/js-test-resources/js-test.js"></script> >-</head> >-<body> >-<script> >- const partitionHost = "127.0.0.1:8000"; >- const thirdPartyOrigin = "http://localhost:8000"; >- const thirdPartyBaseUrl = thirdPartyOrigin + "/resourceLoadStatistics/resources"; >- const firstPartyCookieName = "firstPartyCookie"; >- const subPathToSetFirstPartyCookie = "/set-cookie.php?name=" + firstPartyCookieName + "&value=value"; >- const thirdPartyCookieName = "thirdPartyCookie"; >- const subPathToSetThirdPartyCookie = "/set-cookie.php?name=" + thirdPartyCookieName + "&value=value"; >- const fragmentWithReturnUrl = "http://" + partitionHost + "/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html"; >- const subPathToGetCookies = "/get-cookies.php?name1=" + firstPartyCookieName + "&name2=" + thirdPartyCookieName; >- >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- >- function finishTest() { >- setEnableFeature(false, function() { >- testRunner.notifyDone(); >- }); >- } >- >- function openIframe(url, onLoadHandler) { >- const element = document.createElement("iframe"); >- element.src = url; >- if (onLoadHandler) { >- element.onload = onLoadHandler; >- } >- document.body.appendChild(element); >- } >- >- function fireShouldPartitionCookiesHandlerAndContinue() { >- testRunner.statisticsUpdateCookiePartitioning(runTest); >- } >- >- function setShortCookiePartitioningTimeOutPlusFireShouldPartitionCookiesHandlerAndContinue() { >- testRunner.setStatisticsTimeToLiveCookiePartitionFree(1); >- setTimeout(fireShouldPartitionCookiesHandlerAndContinue, 2000); >- } >- >- function setNormalCookiePartitioningTimeOutPlusUserInteractionAndContinue() { >- testRunner.setStatisticsTimeToLiveCookiePartitionFree(86400); >- testRunner.setStatisticsHasHadUserInteraction(thirdPartyOrigin, true, function() { >- if (!testRunner.isStatisticsHasHadUserInteraction(thirdPartyOrigin)) >- testFailed("Third party did not get logged for user interaction."); >- runTest(); >- }); >- } >- >- function runTest() { >- switch (document.location.hash) { >- case "#step1": >- // Set first-party cookie for http://localhost:8000 >- document.location.href = thirdPartyBaseUrl + subPathToSetFirstPartyCookie + "#" + fragmentWithReturnUrl + "#step2"; >- break; >- case "#step2": >- // Check that the first-party cookie is not sent in partition 127.0.0.1:8000 >- document.location.hash = "step3"; >- openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive no cookies.", >- runTest); >- break; >- case "#step3": >- // Set third-party cookie for http://localhost:8000 in partition 127.0.0.1:8000 >- document.location.hash = "step4"; >- openIframe(thirdPartyBaseUrl + subPathToSetThirdPartyCookie + "&message=Setting partitioned, third-party cookie.", >- runTest); >- break; >- case "#step4": >- // Check that only partitioned cookie get sent in partition 127.0.0.1:8000 >- document.location.hash = "step5"; >- openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should only receive partitioned, third-party cookie.", >- setNormalCookiePartitioningTimeOutPlusUserInteractionAndContinue); >- break; >- case "#step5": >- // http://localhost:8000 now has user interaction, check that un-partitioned cookie is sent for third-party >- document.location.hash = "step6"; >- openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=After first user interaction, should still only receive a partitioned, third-party cookie.", >- setShortCookiePartitioningTimeOutPlusFireShouldPartitionCookiesHandlerAndContinue); >- break; >- case "#step6": >- // Cookie partitioning should be applied again >- document.location.hash = "step7"; >- openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should only receive partitioned, third-party cookie.", >- setNormalCookiePartitioningTimeOutPlusUserInteractionAndContinue); >- break; >- case "#step7": >- // http://localhost:8000 now has fresh user interaction, check that un-partitioned cookie is sent for third-party >- openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=After second user interaction, should still only receive a partitioned, third-party cookie.", >- finishTest); >- break; >- } >- } >- >- if (document.location.hash === "" && window.testRunner && window.internals) { >- testRunner.waitUntilDone(); >- testRunner.dumpChildFramesAsText(); >- setEnableFeature(true, function() { >- // Set localhost as prevalent and with non-recent user interaction to put it in the partitioning category. >- testRunner.setStatisticsPrevalentResource("http://localhost", true, function() { >- if (!testRunner.isStatisticsPrevalentResource("http://localhost")) >- testFailed("Host did not get set as prevalent resource."); >- testRunner.setStatisticsHasHadNonRecentUserInteraction("http://localhost"); >- >- testRunner.statisticsUpdateCookiePartitioning(); >- >- document.location.hash = "step1"; >- >- runTest(); >- }); >- }); >- } else >- runTest(); >- >-</script> >-</body> >-</html> >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction-expected.txt b/LayoutTests/http/tests/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction-expected.txt >deleted file mode 100644 >index 81b25e729fec277ca3faefa235c57f329a72adda..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction-expected.txt >+++ /dev/null >@@ -1,34 +0,0 @@ >-PASS successfullyParsed is true >- >-TEST COMPLETE >- >- >--------- >-Frame: '<!--frame1-->' >--------- >-Should receive no cookies. >-Did not receive cookie named 'firstPartyCookie'. >-Did not receive cookie named 'thirdPartyCookie'. >-Client-side document.cookie: >- >--------- >-Frame: '<!--frame2-->' >--------- >-Setting partitioned, third party cookie. >- >- >--------- >-Frame: '<!--frame3-->' >--------- >-Should only receive partitioned, third party cookie. >-Did not receive cookie named 'firstPartyCookie'. >-Received cookie named 'thirdPartyCookie'. >-Client-side document.cookie: thirdPartyCookie=value >- >--------- >-Frame: '<!--frame4-->' >--------- >-After user interaction, should still only receive a partitioned, third-party cookie. >-Did not receive cookie named 'firstPartyCookie'. >-Received cookie named 'thirdPartyCookie'. >-Client-side document.cookie: thirdPartyCookie=value >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html b/LayoutTests/http/tests/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html >deleted file mode 100644 >index 8a43c930f07b6f18af3e2303b4e18772af27faa0..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html >+++ /dev/null >@@ -1,89 +0,0 @@ >-<!DOCTYPE html> >-<html lang="en"> >-<head> >- <meta charset="UTF-8"> >- <title>Test for Partitioned Cookies With and Without User Interaction</title> >- <script src="/js-test-resources/js-test.js"></script> >-</head> >-<body> >-<script> >- const partitionHost = "127.0.0.1:8000"; >- const thirdPartyOrigin = "http://localhost:8000"; >- const thirdPartyBaseUrl = thirdPartyOrigin + "/resourceLoadStatistics/resources"; >- const firstPartyCookieName = "firstPartyCookie"; >- const subPathToSetFirstPartyCookie = "/set-cookie.php?name=" + firstPartyCookieName + "&value=value"; >- const thirdPartyCookieName = "thirdPartyCookie"; >- const subPathToSetThirdPartyCookie = "/set-cookie.php?name=" + thirdPartyCookieName + "&value=value"; >- const fragmentWithReturnUrl = "http://127.0.0.1:8000/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html"; >- const subPathToGetCookies = "/get-cookies.php?name1=" + firstPartyCookieName + "&name2=" + thirdPartyCookieName; >- >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- >- function finishTest() { >- setEnableFeature(false, function() { >- testRunner.notifyDone(); >- }); >- } >- >- function openIframe(url, onLoadHandler) { >- const element = document.createElement("iframe"); >- element.src = url; >- if (onLoadHandler) { >- element.onload = onLoadHandler; >- } >- document.body.appendChild(element); >- } >- >- function setUserInteractionAndContinue() { >- testRunner.setStatisticsHasHadUserInteraction(thirdPartyOrigin, true, function() { >- if (!testRunner.isStatisticsHasHadUserInteraction(thirdPartyOrigin)) >- testFailed("Third party did not get logged for user interaction."); >- runTest(); >- }); >- } >- >- function runTest() { >- switch (document.location.hash) { >- case "#step1": >- document.location.href = thirdPartyBaseUrl + subPathToSetFirstPartyCookie + "#" + fragmentWithReturnUrl + "#step2"; >- break; >- case "#step2": >- document.location.hash = "step3"; >- openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive no cookies.", runTest); >- break; >- case "#step3": >- document.location.hash = "step4"; >- openIframe(thirdPartyBaseUrl + subPathToSetThirdPartyCookie + "&message=Setting partitioned, third party cookie.", runTest); >- break; >- case "#step4": >- document.location.hash = "step5"; >- openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should only receive partitioned, third party cookie.", setUserInteractionAndContinue); >- break; >- case "#step5": >- openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=After user interaction, should still only receive a partitioned, third-party cookie.", finishTest); >- break; >- } >- } >- >- if (document.location.host === partitionHost && document.location.hash == "" && window.testRunner && window.internals) { >- setEnableFeature(true, function() { >- testRunner.waitUntilDone(); >- testRunner.dumpChildFramesAsText(); >- document.location.hash = "step1"; >- >- testRunner.statisticsSetShouldPartitionCookiesForHost("localhost", true, runTest); >- }); >- } else { >- runTest(); >- } >-</script> >-</body> >-</html> >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/remove-blocking-in-redirect-expected.txt b/LayoutTests/http/tests/resourceLoadStatistics/remove-blocking-in-redirect-expected.txt >index 0c22b622fe197e3233bdedc649d7f3e2a9321032..2d8d99b94312603b2ea3ec1d74b1abb58acab0b2 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/remove-blocking-in-redirect-expected.txt >+++ b/LayoutTests/http/tests/resourceLoadStatistics/remove-blocking-in-redirect-expected.txt >@@ -27,7 +27,7 @@ Client-side document.cookie: firstPartyCookie=127.0.0.1 > -------- > Frame: '<!--frame3-->' > -------- >-Set partitioned, third-party cookie. >+Try to set third-party cookie in blocked mode. > > > -------- >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html b/LayoutTests/http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html >index 558e8f2dd253a83ef64160c5e127d01727b6f639..61c7f1764dd505b164d16fad625c1d4bc7dc10db 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html >@@ -3,21 +3,13 @@ > <head> > <meta charset="UTF-8"> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> > </head> > <body> > <script> > description("Tests that blocking is removed mid-flight in redirects."); > jsTestIsAsync = true; > >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- > const partitionHost = "127.0.0.1:8000"; > const thirdPartyOrigin = "http://localhost:8000"; > const resourcePath = "/resourceLoadStatistics/resources"; >@@ -57,20 +49,18 @@ > openIframe(redirectChainUrl + "&message=Redirect case 1, should receive first-party cookie for 127.0.0.1.", runTest); > break; > case "#step4": >- // Set localhost as prevalent and with non-recent user interaction to put it in the blocking category. >+ // Set localhost as prevalent to put it in the blocking category. > document.location.hash = "step5"; >- testRunner.setStatisticsPrevalentResource("http://localhost", true, function() { >- if (!testRunner.isStatisticsPrevalentResource("http://localhost")) >+ testRunner.setStatisticsPrevalentResource(thirdPartyOrigin, true, function() { >+ if (!testRunner.isStatisticsPrevalentResource(thirdPartyOrigin)) > testFailed("Host did not get set as prevalent resource."); >- testRunner.statisticsUpdateCookiePartitioning(function() { >- runTest(); >- }); >+ testRunner.statisticsUpdateCookieBlocking(runTest); > }); > break; > case "#step5": >- // Set partitioned cookie for localhost under 127.0.0.1. >+ // Try to set partitioned cookie for localhost under 127.0.0.1. > document.location.hash = "step6"; >- openIframe(thirdPartyBaseUrl + subPathToSetPartitionedCookie + "&message=Set partitioned, third-party cookie.", runTest); >+ openIframe(thirdPartyBaseUrl + subPathToSetPartitionedCookie + "&message=Try to set third-party cookie in blocked mode.", runTest); > break; > case "#step6": > // Check that no cookie gets sent for localhost under 127.0.0.1 since localhost's cookies are blocked. >@@ -90,12 +80,11 @@ > > if (document.location.hash === "") { > setEnableFeature(true, function() { >- if (testRunner.isStatisticsPrevalentResource("http://localhost")) >+ if (testRunner.isStatisticsPrevalentResource(thirdPartyOrigin)) > testFailed("Localhost was classified as prevalent resource before the test starts."); > testRunner.dumpChildFramesAsText(); > document.location.hash = "step1"; >- // Make sure the network process is up-to-date. >- testRunner.statisticsSetShouldPartitionCookiesForHost("localhost", false, runTest); >+ runTest(); > }); > } else { > runTest(); >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/remove-partitioning-in-redirect-expected.txt b/LayoutTests/http/tests/resourceLoadStatistics/remove-partitioning-in-redirect-expected.txt >deleted file mode 100644 >index 03f0255ff4fbe868fd8787e0ff0d3e9a126de074..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/resourceLoadStatistics/remove-partitioning-in-redirect-expected.txt >+++ /dev/null >@@ -1,47 +0,0 @@ >-Tests that partitioning is removed mid-flight in redirects. >- >-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >- >- >-PASS successfullyParsed is true >- >-TEST COMPLETE >- >- >--------- >-Frame: '<!--frame1-->' >--------- >-Should receive first-party cookie. >-Received cookie named 'firstPartyCookie'. >-Did not receive cookie named 'partitionedCookie'. >-Client-side document.cookie: firstPartyCookie=value >- >--------- >-Frame: '<!--frame2-->' >--------- >-Redirect case 1, should receive first-party cookie for 127.0.0.1. >-Received cookie named 'firstPartyCookie'. >-Did not receive cookie named 'partitionedCookie'. >-Client-side document.cookie: firstPartyCookie=127.0.0.1 >- >--------- >-Frame: '<!--frame3-->' >--------- >-Set partitioned, third-party cookie. >- >- >--------- >-Frame: '<!--frame4-->' >--------- >-Should receive partitioned cookie. >-Did not receive cookie named 'firstPartyCookie'. >-Received cookie named 'partitionedCookie'. >-Client-side document.cookie: partitionedCookie=value >- >--------- >-Frame: '<!--frame5-->' >--------- >-Redirect case 2, should receive first-party cookie for 127.0.0.1. >-Received cookie named 'firstPartyCookie'. >-Did not receive cookie named 'partitionedCookie'. >-Client-side document.cookie: firstPartyCookie=127.0.0.1 >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html b/LayoutTests/http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html >deleted file mode 100644 >index a5e3d9197bf693e28988ea28edd5ab3443e5420e..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html >+++ /dev/null >@@ -1,105 +0,0 @@ >-<!DOCTYPE html> >-<html lang="en"> >-<head> >- <meta charset="UTF-8"> >- <script src="/js-test-resources/js-test.js"></script> >-</head> >-<body> >-<script> >- description("Tests that partitioning is removed mid-flight in redirects."); >- jsTestIsAsync = true; >- >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- >- const partitionHost = "127.0.0.1:8000"; >- const thirdPartyOrigin = "http://localhost:8000"; >- const resourcePath = "/resourceLoadStatistics/resources"; >- const thirdPartyBaseUrl = thirdPartyOrigin + resourcePath; >- const firstPartyCookieName = "firstPartyCookie"; >- const subPathToSetFirstPartyCookie = "/set-cookie.php?name=" + firstPartyCookieName + "&value=value"; >- const partitionedCookieName = "partitionedCookie"; >- const subPathToSetPartitionedCookie = "/set-cookie.php?name=" + partitionedCookieName + "&value=value"; >- const returnUrl = "http://" + partitionHost + "/resourceLoadStatistics/remove-partitioning-in-redirect.html"; >- const subPathToGetCookies = "/get-cookies.php?name1=" + firstPartyCookieName + "&name2=" + partitionedCookieName; >- const redirectChainUrl = thirdPartyOrigin + resourcePath + "/redirect.php?redirectTo=http://" + partitionHost + resourcePath + subPathToGetCookies; >- >- function openIframe(url, onLoadHandler) { >- const element = document.createElement("iframe"); >- element.src = url; >- if (onLoadHandler) { >- element.onload = onLoadHandler; >- } >- document.body.appendChild(element); >- } >- >- function runTest() { >- switch (document.location.hash) { >- case "#step1": >- // Set first-party cookies for 127.0.0.1 and localhost. >- document.cookie = firstPartyCookieName + "=127.0.0.1;path='/'"; >- document.location.href = thirdPartyBaseUrl + subPathToSetFirstPartyCookie + "#" + returnUrl + "#step2"; >- break; >- case "#step2": >- // Check that the cookie gets sent for localhost under 127.0.0.1 since localhost is not prevalent. >- document.location.hash = "step3"; >- openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive first-party cookie.", runTest); >- break; >- case "#step3": >- document.location.hash = "step4"; >- // Load an iframe in a redirect chain that starts with localhost and ends with 127.0.0.1. Expect a cookie for 127.0.0.1. >- openIframe(redirectChainUrl + "&message=Redirect case 1, should receive first-party cookie for 127.0.0.1.", runTest); >- break; >- case "#step4": >- // Set localhost as prevalent and with non-recent user interaction to put it in the partitioning category. >- document.location.hash = "step5"; >- testRunner.setStatisticsPrevalentResource("http://localhost", true, function() { >- if (!testRunner.isStatisticsPrevalentResource("http://localhost")) >- testFailed("Host did not get set as prevalent resource."); >- testRunner.setStatisticsHasHadNonRecentUserInteraction("http://localhost", function() { >- testRunner.statisticsUpdateCookiePartitioning(runTest); >- }); >- }); >- break; >- case "#step5": >- // Set partitioned cookie for localhost under 127.0.0.1. >- document.location.hash = "step6"; >- openIframe(thirdPartyBaseUrl + subPathToSetPartitionedCookie + "&message=Set partitioned, third-party cookie.", runTest); >- break; >- case "#step6": >- // Check that partitioned cookie gets sent for localhost under 127.0.0.1 since localhost is partitioned. >- document.location.hash = "step7"; >- openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive partitioned cookie.", runTest); >- break; >- case "#step7": >- // Load an iframe in a redirect chain that starts with localhost and ends with 127.0.0.1. Expect a cookie for 127.0.0.1. >- document.location.hash = "step8"; >- openIframe(redirectChainUrl + "&message=Redirect case 2, should receive first-party cookie for 127.0.0.1.", runTest); >- break; >- case "#step8": >- setEnableFeature(false, finishJSTest); >- break; >- } >- } >- >- if (document.location.hash === "") { >- setEnableFeature(true, function() { >- if (testRunner.isStatisticsPrevalentResource("http://localhost")) >- testFailed("Localhost was classified as prevalent resource before the test starts."); >- testRunner.dumpChildFramesAsText(); >- document.location.hash = "step1"; >- // Make sure the network process is up-to-date. >- testRunner.statisticsSetShouldPartitionCookiesForHost("localhost", false, runTest); >- }); >- } else { >- runTest(); >- } >-</script> >-</body> >-</html> >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/resources/get-cookies.php b/LayoutTests/http/tests/resourceLoadStatistics/resources/get-cookies.php >index 8e73a2be034acf93ecb87a7c5fd8c9806dab1fac..fee40c967c422460711bd821098ca8be12e7b2b0 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/resources/get-cookies.php >+++ b/LayoutTests/http/tests/resourceLoadStatistics/resources/get-cookies.php >@@ -5,10 +5,12 @@ if(!isset($_COOKIE[$_GET["name1"]])) { > } else { > echo "Received cookie named '" . $_GET["name1"] . "'.<br>"; > } >-if(!isset($_COOKIE[$_GET["name2"]])) { >- echo "Did not receive cookie named '" . $_GET["name2"] . "'.<br>"; >-} else { >- echo "Received cookie named '" . $_GET["name2"] . "'.<br>"; >+if(!empty($_GET["name2"])) { >+ if(!isset($_COOKIE[$_GET["name2"]])) { >+ echo "Did not receive cookie named '" . $_GET["name2"] . "'.<br>"; >+ } else { >+ echo "Received cookie named '" . $_GET["name2"] . "'.<br>"; >+ } > } > if(!empty($_GET["name3"])) { > if(!isset($_COOKIE[$_GET["name3"]])) { >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/resources/set-cookie-on-redirect.php b/LayoutTests/http/tests/resourceLoadStatistics/resources/set-cookie-on-redirect.php >new file mode 100644 >index 0000000000000000000000000000000000000000..483ce2dfc0e954b1e9672a98bad93d96cd2a436b >--- /dev/null >+++ b/LayoutTests/http/tests/resourceLoadStatistics/resources/set-cookie-on-redirect.php >@@ -0,0 +1,21 @@ >+<?php >+if ($_GET['step'] == 1) { >+ header("HTTP/1.0 302 Found"); >+ header('Location: http://localhost:8000/cookies/resources/set-cookie-on-redirect.php?step=2'); >+} else if ($_GET['step'] == 2) { >+ header("HTTP/1.0 302 Found"); >+ setcookie("test_cookie", "1", time() + 86400); >+ header('Location: http://localhost:8000/cookies/resources/set-cookie-on-redirect.php?step=3'); >+} else if ($_GET['step'] == 3) { >+ header("HTTP/1.0 200 OK"); >+ if (isset($_COOKIE['test_cookie'])) { >+ /* Clear cookie in order not to affect other tests. */ >+ setcookie("test_cookie", "", time() - 86400); >+ >+ echo "PASSED: Cookie successfully set\n"; >+ } else { >+ echo "FAILED: Cookie not set\n"; >+ } >+ echo "<script>if (window.testRunner && window.internals) testRunner.statisticsResetToConsistentState(function() { internals.setResourceLoadStatisticsEnabled(false); testRunner.notifyDone(); });</script>"; >+} >+?> >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/resources/util.js b/LayoutTests/http/tests/resourceLoadStatistics/resources/util.js >new file mode 100644 >index 0000000000000000000000000000000000000000..dc42844d42b14871cc50e53294f96945d7d9f131 >--- /dev/null >+++ b/LayoutTests/http/tests/resourceLoadStatistics/resources/util.js >@@ -0,0 +1,14 @@ >+function setEnableFeature(enable, completionHandler) { >+ if (typeof completionHandler !== "function") >+ testFailed("setEnableFeature() requires a completion handler function."); >+ testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(enable); >+ if (enable) { >+ internals.setResourceLoadStatisticsEnabled(true); >+ completionHandler(); >+ } else { >+ testRunner.statisticsResetToConsistentState(function() { >+ internals.setResourceLoadStatisticsEnabled(false); >+ completionHandler(); >+ }); >+ } >+} >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-ip-to-localhost-to-ip.html b/LayoutTests/http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-ip-to-localhost-to-ip.html >index 4a154952a83f28b3e5237f129b993c71239e77f1..88e7f36e1d0e9b56a0b338e70e0d9a56d1ff60be 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-ip-to-localhost-to-ip.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-ip-to-localhost-to-ip.html >@@ -2,20 +2,12 @@ > <html> > <head> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> > <script> > description("Tests that redirects for sandboxed iframes get counted properly."); > jsTestIsAsync = true; > window.addEventListener("message", receiveMessage, false); > >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- > function finishTest() { > setEnableFeature(false, finishJSTest); > } >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html b/LayoutTests/http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html >index 3d3fbf84223fbe0d2b72c23e8e54b1353b2b5afd..665ce0f935cbaa5b9ea46363ce38dfb8056c77f1 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html >@@ -2,20 +2,12 @@ > <html> > <head> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> > <script> > description("Tests that redirects for sandboxed iframes get counted properly."); > jsTestIsAsync = true; > window.addEventListener("message", receiveMessage, false); > >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- > function finishTest() { > setEnableFeature(false, finishJSTest); > } >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html b/LayoutTests/http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html >index 080929d62d44a1ff9364a25bba6ee73b5e509250..877a7e48a3af4aa39a00c6134786c5b5786ed0b3 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html >@@ -2,20 +2,12 @@ > <html> > <head> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> > <script> > description("Tests that redirects for a non-sandboxed iframe nested in a sandboxed iframe get counted properly."); > jsTestIsAsync = true; > window.addEventListener("message", receiveMessage, false); > >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- > function finishTest() { > setEnableFeature(false, finishJSTest); > } >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html b/LayoutTests/http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html >index 27598c290bb5bd15a57991b63cad2cc8e6a05deb..aa2d3838f73f99667aaf4344a8fa24214fb31931 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html >@@ -2,20 +2,12 @@ > <html> > <head> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> > <script> > description("Tests that redirects for a non-sandboxed iframe nested in a sandboxed iframe get counted properly."); > jsTestIsAsync = true; > window.addEventListener("message", receiveMessage, false); > >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- > function finishTest() { > setEnableFeature(false, finishJSTest); > } >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html b/LayoutTests/http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html >index 53f7a6c8dfbc30f4de3b462db9d7acc377945061..d472ab544d5d84c0cf502e5afafbba88f44fa4e8 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html >@@ -2,20 +2,12 @@ > <html> > <head> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> > <script> > description("Tests that redirects for a sandboxed iframe nested in a non-sandboxed iframe get counted properly."); > jsTestIsAsync = true; > window.addEventListener("message", receiveMessage, false); > >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- > function finishTest() { > setEnableFeature(false, finishJSTest); > } >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html b/LayoutTests/http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html >index 6c4c8f4996597585af6901160e652f1b9ae8a822..fd831819da8aac1d25a33d1804a81c5721e4ca94 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html >@@ -2,20 +2,12 @@ > <html> > <head> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> > <script> > description("Tests that redirects for a sandboxed iframe nested in a non-sandboxed iframe get counted properly."); > jsTestIsAsync = true; > window.addEventListener("message", receiveMessage, false); > >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- > function finishTest() { > setEnableFeature(false, finishJSTest); > } >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/set-custom-prevalent-resource-in-debug-mode.html b/LayoutTests/http/tests/resourceLoadStatistics/set-custom-prevalent-resource-in-debug-mode.html >index 7f28af3608742fbad7b15ce8c229ae5c998eda62..5aa7dd8c4b5253e51f7d485cc5b8ab7a3aefba79 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/set-custom-prevalent-resource-in-debug-mode.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/set-custom-prevalent-resource-in-debug-mode.html >@@ -3,6 +3,7 @@ > <head> > <meta charset="UTF-8"> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> > </head> > <body> > <script> >@@ -11,16 +12,6 @@ > > const thirdPartyOrigin = "http://localhost:8000"; > >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- > if (window.testRunner && window.internals) { > setEnableFeature(true, function() { > if (testRunner.isStatisticsPrevalentResource(thirdPartyOrigin)) >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects.html b/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects.html >index e8b7f09d5c664dd63e82d9a0c717bdb5a89f7d9a..5d7a3bc781c01c97684e1b0dfb9301fb95469948 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects.html >@@ -2,6 +2,7 @@ > <html> > <head> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> > </head> > <body> > <script> >@@ -9,15 +10,6 @@ > jsTestIsAsync = true; > testRunner.dumpChildFramesAsText(); > >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- > function openIframe(url, onLoadHandler) { > const element = document.createElement("iframe"); > element.src = url; >@@ -42,7 +34,7 @@ > if (!testRunner.isStatisticsPrevalentResource("http://localhost")) > testFailed("Host did not get set as prevalent resource."); > >- testRunner.statisticsUpdateCookiePartitioning(function() { >+ testRunner.statisticsUpdateCookieBlocking(function() { > openIframe("resources/redirect.php?redirectTo=http://localhost:8000/resourceLoadStatistics/resources/echo-referrer.php", function() { > setEnableFeature(false, finishJSTest); > }); >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-requests.html b/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-requests.html >index 204028827b4eadac05821a8ac21356052b5cd527..cd7c9ccf04cd0df0c663daf318953a319cc6042e 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-requests.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-requests.html >@@ -2,6 +2,7 @@ > <html> > <head> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> > </head> > <body> > <script> >@@ -9,15 +10,6 @@ > jsTestIsAsync = true; > testRunner.dumpChildFramesAsText(); > >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- > function openIframe(url, onLoadHandler) { > const element = document.createElement("iframe"); > element.src = url; >@@ -42,7 +34,7 @@ > if (!testRunner.isStatisticsPrevalentResource("http://localhost")) > testFailed("Host did not get set as prevalent resource."); > >- testRunner.statisticsUpdateCookiePartitioning(function() { >+ testRunner.statisticsUpdateCookieBlocking(function() { > fetch("http://localhost:8000/resourceLoadStatistics/resources/echo-referrer.php").then(function(response) { > return response.text(); > }).then(function(data) { >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/telemetry-generation.html b/LayoutTests/http/tests/resourceLoadStatistics/telemetry-generation.html >index 4db31274006c3de5f652ff93f78dd54a45f9d479..8419562070b2878486e0941b2e2e1cb25e86172c 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/telemetry-generation.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/telemetry-generation.html >@@ -4,6 +4,7 @@ > <meta charset="UTF-8"> > <title>Test for Telemetry Generation</title> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="resources/util.js"></script> > </head> > <body> > <script> >@@ -19,15 +20,6 @@ > const prevalentResourceUrl3 = "http://127.0.1.3:8000/temp"; > const prevalentResourceUrl4 = "http://127.0.1.4:8000/temp"; > >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- > function checkInsufficientClassificationAndContinue() { > if (!testRunner.isStatisticsPrevalentResource(prevalentResourceUrl1)) { > testFailed("Host 1 did not get classified as prevalent resource."); >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/third-party-cookie-with-and-without-user-interaction-expected.txt b/LayoutTests/http/tests/resourceLoadStatistics/third-party-cookie-with-and-without-user-interaction-expected.txt >deleted file mode 100644 >index 405627ccb94f2da22a3290d418a3da4e93d24ca4..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/resourceLoadStatistics/third-party-cookie-with-and-without-user-interaction-expected.txt >+++ /dev/null >@@ -1,43 +0,0 @@ >-PASS successfullyParsed is true >- >-TEST COMPLETE >- >- >--------- >-Frame: '<!--frame1-->' >--------- >-Setting cookie as third party. >- >- >--------- >-Frame: '<!--frame2-->' >--------- >-Should receive both the cookie set in a first-party context and in a third-party context. >-Received cookie named 'firstPartyCookie'. >-Received cookie named 'thirdPartyCookie'. >-Did not receive cookie named 'partitionedThirdPartyCookie'. >-Client-side document.cookie: firstPartyCookie=value,thirdPartyCookie=value >- >--------- >-Frame: '<!--frame3-->' >--------- >-Setting partitioned, third party cookie. >- >- >--------- >-Frame: '<!--frame4-->' >--------- >-Should only receive partitioned, third party cookie. >-Did not receive cookie named 'firstPartyCookie'. >-Did not receive cookie named 'thirdPartyCookie'. >-Received cookie named 'partitionedThirdPartyCookie'. >-Client-side document.cookie: partitionedThirdPartyCookie=value >- >--------- >-Frame: '<!--frame5-->' >--------- >-After user interaction, should should still only receive a partitioned, third-party cookie. >-Did not receive cookie named 'firstPartyCookie'. >-Did not receive cookie named 'thirdPartyCookie'. >-Received cookie named 'partitionedThirdPartyCookie'. >-Client-side document.cookie: partitionedThirdPartyCookie=value >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/third-party-cookie-with-and-without-user-interaction.html b/LayoutTests/http/tests/resourceLoadStatistics/third-party-cookie-with-and-without-user-interaction.html >deleted file mode 100644 >index b72163e0c2390beb8e8d28140f92e36e62bcb42c..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/resourceLoadStatistics/third-party-cookie-with-and-without-user-interaction.html >+++ /dev/null >@@ -1,109 +0,0 @@ >-<!DOCTYPE html> >-<html lang="en"> >-<head> >- <meta charset="UTF-8"> >- <title>Test to ensure non-prevalent resources can access their cookies in a third party context</title> >- <script src="/js-test-resources/js-test.js"></script> >-</head> >-<body> >-<script> >- const partitionHost = "127.0.0.1:8000"; >- const thirdPartyHostname = "localhost"; >- const thirdPartyOrigin = "http://" + thirdPartyHostname + ":8000"; >- const thirdPartyBaseUrl = thirdPartyOrigin + "/resourceLoadStatistics/resources"; >- const firstPartyCookieName = "firstPartyCookie"; >- const subPathToSetFirstPartyCookie = "/set-cookie.php?name=" + firstPartyCookieName + "&value=value"; >- const thirdPartyCookieName = "thirdPartyCookie"; >- const subPathToSetThirdPartyCookie = "/set-cookie.php?name=" + thirdPartyCookieName + "&value=value"; >- const partitionedThirdPartyCookieName = "partitionedThirdPartyCookie"; >- const subPathToSetPartitionedThirdPartyCookie = "/set-cookie.php?name=" + partitionedThirdPartyCookieName + "&value=value"; >- const fragmentWithReturnUrl = "http://127.0.0.1:8000/resourceLoadStatistics/third-party-cookie-with-and-without-user-interaction.html"; >- const subPathToGetCookies = "/get-cookies.php?name1=" + firstPartyCookieName + "&name2=" + thirdPartyCookieName + "&name3=" + partitionedThirdPartyCookieName; >- >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- >- function finishTest() { >- setEnableFeature(false, function() { >- testRunner.notifyDone(); >- }); >- } >- >- function openIframe(url, onLoadHandler) { >- const element = document.createElement("iframe"); >- element.src = url; >- if (onLoadHandler) { >- element.onload = onLoadHandler; >- } >- document.body.appendChild(element); >- } >- >- function setUserInteractionAndContinue() { >- testRunner.setStatisticsHasHadUserInteraction(thirdPartyOrigin, true, function() { >- if (!testRunner.isStatisticsHasHadUserInteraction(thirdPartyOrigin)) >- testFailed("Third party did not get logged for user interaction."); >- runTest(); >- }); >- } >- >- function runTest() { >- switch (document.location.hash) { >- case "#step1": >- // Set first-party cookie for localhost, effectively granting it access to cookies in a third-party context. >- document.location.href = thirdPartyBaseUrl + subPathToSetFirstPartyCookie + "#" + fragmentWithReturnUrl + "#step2"; >- break; >- case "#step2": >- // Set first-party cookie for localhost in a third-party context. >- document.location.hash = "step3"; >- openIframe(thirdPartyBaseUrl + subPathToSetThirdPartyCookie + "&message=Setting cookie as third party.", runTest); >- break; >- case "#step3": >- // Check that both cookies as sent. >- document.location.hash = "step4"; >- openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive both the cookie set in a first-party context and in a third-party context.", runTest); >- break; >- case "#step4": >- // Flag localhost for partitioning and set a partitioned cookie. >- document.location.hash = "step5"; >- testRunner.statisticsSetShouldPartitionCookiesForHost(thirdPartyHostname, true, runTest); >- break; >- case "#step5": >- // Flag localhost for partitioning and set a partitioned cookie. >- document.location.hash = "step6"; >- openIframe(thirdPartyBaseUrl + subPathToSetPartitionedThirdPartyCookie + "&message=Setting partitioned, third party cookie.", runTest); >- break; >- case "#step6": >- document.location.hash = "step7"; >- openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should only receive partitioned, third party cookie.", setUserInteractionAndContinue); >- break; >- case "#step7": >- openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=After user interaction, should should still only receive a partitioned, third-party cookie.", finishTest); >- break; >- } >- } >- >- if (document.location.host === partitionHost && document.location.hash == "" && window.testRunner && window.internals) { >- setEnableFeature(true, function() { >- testRunner.waitUntilDone(); >- testRunner.dumpChildFramesAsText(); >- document.location.hash = "step1"; >- >- // Start test with third party as non-prevalent >- testRunner.setStatisticsPrevalentResource(thirdPartyHostname, false, function() { >- testRunner.setStatisticsHasHadUserInteraction(thirdPartyOrigin, false, function() { >- testRunner.statisticsSetShouldPartitionCookiesForHost(thirdPartyHostname, false, runTest); >- }); >- }); >- }); >- } else { >- runTest(); >- } >-</script> >-</body> >-</html> >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/user-interaction-in-cross-origin-sub-frame.html b/LayoutTests/http/tests/resourceLoadStatistics/user-interaction-in-cross-origin-sub-frame.html >index a9c1be6b0469e67afc7c5057407e167172ce94f8..564ef097b948f6b3e8bba04eaa6d71408769909b 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/user-interaction-in-cross-origin-sub-frame.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/user-interaction-in-cross-origin-sub-frame.html >@@ -3,6 +3,7 @@ > <body> > <script src="/js-test-resources/js-test.js"></script> > <script src="/js-test-resources/ui-helper.js"></script> >+<script src="resources/util.js"></script> > <script> > description("Tests that user interaction is always logged for the top document/frame."); > jsTestIsAsync = true; >@@ -10,15 +11,6 @@ jsTestIsAsync = true; > const topFrameOrigin = "http://127.0.0.1:8000"; > const subFrameOrigin = "http://localhost:8000"; > >-function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >-} >- > function activateElement(elementId) { > var element = document.getElementById(elementId); > var centerX = element.offsetLeft + element.offsetWidth / 2; >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/user-interaction-only-reported-once-within-short-period-of-time.html b/LayoutTests/http/tests/resourceLoadStatistics/user-interaction-only-reported-once-within-short-period-of-time.html >index a30b228f8aec461185871b6bc8e1ab74e82c5087..22995848ff859539e9a296851dd47b9e9d551dca 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/user-interaction-only-reported-once-within-short-period-of-time.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/user-interaction-only-reported-once-within-short-period-of-time.html >@@ -3,6 +3,7 @@ > <body> > <script src="/js-test-resources/js-test.js"></script> > <script src="/js-test-resources/ui-helper.js"></script> >+<script src="resources/util.js"></script> > <script> > description("Tests that user interaction is not reported repeatedly within a short period of time."); > jsTestIsAsync = true; >@@ -10,15 +11,6 @@ > const topFrameOrigin = "http://127.0.0.1:8000"; > const subFrameOrigin = "http://localhost:8000"; > >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- > function activateElement(elementId, callback) { > var element = document.getElementById(elementId); > var centerX = element.offsetLeft + element.offsetWidth / 2; >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/user-interaction-reported-after-website-data-removal.html b/LayoutTests/http/tests/resourceLoadStatistics/user-interaction-reported-after-website-data-removal.html >index 55bebd72a9bc045bc3736b57c804f60b701b9851..f8aee7ab082f5a7000405ea9652e71ab1175f2b9 100644 >--- a/LayoutTests/http/tests/resourceLoadStatistics/user-interaction-reported-after-website-data-removal.html >+++ b/LayoutTests/http/tests/resourceLoadStatistics/user-interaction-reported-after-website-data-removal.html >@@ -3,6 +3,7 @@ > <body> > <script src="/js-test-resources/js-test.js"></script> > <script src="/js-test-resources/ui-helper.js"></script> >+<script src="resources/util.js"></script> > <script> > description("Tests that user interaction is reported after history removal since that means all statistics have been reset."); > jsTestIsAsync = true; >@@ -10,15 +11,6 @@ > const topFrameOrigin = "http://127.0.0.1:8000"; > const subFrameOrigin = "http://localhost:8000"; > >- function setEnableFeature(enable, completionHandler) { >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- if (!enable) >- testRunner.statisticsResetToConsistentState(completionHandler); >- else >- completionHandler(); >- } >- > function activateElement(elementId, callback) { > var element = document.getElementById(elementId); > var centerX = element.offsetLeft + element.offsetWidth / 2; >diff --git a/LayoutTests/http/tests/storageAccess/deny-storage-access-under-opener.html b/LayoutTests/http/tests/storageAccess/deny-storage-access-under-opener.html >index c1ad83812d9e5635feeb5b35365a71121f92d0b6..f98b13815f4fec453a39709403cf78145b7c1e2d 100644 >--- a/LayoutTests/http/tests/storageAccess/deny-storage-access-under-opener.html >+++ b/LayoutTests/http/tests/storageAccess/deny-storage-access-under-opener.html >@@ -2,23 +2,15 @@ > <html> > <head> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="/resourceLoadStatistics/resources/util.js"></script> > <script> > description("Tests that a cross-origin window from a prevalent domain without user interaction is denied storage access under its opener."); > jsTestIsAsync = true; > >- function setEnableFeature(enable) { >- if (!enable) >- testRunner.statisticsResetToConsistentState(); >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- testRunner.setStorageAccessAPIEnabled(enable); >- } >- > window.addEventListener("message", receiveMessage, false); > > function finishTest() { >- setEnableFeature(false); >- finishJSTest(); >+ setEnableFeature(false, finishJSTest); > } > > function openIframe(url, onLoadHandler) { >@@ -43,26 +35,28 @@ > openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should not receive first-party cookie.", finishTest); > } > >- setEnableFeature(true); >- testRunner.setCanOpenWindows(); >- > const thirdPartyOrigin = "http://localhost:8000"; > const resourcePath = "/storageAccess/resources"; > const thirdPartyBaseUrl = thirdPartyOrigin + resourcePath; > const firstPartyCookieName = "firstPartyCookie"; > const subPathToGetCookies = "/get-cookies.php?name1=" + firstPartyCookieName; > >- testRunner.setStatisticsPrevalentResource(thirdPartyOrigin, true); >- if (!testRunner.isStatisticsPrevalentResource(thirdPartyOrigin)) >- testFailed("Host did not get set as prevalent resource."); >- if (testRunner.isStatisticsHasHadUserInteraction(thirdPartyOrigin)) >- testFailed("Host logged for user interaction."); >- testRunner.dumpChildFramesAsText(); >- testRunner.setCloseRemainingWindowsWhenComplete(true); >+ let newWin; >+ setEnableFeature(true, function() { >+ testRunner.setCanOpenWindows(); >+ >+ testRunner.setStatisticsPrevalentResource(thirdPartyOrigin, true, function() { >+ if (!testRunner.isStatisticsPrevalentResource(thirdPartyOrigin)) >+ testFailed("Host did not get set as prevalent resource."); >+ if (testRunner.isStatisticsHasHadUserInteraction(thirdPartyOrigin)) >+ testFailed("Host logged for user interaction."); >+ testRunner.dumpChildFramesAsText(); >+ testRunner.setCloseRemainingWindowsWhenComplete(true); > >- var newWin; >- testRunner.statisticsUpdateCookiePartitioning(function () { >- newWin = window.open(thirdPartyOrigin + "/storageAccess/resources/set-cookie-and-report-back.html", "testWindow"); >+ testRunner.statisticsUpdateCookieBlocking(function () { >+ newWin = window.open(thirdPartyOrigin + "/storageAccess/resources/set-cookie-and-report-back.html", "testWindow"); >+ }); >+ }); > }); > </script> > </head> >diff --git a/LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener-expected.txt b/LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener-expected.txt >index bc5a8098515387071dce1aeb7ca5e26064e9aa30..5fe43c77130f251f4024f7cd5bbd2a7b3783f8bf 100644 >--- a/LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener-expected.txt >+++ b/LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener-expected.txt >@@ -1,8 +1,3 @@ >-CONSOLE MESSAGE: line 8: First JavaScript statement. >-CONSOLE MESSAGE: line 57: Running test. >-CONSOLE MESSAGE: line 73: About to call testRunner.statisticsUpdateCookiePartitioning(). >-CONSOLE MESSAGE: line 75: About to open the new window. >-CONSOLE MESSAGE: line 45: About to open the third party iframe. > Tests that a cross-origin window from a prevalent domain with non-recent user interaction gets immediate storage access under its opener. > > On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >diff --git a/LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener.html b/LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener.html >index c4a3e475acec3a1a04e30b5efb6bc1ee2dfb87e8..b6f67616b8934f37d4648b6e01e2fe8793e28b9b 100644 >--- a/LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener.html >+++ b/LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener.html >@@ -2,25 +2,15 @@ > <html> > <head> > <script src="/js-test-resources/js-test.js"></script> >+ <script src="/resourceLoadStatistics/resources/util.js"></script> > </head> > <body onload="run()"> > <script> >- console.log("First JavaScript statement."); >- > description("Tests that a cross-origin window from a prevalent domain with non-recent user interaction gets immediate storage access under its opener."); > jsTestIsAsync = true; > >- function setEnableFeature(enable) { >- if (!enable) >- testRunner.statisticsResetToConsistentState(); >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- testRunner.setStorageAccessAPIEnabled(enable); >- } >- > function finishTest() { >- setEnableFeature(false); >- finishJSTest(); >+ setEnableFeature(false, finishJSTest); > } > > function openIframe(url, onLoadHandler) { >@@ -42,7 +32,6 @@ > testFailed("Received a message from an unexpected origin: " + event.origin); > > newWin.close(); >- console.log("About to open the third party iframe."); > openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive first-party cookie.", finishTest); > } > >@@ -54,26 +43,25 @@ > var newWin; > > function run() { >- console.log("Running test."); >- setEnableFeature(true); >- >- window.addEventListener("message", receiveMessage, false); >+ setEnableFeature(true, function() { >+ window.addEventListener("message", receiveMessage, false); > >- testRunner.setCanOpenWindows(); >+ testRunner.setCanOpenWindows(); > >- testRunner.setStatisticsPrevalentResource(thirdPartyOrigin, true); >- if (!testRunner.isStatisticsPrevalentResource(thirdPartyOrigin)) >- testFailed("Host did not get set as prevalent resource."); >- testRunner.setStatisticsHasHadNonRecentUserInteraction(thirdPartyOrigin, true); >- if (!testRunner.isStatisticsHasHadUserInteraction(thirdPartyOrigin)) >- testFailed("Host did not get logged for user interaction."); >- testRunner.dumpChildFramesAsText(); >- testRunner.setCloseRemainingWindowsWhenComplete(true); >+ testRunner.setStatisticsPrevalentResource(thirdPartyOrigin, true, function() { >+ if (!testRunner.isStatisticsPrevalentResource(thirdPartyOrigin)) >+ testFailed("Host did not get set as prevalent resource."); >+ testRunner.setStatisticsHasHadUserInteraction(thirdPartyOrigin, true, function() { >+ if (!testRunner.isStatisticsHasHadUserInteraction(thirdPartyOrigin)) >+ testFailed("Host did not get logged for user interaction."); >+ testRunner.dumpChildFramesAsText(); >+ testRunner.setCloseRemainingWindowsWhenComplete(true); > >- console.log("About to call testRunner.statisticsUpdateCookiePartitioning()."); >- testRunner.statisticsUpdateCookiePartitioning(function () { >- console.log("About to open the new window."); >- newWin = window.open(thirdPartyOrigin + "/storageAccess/resources/set-cookie-and-report-back.html", "testWindow"); >+ testRunner.statisticsUpdateCookieBlocking(function () { >+ newWin = window.open(thirdPartyOrigin + "/storageAccess/resources/set-cookie-and-report-back.html", "testWindow"); >+ }); >+ }); >+ }); > }); > } > </script> >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 >deleted file mode 100644 >index d044d03293921f72c1075186b67fd9ce98d1d6f5..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction-expected.txt >+++ /dev/null >@@ -1,10 +0,0 @@ >-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. document.cookie == , cookies seen server-side == "No cookies" >-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 >deleted file mode 100644 >index c6ea1db782c7baec9461acec215507a1ede7045c..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction.html >+++ /dev/null >@@ -1,36 +0,0 @@ >-<!DOCTYPE html> >-<html> >-<head> >- <script src="/js-test-resources/js-test.js"></script> >- <script src="/js-test-resources/ui-helper.js"></script> >- <script> >- description("Tests that a cross-origin iframe from a prevalent domain with non-recent user interaction does not have storage access."); >- jsTestIsAsync = true; >- >- window.addEventListener("message", receiveMessage, false); >- >- function receiveMessage(event) { >- if (event.origin === "http://localhost:8000") { >- if (event.data.indexOf("PASS") !== -1) >- testPassed(event.data.replace("PASS ", "")); >- else >- testFailed(event.data); >- } else >- testFailed("Received a message from an unexpected origin: " + event.origin); >- finishJSTest(); >- } >- >- const hostUnderTest = "localhost:8000"; >- const statisticsUrl = "http://" + hostUnderTest + "/temp"; >- testRunner.setStatisticsPrevalentResource(statisticsUrl, true); >- if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >- testFailed("Host did not get set as prevalent resource."); >- testRunner.setStatisticsHasHadNonRecentUserInteraction(statisticsUrl, true); >- if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) >- testFailed("Host did not get logged for user interaction."); >- </script> >-</head> >-<body> >-<iframe sandbox="allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals" id="theIframe" src="http://localhost:8000/storageAccess/resources/has-storage-access-iframe.html#policyShouldNotGrantAccess"></iframe> >-</body> >-</html> >\ 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 >deleted file mode 100644 >index d80b5aa850bd127edbb25e5a0745bf0974e82b7e..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction-expected.txt >+++ /dev/null >@@ -1,10 +0,0 @@ >-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 No storage access. document.cookie == , cookies seen server-side == "No cookies" >-PASS successfullyParsed is true >- >-TEST COMPLETE >- >diff --git a/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction.html b/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction.html >deleted file mode 100644 >index e532d7b03de144e3a13abf8cc854daff140cb409..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction.html >+++ /dev/null >@@ -1,36 +0,0 @@ >-<!DOCTYPE html> >-<html> >-<head> >- <script src="/js-test-resources/js-test.js"></script> >- <script src="/js-test-resources/ui-helper.js"></script> >- <script> >- description("Tests that a cross-origin iframe from a prevalent domain with recent user interaction does have storage access."); >- jsTestIsAsync = true; >- >- window.addEventListener("message", receiveMessage, false); >- >- function receiveMessage(event) { >- if (event.origin === "http://localhost:8000") { >- if (event.data.indexOf("PASS") !== -1) >- testPassed(event.data.replace("PASS ", "")); >- else >- testFailed(event.data); >- } else >- testFailed("Received a message from an unexpected origin: " + event.origin); >- finishJSTest(); >- } >- >- const hostUnderTest = "localhost:8000"; >- const statisticsUrl = "http://" + hostUnderTest + "/temp"; >- testRunner.setStatisticsPrevalentResource(statisticsUrl, true); >- if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >- testFailed("Host did not get set as prevalent resource."); >- testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, true); >- if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) >- testFailed("Host did not get logged for user interaction."); >- </script> >-</head> >-<body> >-<iframe sandbox="allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals" id="theIframe" src="http://localhost:8000/storageAccess/resources/has-storage-access-iframe.html#policyShouldNotGrantAccess"></iframe> >-</body> >-</html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-user-interaction-expected.txt b/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-user-interaction-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..8398c7bd0d05a2d3851c97a48198e46f3f723579 >--- /dev/null >+++ b/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-user-interaction-expected.txt >@@ -0,0 +1,10 @@ >+Tests that a cross-origin iframe from a prevalent domain with 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. document.cookie == , cookies seen server-side == "No cookies" >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-user-interaction.html b/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-user-interaction.html >new file mode 100644 >index 0000000000000000000000000000000000000000..a707c8bcddb3a632543d0212d4047152e54342f4 >--- /dev/null >+++ b/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-user-interaction.html >@@ -0,0 +1,42 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <script src="/js-test-resources/js-test.js"></script> >+ <script src="/js-test-resources/ui-helper.js"></script> >+ <script> >+ description("Tests that a cross-origin iframe from a prevalent domain with user interaction does not have storage access."); >+ jsTestIsAsync = true; >+ >+ window.addEventListener("message", receiveMessage, false); >+ >+ function receiveMessage(event) { >+ if (event.origin === "http://localhost:8000") { >+ if (event.data.indexOf("PASS") !== -1) >+ testPassed(event.data.replace("PASS ", "")); >+ else >+ testFailed(event.data); >+ } else >+ testFailed("Received a message from an unexpected origin: " + event.origin); >+ finishJSTest(); >+ } >+ >+ const hostUnderTest = "localhost:8000"; >+ const statisticsUrl = "http://" + hostUnderTest + "/temp"; >+ testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() { >+ if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >+ testFailed("Host did not get set as prevalent resource."); >+ testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, true, function() { >+ if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) >+ testFailed("Host did not get logged for user interaction."); >+ let iframeElement = document.createElement("iframe"); >+ iframeElement.setAttribute("sandbox", "allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals"); >+ iframeElement.id = "TheIframeThatRequestsStorageAccess"; >+ iframeElement.src = "http://localhost:8000/storageAccess/resources/has-storage-access-iframe.html#policyShouldNotGrantAccess"; >+ document.body.appendChild(iframeElement); >+ }); >+ }); >+ </script> >+</head> >+<body> >+</body> >+</html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-expected.txt b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..9df537b29f336872a521194da4d1f33ee80558f3 >--- /dev/null >+++ b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-expected.txt >@@ -0,0 +1,10 @@ >+Tests that cross-origin iframe storage access is granted if the iframe is not sandboxed and the user accepts. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS Storage access was granted. document.cookie == , cookies seen server-side == "No cookies" >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-pop-window-expected.txt b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-pop-window-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..d7ec4cf7f7841d57c68ddb5fa66cb5634b31da3b >--- /dev/null >+++ b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-pop-window-expected.txt >@@ -0,0 +1,10 @@ >+Tests that cross-origin iframe can display a window if storage access is granted. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS Window was successfully opened with user interaction. >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-pop-window.html b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-pop-window.html >new file mode 100644 >index 0000000000000000000000000000000000000000..291f9fbb417af76de66b5f948713dd0861c96c36 >--- /dev/null >+++ b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-pop-window.html >@@ -0,0 +1,75 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <script src="/js-test-resources/js-test.js"></script> >+ <script src="/js-test-resources/ui-helper.js"></script> >+ <script src="/resourceLoadStatistics/resources/util.js"></script> >+ <script> >+ description("Tests that cross-origin iframe can display a window if storage access is granted."); >+ jsTestIsAsync = true; >+ >+ const hostUnderTest = "localhost:8000"; >+ const statisticsUrl = "http://" + hostUnderTest + "/temp"; >+ >+ window.addEventListener("message", receiveMessage, false); >+ >+ function receiveMessage(event) { >+ if (event.origin === "http://localhost:8000") { >+ if (event.data.indexOf("PASS ") !== -1) >+ testPassed(event.data.replace("PASS ", "")); >+ else >+ testFailed(event.data); >+ } else >+ testFailed("Received a message from an unexpected origin: " + event.origin); >+ setEnableFeature(false, finishJSTest); >+ } >+ >+ function activateElement(elementId) { >+ var element = document.getElementById(elementId); >+ var centerX = element.offsetLeft + element.offsetWidth / 2; >+ var centerY = element.offsetTop + element.offsetHeight / 2; >+ UIHelper.activateAt(centerX, centerY).then( >+ function () { >+ if (window.eventSender) >+ eventSender.keyDown("escape"); >+ else { >+ testFailed("No eventSender."); >+ setEnableFeature(false, finishJSTest); >+ } >+ }, >+ function () { >+ testFailed("Promise rejected."); >+ setEnableFeature(false, finishJSTest); >+ } >+ ); >+ } >+ >+ function runTest() { >+ setEnableFeature(true, function() { >+ testRunner.setCanOpenWindows(false); >+ testRunner.setPopupBlockingEnabled(true); >+ testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() { >+ if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >+ testFailed("Host did not get set as prevalent resource."); >+ testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, true, function() { >+ if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) >+ testFailed("Host did not get logged for user interaction."); >+ testRunner.statisticsUpdateCookieBlocking(function() { >+ let iframeElement = document.createElement("iframe"); >+ iframeElement.onload = function() { >+ activateElement("TheIframeThatRequestsStorageAccess"); >+ }; >+ iframeElement.id = "TheIframeThatRequestsStorageAccess"; >+ iframeElement.src = "http://localhost:8000/storageAccess/resources/request-storage-access-iframe-and-pop-window.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess,isNotSameOriginIframe"; >+ document.body.appendChild(iframeElement); >+ >+ }); >+ }); >+ }); >+ }); >+ } >+ </script> >+</head> >+<body onload="runTest()"> >+</body> >+</html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe.html b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe.html >new file mode 100644 >index 0000000000000000000000000000000000000000..3df7f37e8f704224dcd550a4b0f9cdc140833f11 >--- /dev/null >+++ b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe.html >@@ -0,0 +1,67 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <script src="/js-test-resources/js-test.js"></script> >+ <script src="/js-test-resources/ui-helper.js"></script> >+ <script src="/resourceLoadStatistics/resources/util.js"></script> >+ <script> >+ description("Tests that cross-origin iframe storage access is granted if the iframe is not sandboxed and the user accepts."); >+ jsTestIsAsync = true; >+ >+ const hostUnderTest = "localhost:8000"; >+ const statisticsUrl = "http://" + hostUnderTest + "/temp"; >+ >+ window.addEventListener("message", receiveMessage, false); >+ >+ function receiveMessage(event) { >+ if (event.origin === "http://localhost:8000") { >+ if (event.data.indexOf("PASS ") !== -1) >+ testPassed(event.data.replace("PASS ", "")); >+ else >+ testFailed(event.data); >+ } else >+ testFailed("Received a message from an unexpected origin: " + event.origin); >+ setEnableFeature(false, finishJSTest); >+ } >+ >+ function activateElement(elementId) { >+ var element = document.getElementById(elementId); >+ var centerX = element.offsetLeft + element.offsetWidth / 2; >+ var centerY = element.offsetTop + element.offsetHeight / 2; >+ UIHelper.activateAt(centerX, centerY).then( >+ function () { >+ if (window.eventSender) >+ eventSender.keyDown("escape"); >+ else { >+ testFailed("No eventSender."); >+ setEnableFeature(false, finishJSTest); >+ } >+ }, >+ function () { >+ testFailed("Promise rejected."); >+ setEnableFeature(false, finishJSTest); >+ } >+ ); >+ } >+ >+ function runTest() { >+ setEnableFeature(true, function() { >+ testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() { >+ if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >+ testFailed("Host did not get set as prevalent resource."); >+ testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, true, function() { >+ if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) >+ testFailed("Host did not get logged for user interaction."); >+ testRunner.statisticsUpdateCookieBlocking(function() { >+ activateElement("TheIframeThatRequestsStorageAccess"); >+ }); >+ }); >+ }); >+ }); >+ } >+ </script> >+</head> >+<body> >+ <iframe onload="runTest()" id="TheIframeThatRequestsStorageAccess" src="http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess,isNotSameOriginIframe"></iframe> >+</body> >+</html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-expected.txt b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..6c75e678c293a73e76274993c6d5f8340b8bce66 >--- /dev/null >+++ b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-expected.txt >@@ -0,0 +1,10 @@ >+Tests that cross-origin iframe storage access is granted if the iframe is sandboxed, has the allow token, and the user opts in. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS Storage access was granted. document.cookie == , cookies seen server-side == "No cookies" >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame-expected.txt b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..d6bc7775375013db38f604e62b2551e9c68f873f >--- /dev/null >+++ b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame-expected.txt >@@ -0,0 +1,48 @@ >+Tests that cross-origin iframe storage access is granted if the iframe is sandboxed, has the allow token, the iframe origin is a prevalent resource, the iframe origin has had user interaction, the user opts in, and the frame is the one with access. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS Storage access was granted. document.cookie == firstPartyCookie=value, cookies seen server-side == {"firstPartyCookie":"value"} >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >+ >+-------- >+Frame: '<!--frame1-->' >+-------- >+Should receive first-party cookie. >+Received cookie named 'firstPartyCookie'. >+Did not receive cookie named 'partitionedCookie'. >+Client-side document.cookie: firstPartyCookie=value >+ >+-------- >+Frame: '<!--frame2-->' >+-------- >+Should not receive cookies. >+Did not receive cookie named 'firstPartyCookie'. >+Did not receive cookie named 'partitionedCookie'. >+Client-side document.cookie: >+ >+-------- >+Frame: '<!--frame3-->' >+-------- >+ >+ >+ >+-------- >+Frame: '<!--frame4-->' >+-------- >+Should not receive cookies. >+Did not receive cookie named 'firstPartyCookie'. >+Did not receive cookie named 'partitionedCookie'. >+Client-side document.cookie: >+ >+-------- >+Frame: '<!--frame5-->' >+-------- >+After the top frame navigates the sub frame, the sub frame should no longer have access to cookies. >+Did not receive cookie named 'firstPartyCookie'. >+Did not receive cookie named 'partitionedCookie'. >+Client-side document.cookie: >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame.html b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame.html >new file mode 100644 >index 0000000000000000000000000000000000000000..f16010390a94437697a04f4c0fefc04f6968e0d4 >--- /dev/null >+++ b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame.html >@@ -0,0 +1,147 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <script src="/js-test-resources/js-test.js"></script> >+ <script src="/js-test-resources/ui-helper.js"></script> >+ <script src="/resourceLoadStatistics/resources/util.js"></script> >+</head> >+<body> >+ <script> >+ description("Tests that cross-origin iframe storage access is granted if the iframe is sandboxed, has the allow token, the iframe origin is a prevalent resource, the iframe origin has had user interaction, the user opts in, and the frame is the one with access."); >+ jsTestIsAsync = true; >+ >+ const hostUnderTest = "localhost:8000"; >+ const statisticsUrl = "http://" + hostUnderTest + "/temp"; >+ >+ const partitionHost = "127.0.0.1:8000"; >+ const thirdPartyOrigin = "http://localhost:8000"; >+ const resourcePath = "/storageAccess/resources"; >+ const thirdPartyBaseUrl = thirdPartyOrigin + resourcePath; >+ const firstPartyCookieName = "firstPartyCookie"; >+ const subPathToSetFirstPartyCookie = "/set-cookie.php?name=" + firstPartyCookieName + "&value=value"; >+ const partitionedCookieName = "partitionedCookie"; >+ const subPathToSetPartitionedCookie = "/set-cookie.php?name=" + partitionedCookieName + "&value=value"; >+ const returnUrl = "http://" + partitionHost + "/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame.html"; >+ const subPathToGetCookies = "/get-cookies.php?name1=" + firstPartyCookieName + "&name2=" + partitionedCookieName; >+ >+ function openIframe(url, onLoadHandler) { >+ const element = document.createElement("iframe"); >+ element.src = url; >+ if (onLoadHandler) { >+ element.onload = onLoadHandler; >+ } >+ document.body.appendChild(element); >+ } >+ >+ function receiveMessage(event) { >+ if (event.origin === "http://localhost:8000") { >+ if (event.data.indexOf("PASS") !== -1) >+ testPassed(event.data.replace("PASS ", "")); >+ else >+ testFailed(event.data); >+ } else >+ testFailed("Received a message from an unexpected origin: " + event.origin); >+ runTest(); >+ } >+ >+ function activateElement(elementId) { >+ var element = document.getElementById(elementId); >+ var centerX = element.offsetLeft + element.offsetWidth / 2; >+ var centerY = element.offsetTop + element.offsetHeight / 2; >+ UIHelper.activateAt(centerX, centerY).then( >+ function () { >+ if (window.eventSender) >+ eventSender.keyDown("escape"); >+ else { >+ testFailed("No eventSender."); >+ setEnableFeature(false, finishJSTest); >+ } >+ }, >+ function () { >+ testFailed("Promise rejected."); >+ setEnableFeature(false, finishJSTest); >+ } >+ ); >+ } >+ >+ function runTest() { >+ switch (document.location.hash) { >+ case "#step1": >+ if (testRunner.isStatisticsPrevalentResource(statisticsUrl)) >+ testFailed("Host prematurely set as prevalent resource."); >+ // Set first-party cookie for localhost. >+ document.location.href = thirdPartyBaseUrl + subPathToSetFirstPartyCookie + "#" + returnUrl + "#step2"; >+ break; >+ case "#step2": >+ document.location.hash = "step3"; >+ // Check that the first-party cookie does get sent for localhost under 127.0.0.1. >+ openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive first-party cookie.", runTest); >+ break; >+ case "#step3": >+ document.location.hash = "step4"; >+ // Set localhost as prevalent with user interaction. >+ testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, true, function() { >+ if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) >+ testFailed("Host did not get logged for user interaction."); >+ testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() { >+ if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >+ testFailed("Host did not get set as prevalent resource."); >+ testRunner.statisticsUpdateCookieBlocking(function() { >+ // Check that the first-party cookie does not get sent for localhost under 127.0.0.1. >+ openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should not receive cookies.", runTest); >+ }); >+ }); >+ }); >+ break; >+ case "#step4": >+ document.location.hash = "step5"; >+ // Try to set a cookie for localhost. >+ openIframe(thirdPartyBaseUrl + subPathToSetPartitionedCookie, runTest); >+ break; >+ case "#step5": >+ document.location.hash = "step6"; >+ // Check that no cookie gets sent for localhost under 127.0.0.1. >+ openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should not receive cookies.", runTest); >+ break; >+ case "#step6": >+ document.location.hash = "step7"; >+ // Create iframe that will request storage access. >+ let iframeElement = document.createElement("iframe"); >+ iframeElement.setAttribute("sandbox", "allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals"); >+ iframeElement.onload = function() { >+ testRunner.statisticsUpdateCookieBlocking(function() { >+ activateElement("TheIframeThatRequestsStorageAccess"); >+ }); >+ }; >+ iframeElement.id = "TheIframeThatRequestsStorageAccess"; >+ iframeElement.src = "http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html?bogus#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess,isNotSameOriginIframe"; >+ document.body.appendChild(iframeElement); >+ break; >+ case "#step7": >+ document.location.hash = "step8"; >+ // Check that no cookie gets sent for localhost under 127.0.0.1 since we're opening in the frame that was granted access. >+ let existingIframe = document.getElementById("TheIframeThatRequestsStorageAccess"); >+ existingIframe.onload = runTest; >+ existingIframe.src = thirdPartyBaseUrl + subPathToGetCookies + "&message=After the top frame navigates the sub frame, the sub frame should no longer have access to cookies."; >+ break; >+ case "#step8": >+ setEnableFeature(false, finishJSTest); >+ break; >+ } >+ } >+ >+ if (document.location.hash === "") { >+ setEnableFeature(true, function() { >+ if (testRunner.isStatisticsPrevalentResource(thirdPartyBaseUrl)) >+ testFailed("Localhost was classified as prevalent resource before the test starts."); >+ testRunner.dumpChildFramesAsText(); >+ document.location.hash = "step1"; >+ }); >+ } >+ >+ window.addEventListener("message", receiveMessage, false); >+ >+ runTest(); >+ </script> >+</body> >+</html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-but-access-from-wrong-frame-expected.txt b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-but-access-from-wrong-frame-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..5b3263e81ee66035c1c0592b3e401940c959eba3 >--- /dev/null >+++ b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-but-access-from-wrong-frame-expected.txt >@@ -0,0 +1,53 @@ >+Tests that cross-origin iframe storage access is denied if the iframe is sandboxed, has the allow token, the iframe origin is a prevalent resource, the iframe origin has had user interaction, the user opts in, but the frame is not the one with access. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS Storage access was granted. document.cookie == firstPartyCookie=value, cookies seen server-side == {"firstPartyCookie":"value"} >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >+ >+-------- >+Frame: '<!--frame1-->' >+-------- >+Should receive first-party cookie. >+Received cookie named 'firstPartyCookie'. >+Did not receive cookie named 'partitionedCookie'. >+Client-side document.cookie: firstPartyCookie=value >+ >+-------- >+Frame: '<!--frame2-->' >+-------- >+Should not receive cookies. >+Did not receive cookie named 'firstPartyCookie'. >+Did not receive cookie named 'partitionedCookie'. >+Client-side document.cookie: >+ >+-------- >+Frame: '<!--frame3-->' >+-------- >+ >+ >+ >+-------- >+Frame: '<!--frame4-->' >+-------- >+Should not receive cookies. >+Did not receive cookie named 'firstPartyCookie'. >+Did not receive cookie named 'partitionedCookie'. >+Client-side document.cookie: >+ >+-------- >+Frame: '<!--frame5-->' >+-------- >+ >+ >+-------- >+Frame: '<!--frame6-->' >+-------- >+Should not receive cookies. >+Did not receive cookie named 'firstPartyCookie'. >+Did not receive cookie named 'partitionedCookie'. >+Client-side document.cookie: >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-but-access-from-wrong-frame.html b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-but-access-from-wrong-frame.html >new file mode 100644 >index 0000000000000000000000000000000000000000..4e5829c7d50c17a763e32d0794e4f69a232de6b9 >--- /dev/null >+++ b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-but-access-from-wrong-frame.html >@@ -0,0 +1,144 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <script src="/js-test-resources/js-test.js"></script> >+ <script src="/js-test-resources/ui-helper.js"></script> >+ <script src="/resourceLoadStatistics/resources/util.js"></script> >+</head> >+<body> >+ <script> >+ description("Tests that cross-origin iframe storage access is denied if the iframe is sandboxed, has the allow token, the iframe origin is a prevalent resource, the iframe origin has had user interaction, the user opts in, but the frame is not the one with access."); >+ jsTestIsAsync = true; >+ >+ const hostUnderTest = "localhost:8000"; >+ const statisticsUrl = "http://" + hostUnderTest + "/temp"; >+ >+ const partitionHost = "127.0.0.1:8000"; >+ const thirdPartyOrigin = "http://localhost:8000"; >+ const resourcePath = "/storageAccess/resources"; >+ const thirdPartyBaseUrl = thirdPartyOrigin + resourcePath; >+ const firstPartyCookieName = "firstPartyCookie"; >+ const subPathToSetFirstPartyCookie = "/set-cookie.php?name=" + firstPartyCookieName + "&value=value"; >+ const partitionedCookieName = "partitionedCookie"; >+ const subPathToSetPartitionedCookie = "/set-cookie.php?name=" + partitionedCookieName + "&value=value"; >+ const returnUrl = "http://" + partitionHost + "/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-but-access-from-wrong-frame.html"; >+ const subPathToGetCookies = "/get-cookies.php?name1=" + firstPartyCookieName + "&name2=" + partitionedCookieName; >+ >+ function openIframe(url, onLoadHandler) { >+ const element = document.createElement("iframe"); >+ element.src = url; >+ if (onLoadHandler) { >+ element.onload = onLoadHandler; >+ } >+ document.body.appendChild(element); >+ } >+ >+ function receiveMessage(event) { >+ if (event.origin === "http://localhost:8000") { >+ if (event.data.indexOf("PASS") !== -1) >+ testPassed(event.data.replace("PASS ", "")); >+ else >+ testFailed(event.data); >+ } else >+ testFailed("Received a message from an unexpected origin: " + event.origin); >+ runTest(); >+ } >+ >+ function activateElement(elementId) { >+ var element = document.getElementById(elementId); >+ var centerX = element.offsetLeft + element.offsetWidth / 2; >+ var centerY = element.offsetTop + element.offsetHeight / 2; >+ UIHelper.activateAt(centerX, centerY).then( >+ function () { >+ if (window.eventSender) >+ eventSender.keyDown("escape"); >+ else { >+ testFailed("No eventSender."); >+ setEnableFeature(false, finishJSTest); >+ } >+ }, >+ function () { >+ testFailed("Promise rejected."); >+ setEnableFeature(false, finishJSTest); >+ } >+ ); >+ } >+ >+ function runTest() { >+ switch (document.location.hash) { >+ case "#step1": >+ if (testRunner.isStatisticsPrevalentResource(statisticsUrl)) >+ testFailed("Host prematurely set as prevalent resource."); >+ // Set first-party cookie for localhost. >+ document.location.href = thirdPartyBaseUrl + subPathToSetFirstPartyCookie + "#" + returnUrl + "#step2"; >+ break; >+ case "#step2": >+ document.location.hash = "step3"; >+ // Check that the first-party cookie does get sent for localhost under 127.0.0.1. >+ openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive first-party cookie.", runTest); >+ break; >+ case "#step3": >+ document.location.hash = "step4"; >+ // Set localhost as prevalent. >+ testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() { >+ if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >+ testFailed("Host did not get set as prevalent resource."); >+ testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, true, function() { >+ if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) >+ testFailed("Host did not get logged for user interaction."); >+ testRunner.statisticsUpdateCookieBlocking(function() { >+ // Check that the first-party cookie does not get sent for localhost under 127.0.0.1. >+ openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should not receive cookies.", runTest); >+ }); >+ }); >+ }); >+ break; >+ case "#step4": >+ document.location.hash = "step5"; >+ // Try to set cookie for localhost. >+ openIframe(thirdPartyBaseUrl + subPathToSetPartitionedCookie, runTest); >+ break; >+ case "#step5": >+ document.location.hash = "step6"; >+ // Check that no cookie gets sent for localhost under 127.0.0.1. >+ openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should not receive cookies.", runTest); >+ break; >+ case "#step6": >+ document.location.hash = "step7"; >+ let iframeElement = document.createElement("iframe"); >+ iframeElement.setAttribute("sandbox", "allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals"); >+ iframeElement.onload = function() { >+ testRunner.statisticsUpdateCookieBlocking(function() { >+ activateElement("TheIframeThatRequestsStorageAccess"); >+ }); >+ }; >+ iframeElement.id = "TheIframeThatRequestsStorageAccess"; >+ iframeElement.src = "http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess,isNotSameOriginIframe"; >+ document.body.appendChild(iframeElement); >+ break; >+ case "#step7": >+ document.location.hash = "step8"; >+ // Check that no cookie gets sent for localhost under 127.0.0.1 since we're opening a new frame. >+ openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should not receive cookies.", runTest); >+ break; >+ case "#step8": >+ setEnableFeature(false, finishJSTest); >+ break; >+ } >+ } >+ >+ if (document.location.hash === "") { >+ setEnableFeature(true, function() { >+ if (testRunner.isStatisticsPrevalentResource(thirdPartyBaseUrl)) >+ testFailed("Localhost was classified as prevalent resource before the test starts."); >+ testRunner.dumpChildFramesAsText(); >+ document.location.hash = "step1"; >+ }); >+ } >+ >+ window.addEventListener("message", receiveMessage, false); >+ >+ runTest(); >+ </script> >+</body> >+</html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-expected.txt b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..80f024a07988ccd627f2341c8e1de1d981c0d4ee >--- /dev/null >+++ b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-expected.txt >@@ -0,0 +1,10 @@ >+Tests that cross-origin iframe storage access is granted if the iframe is sandboxed, has the allow token, the iframe origin is a prevalent resource, the iframe origin has had recent user interaction, and the user opts in. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS Storage access was granted. document.cookie == , cookies seen server-side == "No cookies" >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction.html b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction.html >new file mode 100644 >index 0000000000000000000000000000000000000000..60c8777c98280724b715e6a636d9d5769447b052 >--- /dev/null >+++ b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction.html >@@ -0,0 +1,67 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <script src="/js-test-resources/js-test.js"></script> >+ <script src="/js-test-resources/ui-helper.js"></script> >+ <script> >+ description("Tests that cross-origin iframe storage access is granted if the iframe is sandboxed, has the allow token, the iframe origin is a prevalent resource, the iframe origin has had recent user interaction, and the user opts in."); >+ jsTestIsAsync = true; >+ >+ window.addEventListener("message", receiveMessage, false); >+ >+ function receiveMessage(event) { >+ if (event.origin === "http://localhost:8000") { >+ if (event.data.indexOf("PASS") !== -1) >+ testPassed(event.data.replace("PASS ", "")); >+ else >+ testFailed(event.data); >+ } else >+ testFailed("Received a message from an unexpected origin: " + event.origin); >+ finishJSTest(); >+ } >+ >+ function activateElement(elementId) { >+ var element = document.getElementById(elementId); >+ var centerX = element.offsetLeft + element.offsetWidth / 2; >+ var centerY = element.offsetTop + element.offsetHeight / 2; >+ UIHelper.activateAt(centerX, centerY).then( >+ function () { >+ if (window.eventSender) >+ eventSender.keyDown("escape"); >+ else { >+ testFailed("No eventSender."); >+ finishJSTest(); >+ } >+ }, >+ function () { >+ testFailed("Promise rejected."); >+ finishJSTest(); >+ } >+ ); >+ } >+ >+ function runTest() { >+ activateElement("TheIframeThatRequestsStorageAccess"); >+ } >+ >+ const hostUnderTest = "localhost:8000"; >+ const statisticsUrl = "http://" + hostUnderTest + "/temp"; >+ testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() { >+ if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >+ testFailed("Host did not get set as prevalent resource."); >+ testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, true, function() { >+ if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) >+ testFailed("Host did not get logged for user interaction."); >+ let iframeElement = document.createElement("iframe"); >+ iframeElement.setAttribute("sandbox", "allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals"); >+ iframeElement.onload = runTest; >+ iframeElement.id = "TheIframeThatRequestsStorageAccess"; >+ iframeElement.src = "http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess,isNotSameOriginIframe"; >+ document.body.appendChild(iframeElement); >+ }); >+ }); >+ </script> >+</head> >+<body> >+</body> >+</html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction-expected.txt b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..640f6c85c70571a6849ec90a86700a057976b415 >--- /dev/null >+++ b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction-expected.txt >@@ -0,0 +1,10 @@ >+Tests that cross-origin iframe storage access is denied if the iframe is sandboxed, has the allow token, the iframe origin is a prevalent resource, the iframe origin has not had user interaction, and the user opts in. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS Storage access was denied. document.cookie == , cookies seen server-side == "No cookies" >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction.html b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction.html >new file mode 100644 >index 0000000000000000000000000000000000000000..a76aed9b6a448934ad76465781f2bca38764d4a0 >--- /dev/null >+++ b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction.html >@@ -0,0 +1,63 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <script src="/js-test-resources/js-test.js"></script> >+ <script src="/js-test-resources/ui-helper.js"></script> >+ <script> >+ description("Tests that cross-origin iframe storage access is denied if the iframe is sandboxed, has the allow token, the iframe origin is a prevalent resource, the iframe origin has not had user interaction, and the user opts in."); >+ jsTestIsAsync = true; >+ >+ window.addEventListener("message", receiveMessage, false); >+ >+ function receiveMessage(event) { >+ if (event.origin === "http://localhost:8000") { >+ if (event.data.indexOf("PASS") !== -1) >+ testPassed(event.data.replace("PASS ", "")); >+ else >+ testFailed(event.data); >+ } else >+ testFailed("Received a message from an unexpected origin: " + event.origin); >+ finishJSTest(); >+ } >+ >+ function activateElement(elementId) { >+ var element = document.getElementById(elementId); >+ var centerX = element.offsetLeft + element.offsetWidth / 2; >+ var centerY = element.offsetTop + element.offsetHeight / 2; >+ UIHelper.activateAt(centerX, centerY).then( >+ function () { >+ if (window.eventSender) >+ eventSender.keyDown("escape"); >+ else { >+ testFailed("No eventSender."); >+ finishJSTest(); >+ } >+ }, >+ function () { >+ testFailed("Promise rejected."); >+ finishJSTest(); >+ } >+ ); >+ } >+ >+ function runTest() { >+ activateElement("TheIframeThatRequestsStorageAccess"); >+ } >+ >+ const hostUnderTest = "localhost:8000"; >+ const statisticsUrl = "http://" + hostUnderTest + "/temp"; >+ testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() { >+ if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >+ testFailed("Host did not get set as prevalent resource."); >+ let iframeElement = document.createElement("iframe"); >+ iframeElement.setAttribute("sandbox", "allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals"); >+ iframeElement.onload = runTest; >+ iframeElement.id = "TheIframeThatRequestsStorageAccess"; >+ iframeElement.src = "http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldNotGrantAccess,isNotSameOriginIframe"; >+ document.body.appendChild(iframeElement); >+ }); >+ </script> >+</head> >+<body> >+</body> >+</html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe.html b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe.html >new file mode 100644 >index 0000000000000000000000000000000000000000..83d258093ffed47e22b36f220ce623bd087bc5fa >--- /dev/null >+++ b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe.html >@@ -0,0 +1,51 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <script src="/js-test-resources/js-test.js"></script> >+ <script src="/js-test-resources/ui-helper.js"></script> >+ <script> >+ description("Tests that cross-origin iframe storage access is granted if the iframe is sandboxed, has the allow token, and the user opts in."); >+ jsTestIsAsync = true; >+ >+ window.addEventListener("message", receiveMessage, false); >+ >+ function receiveMessage(event) { >+ if (event.origin === "http://localhost:8000") { >+ if (event.data.indexOf("PASS") !== -1) >+ testPassed(event.data.replace("PASS ", "")); >+ else >+ testFailed(event.data); >+ } else >+ testFailed("Received a message from an unexpected origin: " + event.origin); >+ finishJSTest(); >+ } >+ >+ function activateElement(elementId) { >+ var element = document.getElementById(elementId); >+ var centerX = element.offsetLeft + element.offsetWidth / 2; >+ var centerY = element.offsetTop + element.offsetHeight / 2; >+ UIHelper.activateAt(centerX, centerY).then( >+ function () { >+ if (window.eventSender) >+ eventSender.keyDown("escape"); >+ else { >+ testFailed("No eventSender."); >+ finishJSTest(); >+ } >+ }, >+ function () { >+ testFailed("Promise rejected."); >+ finishJSTest(); >+ } >+ ); >+ } >+ >+ function runTest() { >+ activateElement("TheIframeThatRequestsStorageAccess"); >+ } >+ </script> >+</head> >+<body> >+ <iframe sandbox="allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals" onload="runTest()" id="TheIframeThatRequestsStorageAccess" src="http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess,isNotSameOriginIframe"></iframe> >+</body> >+</html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-nested-iframe-expected.txt b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-nested-iframe-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..3e5de6df81778bf0bfc23340e02a871baeb38e42 >--- /dev/null >+++ b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-nested-iframe-expected.txt >@@ -0,0 +1,10 @@ >+Tests that cross-origin iframe storage access is denied if the iframe is sandboxed, has the allow token, but is nested. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS Storage access was denied. document.cookie == , cookies seen server-side == "No cookies" >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-nested-iframe.html b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-nested-iframe.html >new file mode 100644 >index 0000000000000000000000000000000000000000..00d26d9bae473c1f6f828d1e4d13c889d827f0b5 >--- /dev/null >+++ b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-nested-iframe.html >@@ -0,0 +1,74 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <script src="/js-test-resources/js-test.js"></script> >+ <script src="/js-test-resources/ui-helper.js"></script> >+ <script src="/resourceLoadStatistics/resources/util.js"></script> >+ <script> >+ description("Tests that cross-origin iframe storage access is denied if the iframe is sandboxed, has the allow token, but is nested."); >+ jsTestIsAsync = true; >+ >+ const hostUnderTest = "localhost:8000"; >+ const statisticsUrl = "http://" + hostUnderTest + "/temp"; >+ >+ window.addEventListener("message", receiveMessage, false); >+ >+ function receiveMessage(event) { >+ if (event.origin === "http://localhost:8000") { >+ if (event.data.indexOf("PASS") !== -1) >+ testPassed(event.data.replace("PASS ", "")); >+ else >+ testFailed(event.data.replace("FAIL ", "")); >+ } else >+ testFailed("Received a message from an unexpected origin: " + event.origin); >+ setEnableFeature(false, finishJSTest); >+ } >+ >+ function activateElement(elementId) { >+ var element = document.getElementById(elementId); >+ var centerX = element.offsetLeft + element.offsetWidth / 2; >+ var centerY = element.offsetTop + element.offsetHeight / 2; >+ UIHelper.activateAt(centerX, centerY).then( >+ function () { >+ if (window.eventSender) >+ eventSender.keyDown("escape"); >+ else { >+ testFailed("No eventSender."); >+ setEnableFeature(false, finishJSTest); >+ } >+ }, >+ function () { >+ testFailed("Promise rejected."); >+ setEnableFeature(false, finishJSTest); >+ } >+ ); >+ } >+ >+ function runTest() { >+ setEnableFeature(true, function() { >+ testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() { >+ if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >+ testFailed("Host did not get set as prevalent resource."); >+ testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, true, function() { >+ if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) >+ testFailed("Host did not get logged for user interaction."); >+ testRunner.statisticsUpdateCookieBlocking(function() { >+ let iframeElement = document.createElement("iframe"); >+ iframeElement.setAttribute("sandbox", "allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals"); >+ iframeElement.onload = function() { >+ activateElement("TheIframeThatRequestsStorageAccess"); >+ }; >+ iframeElement.id = "TheIframeThatRequestsStorageAccess"; >+ iframeElement.src = "resources/nesting-iframe.html"; >+ document.body.appendChild(iframeElement); >+ >+ }); >+ }); >+ }); >+ }); >+ } >+ </script> >+</head> >+<body onload="runTest()"> >+</body> >+</html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access-expected.txt b/LayoutTests/http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access-expected.txt >index ac424e482ea97e90ca27c11ff997624585487dbd..9131069880ee6918cc58d0b94f0fa53a099373c9 100644 >--- a/LayoutTests/http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access-expected.txt >+++ b/LayoutTests/http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access-expected.txt >@@ -9,4 +9,4 @@ PASS There is no storage access entry for localhost after iframe detach. > PASS successfullyParsed is true > > TEST COMPLETE >- >+ >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access.html b/LayoutTests/http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access.html >index 1ed3bd36743a529c60a556ac1e4ec933c3a8f497..ff075cd03dc96e1f8a68f105d91c61078211a2e9 100644 >--- a/LayoutTests/http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access.html >+++ b/LayoutTests/http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access.html >@@ -3,23 +3,15 @@ > <head> > <script src="/js-test-resources/js-test.js"></script> > <script src="/js-test-resources/ui-helper.js"></script> >+ <script src="/resourceLoadStatistics/resources/util.js"></script> > <script> > description("Tests that a cross-origin iframe from a prevalent domain that is granted storage access and then is detached from the DOM does not have storage access."); > jsTestIsAsync = true; > > window.addEventListener("message", receiveMessage, false); > >- function setEnableFeature(enable) { >- if (!enable) >- testRunner.statisticsResetToConsistentState(); >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- testRunner.setStorageAccessAPIEnabled(enable); >- } >- > function finishTest() { >- setEnableFeature(false); >- finishJSTest(); >+ setEnableFeature(false, finishJSTest); > } > > const iframeID = "TheIframeThatRequestsStorageAccess"; >@@ -97,22 +89,29 @@ > const hostUnderTest = "localhost:8000"; > const statisticsUrl = "http://" + hostUnderTest; > if (document.location.hash !== "#firstPartyCookieSet" && document.location.hash !== "#elementActivated") { >- setEnableFeature(true); >- document.location.href = statisticsUrl + "/storageAccess/resources/set-cookie.php?name=firstPartyCookie&value=value#http://127.0.0.1:8000/storageAccess/request-and-grant-access-then-detach-should-not-have-access.html#firstPartyCookieSet"; >+ setEnableFeature(true, function() { >+ document.location.href = statisticsUrl + "/storageAccess/resources/set-cookie.php?name=firstPartyCookie&value=value#http://127.0.0.1:8000/storageAccess/request-and-grant-access-then-detach-should-not-have-access.html#firstPartyCookieSet"; >+ }); > } else { >- testRunner.setStatisticsPrevalentResource(statisticsUrl, true); >- if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >- testFailed("Host did not get set as prevalent resource."); >- testRunner.setStatisticsHasHadNonRecentUserInteraction(statisticsUrl, true); >- if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) >- testFailed("Host did not get logged for user interaction."); >- testRunner.statisticsUpdateCookiePartitioning(); >+ testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() { >+ if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >+ testFailed("Host did not get set as prevalent resource."); >+ testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, true, function() { >+ if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) >+ testFailed("Host did not get logged for user interaction."); >+ testRunner.statisticsUpdateCookieBlocking(function() { >+ let iframeElement = document.createElement("iframe"); >+ iframeElement.setAttribute("sandbox", "allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals"); >+ iframeElement.onload = runTest; >+ iframeElement.id = "TheIframeThatRequestsStorageAccess"; >+ iframeElement.src = "http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess"; >+ document.body.appendChild(iframeElement); >+ }); >+ }); >+ }); > } > </script> > </head> > <body> >-<div> >- <iframe sandbox="allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals" onload="runTest()" id="TheIframeThatRequestsStorageAccess" src="http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess"></iframe> >-</div> > </body> > </html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access.html b/LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access.html >index 206839188232bccd1775d473401c42d28ca5779e..b9310a6a1e608602a70b91b8efa7da823a316e4c 100644 >--- a/LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access.html >+++ b/LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access.html >@@ -3,23 +3,15 @@ > <head> > <script src="/js-test-resources/js-test.js"></script> > <script src="/js-test-resources/ui-helper.js"></script> >+ <script src="/resourceLoadStatistics/resources/util.js"></script> > <script> > description("Tests that a cross-origin iframe from a prevalent domain that is granted storage access and then navigates itself does not have storage access."); > jsTestIsAsync = true; > > window.addEventListener("message", receiveMessage, false); > >- function setEnableFeature(enable) { >- if (!enable) >- testRunner.statisticsResetToConsistentState(); >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- testRunner.setStorageAccessAPIEnabled(enable); >- } >- > function finishTest() { >- setEnableFeature(false); >- finishJSTest(); >+ setEnableFeature(false, finishJSTest); > } > > const expectedPassMessages = 2; >@@ -70,20 +62,29 @@ > const hostUnderTest = "localhost:8000"; > const statisticsUrl = "http://" + hostUnderTest; > if (document.location.hash !== "#firstPartyCookieSet") { >- setEnableFeature(true); >- document.location.href = statisticsUrl + "/storageAccess/resources/set-cookie.php?name=firstPartyCookie&value=value#http://127.0.0.1:8000/storageAccess/request-and-grant-access-then-navigate-should-not-have-access.html#firstPartyCookieSet"; >+ setEnableFeature(true, function() { >+ document.location.href = statisticsUrl + "/storageAccess/resources/set-cookie.php?name=firstPartyCookie&value=value#http://127.0.0.1:8000/storageAccess/request-and-grant-access-then-navigate-should-not-have-access.html#firstPartyCookieSet"; >+ }); > } else { >- testRunner.setStatisticsPrevalentResource(statisticsUrl, true); >- if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >- testFailed("Host did not get set as prevalent resource."); >- testRunner.setStatisticsHasHadNonRecentUserInteraction(statisticsUrl, true); >- if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) >- testFailed("Host did not get logged for user interaction."); >- testRunner.statisticsUpdateCookiePartitioning(); >+ testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() { >+ if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >+ testFailed("Host did not get set as prevalent resource."); >+ testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, true, function() { >+ if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) >+ testFailed("Host did not get logged for user interaction."); >+ testRunner.statisticsUpdateCookieBlocking(function() { >+ let iframeElement = document.createElement("iframe"); >+ iframeElement.setAttribute("sandbox", "allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals"); >+ iframeElement.onload = runTest; >+ iframeElement.id = "TheIframeThatRequestsStorageAccess"; >+ iframeElement.src = "http://localhost:8000/storageAccess/resources/self-navigating-frame-after-granted-access.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess"; >+ document.body.appendChild(iframeElement); >+ }); >+ }); >+ }); > } > </script> > </head> > <body> >-<iframe sandbox="allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals" onload="runTest()" id="TheIframeThatRequestsStorageAccess" src="http://localhost:8000/storageAccess/resources/self-navigating-frame-after-granted-access.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess"></iframe> > </body> > </html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe-expected.txt b/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe-expected.txt >deleted file mode 100644 >index 9df537b29f336872a521194da4d1f33ee80558f3..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe-expected.txt >+++ /dev/null >@@ -1,10 +0,0 @@ >-Tests that cross-origin iframe storage access is granted if the iframe is not sandboxed and the user accepts. >- >-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >- >- >-PASS Storage access was granted. document.cookie == , cookies seen server-side == "No cookies" >-PASS successfullyParsed is true >- >-TEST COMPLETE >- >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe-pop-window-expected.txt b/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe-pop-window-expected.txt >deleted file mode 100644 >index d7ec4cf7f7841d57c68ddb5fa66cb5634b31da3b..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe-pop-window-expected.txt >+++ /dev/null >@@ -1,10 +0,0 @@ >-Tests that cross-origin iframe can display a window if storage access is granted. >- >-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >- >- >-PASS Window was successfully opened with user interaction. >-PASS successfullyParsed is true >- >-TEST COMPLETE >- >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe-pop-window.html b/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe-pop-window.html >deleted file mode 100644 >index d1e18138c5f2bd95c25bba2402ebcd80c66fda43..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe-pop-window.html >+++ /dev/null >@@ -1,83 +0,0 @@ >-<!DOCTYPE html> >-<html> >-<head> >- <script src="/js-test-resources/js-test.js"></script> >- <script src="/js-test-resources/ui-helper.js"></script> >- <script> >- description("Tests that cross-origin iframe can display a window if storage access is granted."); >- jsTestIsAsync = true; >- >- const hostUnderTest = "localhost:8000"; >- const statisticsUrl = "http://" + hostUnderTest + "/temp"; >- >- window.addEventListener("message", receiveMessage, false); >- >- function setEnableFeature(enable) { >- if (!window.testRunner) >- return; >- >- if (!enable) >- testRunner.statisticsResetToConsistentState(); >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- testRunner.setStorageAccessAPIEnabled(enable); >- } >- >- function receiveMessage(event) { >- if (event.origin === "http://localhost:8000") { >- if (event.data.indexOf("PASS ") !== -1) >- testPassed(event.data.replace("PASS ", "")); >- else >- testFailed(event.data); >- } else >- testFailed("Received a message from an unexpected origin: " + event.origin); >- finishJSTest(); >- setEnableFeature(false); >- } >- >- function activateElement(elementId) { >- var element = document.getElementById(elementId); >- var centerX = element.offsetLeft + element.offsetWidth / 2; >- var centerY = element.offsetTop + element.offsetHeight / 2; >- UIHelper.activateAt(centerX, centerY).then( >- function () { >- if (window.eventSender) >- eventSender.keyDown("escape"); >- else { >- testFailed("No eventSender."); >- finishJSTest(); >- setEnableFeature(false); >- } >- }, >- function () { >- testFailed("Promise rejected."); >- finishJSTest(); >- setEnableFeature(false); >- } >- ); >- } >- >- function runTest() { >- setEnableFeature(true); >- >- if (!window.testRunner) >- return; >- >- testRunner.setCanOpenWindows(false); >- testRunner.setPopupBlockingEnabled(true); >- testRunner.setStatisticsPrevalentResource(statisticsUrl, true); >- if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >- testFailed("Host did not get set as prevalent resource."); >- testRunner.setStatisticsHasHadNonRecentUserInteraction(statisticsUrl); >- if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) >- testFailed("Host did not get logged for user interaction."); >- testRunner.statisticsUpdateCookiePartitioning(); >- >- activateElement("theIframe"); >- } >- </script> >-</head> >-<body> >- <iframe onload="runTest()" id="theIframe" src="http://localhost:8000/storageAccess/resources/request-storage-access-iframe-and-pop-window.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess,isNotSameOriginIframe"></iframe> >-</body> >-</html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe.html b/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe.html >deleted file mode 100644 >index c14b7be66de82d8686a2b0702fae3b8907cb955c..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe.html >+++ /dev/null >@@ -1,75 +0,0 @@ >-<!DOCTYPE html> >-<html> >-<head> >- <script src="/js-test-resources/js-test.js"></script> >- <script src="/js-test-resources/ui-helper.js"></script> >- <script> >- description("Tests that cross-origin iframe storage access is granted if the iframe is not sandboxed and the user accepts."); >- jsTestIsAsync = true; >- >- const hostUnderTest = "localhost:8000"; >- const statisticsUrl = "http://" + hostUnderTest + "/temp"; >- >- window.addEventListener("message", receiveMessage, false); >- >- function setEnableFeature(enable) { >- if (!enable) >- testRunner.statisticsResetToConsistentState(); >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- testRunner.setStorageAccessAPIEnabled(enable); >- } >- >- function receiveMessage(event) { >- if (event.origin === "http://localhost:8000") { >- if (event.data.indexOf("PASS ") !== -1) >- testPassed(event.data.replace("PASS ", "")); >- else >- testFailed(event.data); >- } else >- testFailed("Received a message from an unexpected origin: " + event.origin); >- finishJSTest(); >- setEnableFeature(false); >- } >- >- function activateElement(elementId) { >- var element = document.getElementById(elementId); >- var centerX = element.offsetLeft + element.offsetWidth / 2; >- var centerY = element.offsetTop + element.offsetHeight / 2; >- UIHelper.activateAt(centerX, centerY).then( >- function () { >- if (window.eventSender) >- eventSender.keyDown("escape"); >- else { >- testFailed("No eventSender."); >- finishJSTest(); >- setEnableFeature(false); >- } >- }, >- function () { >- testFailed("Promise rejected."); >- finishJSTest(); >- setEnableFeature(false); >- } >- ); >- } >- >- function runTest() { >- setEnableFeature(true); >- >- testRunner.setStatisticsPrevalentResource(statisticsUrl, true); >- if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >- testFailed("Host did not get set as prevalent resource."); >- testRunner.setStatisticsHasHadNonRecentUserInteraction(statisticsUrl); >- if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) >- testFailed("Host did not get logged for user interaction."); >- testRunner.statisticsUpdateCookiePartitioning(); >- >- activateElement("theIframe"); >- } >- </script> >-</head> >-<body> >- <iframe onload="runTest()" id="theIframe" src="http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess,isNotSameOriginIframe"></iframe> >-</body> >-</html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-expected.txt b/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-expected.txt >deleted file mode 100644 >index 6c75e678c293a73e76274993c6d5f8340b8bce66..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-expected.txt >+++ /dev/null >@@ -1,10 +0,0 @@ >-Tests that cross-origin iframe storage access is granted if the iframe is sandboxed, has the allow token, and the user opts in. >- >-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >- >- >-PASS Storage access was granted. document.cookie == , cookies seen server-side == "No cookies" >-PASS successfullyParsed is true >- >-TEST COMPLETE >- >diff --git a/LayoutTests/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-expected.txt b/LayoutTests/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-expected.txt >deleted file mode 100644 >index 6c9fa4efbfd840bdff51e04aae3fca30e5e5e6d4..0000000000000000000000000000000000000000 >--- a/LayoutTests/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-expected.txt >+++ /dev/null >@@ -1,48 +0,0 @@ >-Tests that cross-origin iframe storage access is granted if the iframe is sandboxed, has the allow token, the iframe origin is a prevalent resource, the iframe origin has had user interaction, the user opts in, and the frame is the one with access. >- >-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >- >- >-PASS Storage access was granted. document.cookie == firstPartyCookie=value, cookies seen server-side == {"firstPartyCookie":"value"} >-PASS successfullyParsed is true >- >-TEST COMPLETE >- >- >--------- >-Frame: '<!--frame1-->' >--------- >-After the top frame navigates the sub frame, the sub frame should no longer have access to first-party cookies. >-Did not receive cookie named 'firstPartyCookie'. >-Received cookie named 'partitionedCookie'. >-Client-side document.cookie: partitionedCookie=value >- >--------- >-Frame: '<!--frame2-->' >--------- >-Should receive first-party cookie. >-Received cookie named 'firstPartyCookie'. >-Did not receive cookie named 'partitionedCookie'. >-Client-side document.cookie: firstPartyCookie=value >- >--------- >-Frame: '<!--frame3-->' >--------- >-Should not receive cookies. >-Did not receive cookie named 'firstPartyCookie'. >-Did not receive cookie named 'partitionedCookie'. >-Client-side document.cookie: >- >--------- >-Frame: '<!--frame4-->' >--------- >- >- >- >--------- >-Frame: '<!--frame5-->' >--------- >-Should receive partitioned cookie. >-Did not receive cookie named 'firstPartyCookie'. >-Received cookie named 'partitionedCookie'. >-Client-side document.cookie: partitionedCookie=value >diff --git a/LayoutTests/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 b/LayoutTests/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 >deleted file mode 100644 >index 691717124bfb01c3478346ef78a73e05fd183c8e..0000000000000000000000000000000000000000 >--- a/LayoutTests/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 >+++ /dev/null >@@ -1,142 +0,0 @@ >-<!DOCTYPE html> >-<html> >-<head> >- <script src="/js-test-resources/js-test.js"></script> >- <script src="/js-test-resources/ui-helper.js"></script> >- <script> >- description("Tests that cross-origin iframe storage access is granted if the iframe is sandboxed, has the allow token, the iframe origin is a prevalent resource, the iframe origin has had user interaction, the user opts in, and the frame is the one with access."); >- jsTestIsAsync = true; >- >- const hostUnderTest = "localhost:8000"; >- const statisticsUrl = "http://" + hostUnderTest + "/temp"; >- >- const partitionHost = "127.0.0.1:8000"; >- const thirdPartyOrigin = "http://localhost:8000"; >- const resourcePath = "/storageAccess/resources"; >- const thirdPartyBaseUrl = thirdPartyOrigin + resourcePath; >- const firstPartyCookieName = "firstPartyCookie"; >- const subPathToSetFirstPartyCookie = "/set-cookie.php?name=" + firstPartyCookieName + "&value=value"; >- const partitionedCookieName = "partitionedCookie"; >- const subPathToSetPartitionedCookie = "/set-cookie.php?name=" + partitionedCookieName + "&value=value"; >- const returnUrl = "http://" + partitionHost + "/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"; >- const subPathToGetCookies = "/get-cookies.php?name1=" + firstPartyCookieName + "&name2=" + partitionedCookieName; >- >- function setEnableFeature(enable) { >- if (!enable) >- testRunner.statisticsResetToConsistentState(); >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- testRunner.setStorageAccessAPIEnabled(enable); >- } >- >- function openIframe(url, onLoadHandler) { >- const element = document.createElement("iframe"); >- element.src = url; >- if (onLoadHandler) { >- element.onload = onLoadHandler; >- } >- document.body.appendChild(element); >- } >- >- function receiveMessage(event) { >- if (event.origin === "http://localhost:8000") { >- if (event.data.indexOf("PASS") !== -1) >- testPassed(event.data.replace("PASS ", "")); >- else >- testFailed(event.data); >- } else >- testFailed("Received a message from an unexpected origin: " + event.origin); >- runTest(); >- } >- >- function activateElement(elementId) { >- var element = document.getElementById(elementId); >- var centerX = element.offsetLeft + element.offsetWidth / 2; >- var centerY = element.offsetTop + element.offsetHeight / 2; >- UIHelper.activateAt(centerX, centerY).then( >- function () { >- if (window.eventSender) >- eventSender.keyDown("escape"); >- else { >- testFailed("No eventSender."); >- setEnableFeature(false); >- finishJSTest(); >- } >- }, >- function () { >- testFailed("Promise rejected."); >- setEnableFeature(false); >- finishJSTest(); >- } >- ); >- } >- >- function runTest() { >- switch (document.location.hash) { >- case "#step1": >- // Set localhost as prevalent. >- if (testRunner.isStatisticsPrevalentResource(statisticsUrl)) >- testFailed("Host prematurely set as prevalent resource."); >- // Set first-party cookie for localhost. >- document.location.href = thirdPartyBaseUrl + subPathToSetFirstPartyCookie + "#" + returnUrl + "#step2"; >- break; >- case "#step2": >- document.location.hash = "step3"; >- // Check that the first-party cookie does get sent for localhost under 127.0.0.1. >- openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive first-party cookie.", runTest); >- break; >- case "#step3": >- document.location.hash = "step4"; >- testRunner.setStatisticsPrevalentResource(statisticsUrl, true); >- if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >- testFailed("Host did not get set as prevalent resource."); >- testRunner.setStatisticsHasHadNonRecentUserInteraction(statisticsUrl); >- if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) >- testFailed("Host did not get logged for user interaction."); >- testRunner.statisticsUpdateCookiePartitioning(); >- // Check that the first-party cookie does not get sent for localhost under 127.0.0.1. >- openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should not receive cookies.", runTest); >- break; >- case "#step4": >- document.location.hash = "step5"; >- // Set partitioned cookie for localhost. >- openIframe(thirdPartyBaseUrl + subPathToSetPartitionedCookie, runTest); >- break; >- case "#step5": >- document.location.hash = "step6"; >- // Check that the partitioned cookie does get sent for localhost under 127.0.0.1. >- openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive partitioned cookie.", runTest); >- break; >- case "#step6": >- document.location.hash = "step7"; >- activateElement("TheIframeThatRequestsStorageAccess"); >- break; >- case "#step7": >- document.location.hash = "step8"; >- // Check that the first-party cookie gets sent for localhost under 127.0.0.1 since we're opening in the frame that was granted access. >- document.getElementById("TheIframeThatRequestsStorageAccess").src = thirdPartyBaseUrl + subPathToGetCookies + "&message=After the top frame navigates the sub frame, the sub frame should no longer have access to first-party cookies."; >- break; >- case "#step8": >- setEnableFeature(false); >- finishJSTest(); >- break; >- } >- } >- >- if (document.location.hash === "") { >- setEnableFeature(true); >- if (testRunner.isStatisticsPrevalentResource(thirdPartyBaseUrl)) >- testFailed("Localhost was classified as prevalent resource before the test starts."); >- // Make sure the network process is up-to-date. >- testRunner.statisticsSetShouldPartitionCookiesForHost("localhost", false); >- testRunner.dumpChildFramesAsText(); >- document.location.hash = "step1"; >- } >- >- window.addEventListener("message", receiveMessage, false); >- </script> >-</head> >-<body> >- <iframe sandbox="allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals" onload="runTest()" id="TheIframeThatRequestsStorageAccess" src="http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess,isNotSameOriginIframe"></iframe> >-</body> >-</html> >\ No newline at end of file >diff --git a/LayoutTests/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-expected.txt b/LayoutTests/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-expected.txt >deleted file mode 100644 >index 6998002c8ea21fee803a6cbb3c46ed1aa3b88ab6..0000000000000000000000000000000000000000 >--- a/LayoutTests/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-expected.txt >+++ /dev/null >@@ -1,53 +0,0 @@ >-Tests that cross-origin iframe storage access is denied if the iframe is sandboxed, has the allow token, the iframe origin is a prevalent resource, the iframe origin has had user interaction, the user opts in, but the frame is not the one with access. >- >-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >- >- >-PASS Storage access was granted. document.cookie == firstPartyCookie=value, cookies seen server-side == {"firstPartyCookie":"value"} >-PASS successfullyParsed is true >- >-TEST COMPLETE >- >- >--------- >-Frame: '<!--frame1-->' >--------- >- >- >--------- >-Frame: '<!--frame2-->' >--------- >-Should receive first-party cookie. >-Received cookie named 'firstPartyCookie'. >-Did not receive cookie named 'partitionedCookie'. >-Client-side document.cookie: firstPartyCookie=value >- >--------- >-Frame: '<!--frame3-->' >--------- >-Should not receive cookies. >-Did not receive cookie named 'firstPartyCookie'. >-Did not receive cookie named 'partitionedCookie'. >-Client-side document.cookie: >- >--------- >-Frame: '<!--frame4-->' >--------- >- >- >- >--------- >-Frame: '<!--frame5-->' >--------- >-Should receive partitioned cookie. >-Did not receive cookie named 'firstPartyCookie'. >-Received cookie named 'partitionedCookie'. >-Client-side document.cookie: partitionedCookie=value >- >--------- >-Frame: '<!--frame6-->' >--------- >-Should receive partitioned cookie. >-Did not receive cookie named 'firstPartyCookie'. >-Received cookie named 'partitionedCookie'. >-Client-side document.cookie: partitionedCookie=value >diff --git a/LayoutTests/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 b/LayoutTests/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 >deleted file mode 100644 >index e3ea3c63efe900152d4242b4aba3b5bee4595997..0000000000000000000000000000000000000000 >--- a/LayoutTests/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 >+++ /dev/null >@@ -1,142 +0,0 @@ >-<!DOCTYPE html> >-<html> >-<head> >- <script src="/js-test-resources/js-test.js"></script> >- <script src="/js-test-resources/ui-helper.js"></script> >- <script> >- description("Tests that cross-origin iframe storage access is denied if the iframe is sandboxed, has the allow token, the iframe origin is a prevalent resource, the iframe origin has had user interaction, the user opts in, but the frame is not the one with access."); >- jsTestIsAsync = true; >- >- const hostUnderTest = "localhost:8000"; >- const statisticsUrl = "http://" + hostUnderTest + "/temp"; >- >- const partitionHost = "127.0.0.1:8000"; >- const thirdPartyOrigin = "http://localhost:8000"; >- const resourcePath = "/storageAccess/resources"; >- const thirdPartyBaseUrl = thirdPartyOrigin + resourcePath; >- const firstPartyCookieName = "firstPartyCookie"; >- const subPathToSetFirstPartyCookie = "/set-cookie.php?name=" + firstPartyCookieName + "&value=value"; >- const partitionedCookieName = "partitionedCookie"; >- const subPathToSetPartitionedCookie = "/set-cookie.php?name=" + partitionedCookieName + "&value=value"; >- const returnUrl = "http://" + partitionHost + "/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"; >- const subPathToGetCookies = "/get-cookies.php?name1=" + firstPartyCookieName + "&name2=" + partitionedCookieName; >- >- function setEnableFeature(enable) { >- if (!enable) >- testRunner.statisticsResetToConsistentState(); >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- testRunner.setStorageAccessAPIEnabled(enable); >- } >- >- function openIframe(url, onLoadHandler) { >- const element = document.createElement("iframe"); >- element.src = url; >- if (onLoadHandler) { >- element.onload = onLoadHandler; >- } >- document.body.appendChild(element); >- } >- >- function receiveMessage(event) { >- if (event.origin === "http://localhost:8000") { >- if (event.data.indexOf("PASS") !== -1) >- testPassed(event.data.replace("PASS ", "")); >- else >- testFailed(event.data); >- } else >- testFailed("Received a message from an unexpected origin: " + event.origin); >- runTest(); >- } >- >- function activateElement(elementId) { >- var element = document.getElementById(elementId); >- var centerX = element.offsetLeft + element.offsetWidth / 2; >- var centerY = element.offsetTop + element.offsetHeight / 2; >- UIHelper.activateAt(centerX, centerY).then( >- function () { >- if (window.eventSender) >- eventSender.keyDown("escape"); >- else { >- testFailed("No eventSender."); >- setEnableFeature(false); >- finishJSTest(); >- } >- }, >- function () { >- testFailed("Promise rejected."); >- setEnableFeature(false); >- finishJSTest(); >- } >- ); >- } >- >- function runTest() { >- switch (document.location.hash) { >- case "#step1": >- // Set localhost as prevalent. >- if (testRunner.isStatisticsPrevalentResource(statisticsUrl)) >- testFailed("Host prematurely set as prevalent resource."); >- // Set first-party cookie for localhost. >- document.location.href = thirdPartyBaseUrl + subPathToSetFirstPartyCookie + "#" + returnUrl + "#step2"; >- break; >- case "#step2": >- document.location.hash = "step3"; >- // Check that the first-party cookie does get sent for localhost under 127.0.0.1. >- openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive first-party cookie.", runTest); >- break; >- case "#step3": >- document.location.hash = "step4"; >- testRunner.setStatisticsPrevalentResource(statisticsUrl, true); >- if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >- testFailed("Host did not get set as prevalent resource."); >- testRunner.setStatisticsHasHadNonRecentUserInteraction(statisticsUrl); >- if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) >- testFailed("Host did not get logged for user interaction."); >- testRunner.statisticsUpdateCookiePartitioning(); >- // Check that the first-party cookie does not get sent for localhost under 127.0.0.1. >- openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should not receive cookies.", runTest); >- break; >- case "#step4": >- document.location.hash = "step5"; >- // Set partitioned cookie for localhost. >- openIframe(thirdPartyBaseUrl + subPathToSetPartitionedCookie, runTest); >- break; >- case "#step5": >- document.location.hash = "step6"; >- // Check that the partitioned cookie does get sent for localhost under 127.0.0.1. >- openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive partitioned cookie.", runTest); >- break; >- case "#step6": >- document.location.hash = "step7"; >- activateElement("theIframe"); >- break; >- case "#step7": >- document.location.hash = "step8"; >- // Check that the partitioned cookie gets sent for localhost under 127.0.0.1 since we're opening a new frame. >- openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive partitioned cookie.", runTest); >- break; >- case "#step8": >- setEnableFeature(false); >- finishJSTest(); >- break; >- } >- } >- >- if (document.location.hash === "") { >- setEnableFeature(true); >- if (testRunner.isStatisticsPrevalentResource(thirdPartyBaseUrl)) >- testFailed("Localhost was classified as prevalent resource before the test starts."); >- // Make sure the network process is up-to-date. >- testRunner.statisticsSetShouldPartitionCookiesForHost("localhost", false); >- testRunner.dumpChildFramesAsText(); >- document.location.hash = "step1"; >- } >- >- window.addEventListener("message", receiveMessage, false); >- </script> >-</head> >-<body> >- <iframe sandbox="allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals" onload="runTest()" id="theIframe" src="http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess,isNotSameOriginIframe"></iframe> >-</body> >-</html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-recent-user-interaction-expected.txt b/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-recent-user-interaction-expected.txt >deleted file mode 100644 >index 80f024a07988ccd627f2341c8e1de1d981c0d4ee..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-recent-user-interaction-expected.txt >+++ /dev/null >@@ -1,10 +0,0 @@ >-Tests that cross-origin iframe storage access is granted if the iframe is sandboxed, has the allow token, the iframe origin is a prevalent resource, the iframe origin has had recent user interaction, and the user opts in. >- >-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >- >- >-PASS Storage access was granted. document.cookie == , cookies seen server-side == "No cookies" >-PASS successfullyParsed is true >- >-TEST COMPLETE >- >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-recent-user-interaction.html b/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-recent-user-interaction.html >deleted file mode 100644 >index 0d0c93236c22d098ae7b269e8ab30d546ea3b810..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-recent-user-interaction.html >+++ /dev/null >@@ -1,60 +0,0 @@ >-<!DOCTYPE html> >-<html> >-<head> >- <script src="/js-test-resources/js-test.js"></script> >- <script src="/js-test-resources/ui-helper.js"></script> >- <script> >- description("Tests that cross-origin iframe storage access is granted if the iframe is sandboxed, has the allow token, the iframe origin is a prevalent resource, the iframe origin has had recent user interaction, and the user opts in."); >- jsTestIsAsync = true; >- >- window.addEventListener("message", receiveMessage, false); >- >- function receiveMessage(event) { >- if (event.origin === "http://localhost:8000") { >- if (event.data.indexOf("PASS") !== -1) >- testPassed(event.data.replace("PASS ", "")); >- else >- testFailed(event.data); >- } else >- testFailed("Received a message from an unexpected origin: " + event.origin); >- finishJSTest(); >- } >- >- function activateElement(elementId) { >- var element = document.getElementById(elementId); >- var centerX = element.offsetLeft + element.offsetWidth / 2; >- var centerY = element.offsetTop + element.offsetHeight / 2; >- UIHelper.activateAt(centerX, centerY).then( >- function () { >- if (window.eventSender) >- eventSender.keyDown("escape"); >- else { >- testFailed("No eventSender."); >- finishJSTest(); >- } >- }, >- function () { >- testFailed("Promise rejected."); >- finishJSTest(); >- } >- ); >- } >- >- function runTest() { >- activateElement("theIframe"); >- } >- >- const hostUnderTest = "localhost:8000"; >- const statisticsUrl = "http://" + hostUnderTest + "/temp"; >- testRunner.setStatisticsPrevalentResource(statisticsUrl, true); >- if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >- testFailed("Host did not get set as prevalent resource."); >- testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, true); >- if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) >- testFailed("Host did not get logged for user interaction."); >- </script> >-</head> >-<body> >- <iframe sandbox="allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals" onload="runTest()" id="theIframe" src="http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess,isNotSameOriginIframe"></iframe> >-</body> >-</html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction-expected.txt b/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction-expected.txt >deleted file mode 100644 >index 640f6c85c70571a6849ec90a86700a057976b415..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction-expected.txt >+++ /dev/null >@@ -1,10 +0,0 @@ >-Tests that cross-origin iframe storage access is denied if the iframe is sandboxed, has the allow token, the iframe origin is a prevalent resource, the iframe origin has not had user interaction, and the user opts in. >- >-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >- >- >-PASS Storage access was denied. document.cookie == , cookies seen server-side == "No cookies" >-PASS successfullyParsed is true >- >-TEST COMPLETE >- >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction.html b/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction.html >deleted file mode 100644 >index 0b1b1d5515e8e567c5516cdba86314196d00c06d..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction.html >+++ /dev/null >@@ -1,57 +0,0 @@ >-<!DOCTYPE html> >-<html> >-<head> >- <script src="/js-test-resources/js-test.js"></script> >- <script src="/js-test-resources/ui-helper.js"></script> >- <script> >- description("Tests that cross-origin iframe storage access is denied if the iframe is sandboxed, has the allow token, the iframe origin is a prevalent resource, the iframe origin has not had user interaction, and the user opts in."); >- jsTestIsAsync = true; >- >- window.addEventListener("message", receiveMessage, false); >- >- function receiveMessage(event) { >- if (event.origin === "http://localhost:8000") { >- if (event.data.indexOf("PASS") !== -1) >- testPassed(event.data.replace("PASS ", "")); >- else >- testFailed(event.data); >- } else >- testFailed("Received a message from an unexpected origin: " + event.origin); >- finishJSTest(); >- } >- >- function activateElement(elementId) { >- var element = document.getElementById(elementId); >- var centerX = element.offsetLeft + element.offsetWidth / 2; >- var centerY = element.offsetTop + element.offsetHeight / 2; >- UIHelper.activateAt(centerX, centerY).then( >- function () { >- if (window.eventSender) >- eventSender.keyDown("escape"); >- else { >- testFailed("No eventSender."); >- finishJSTest(); >- } >- }, >- function () { >- testFailed("Promise rejected."); >- finishJSTest(); >- } >- ); >- } >- >- function runTest() { >- activateElement("theIframe"); >- } >- >- const hostUnderTest = "localhost:8000"; >- const statisticsUrl = "http://" + hostUnderTest + "/temp"; >- testRunner.setStatisticsPrevalentResource(statisticsUrl, true); >- if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >- testFailed("Host did not get set as prevalent resource."); >- </script> >-</head> >-<body> >- <iframe sandbox="allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals" onload="runTest()" id="theIframe" src="http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldNotGrantAccess,isNotSameOriginIframe"></iframe> >-</body> >-</html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe.html b/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe.html >deleted file mode 100644 >index bd308c67e418a30eea3d1bb495ae6d3126c9c5ce..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe.html >+++ /dev/null >@@ -1,51 +0,0 @@ >-<!DOCTYPE html> >-<html> >-<head> >- <script src="/js-test-resources/js-test.js"></script> >- <script src="/js-test-resources/ui-helper.js"></script> >- <script> >- description("Tests that cross-origin iframe storage access is granted if the iframe is sandboxed, has the allow token, and the user opts in."); >- jsTestIsAsync = true; >- >- window.addEventListener("message", receiveMessage, false); >- >- function receiveMessage(event) { >- if (event.origin === "http://localhost:8000") { >- if (event.data.indexOf("PASS") !== -1) >- testPassed(event.data.replace("PASS ", "")); >- else >- testFailed(event.data); >- } else >- testFailed("Received a message from an unexpected origin: " + event.origin); >- finishJSTest(); >- } >- >- function activateElement(elementId) { >- var element = document.getElementById(elementId); >- var centerX = element.offsetLeft + element.offsetWidth / 2; >- var centerY = element.offsetTop + element.offsetHeight / 2; >- UIHelper.activateAt(centerX, centerY).then( >- function () { >- if (window.eventSender) >- eventSender.keyDown("escape"); >- else { >- testFailed("No eventSender."); >- finishJSTest(); >- } >- }, >- function () { >- testFailed("Promise rejected."); >- finishJSTest(); >- } >- ); >- } >- >- function runTest() { >- activateElement("theIframe"); >- } >- </script> >-</head> >-<body> >- <iframe sandbox="allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals" onload="runTest()" id="theIframe" src="http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess,isNotSameOriginIframe"></iframe> >-</body> >-</html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-nested-iframe-expected.txt b/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-nested-iframe-expected.txt >deleted file mode 100644 >index 3e5de6df81778bf0bfc23340e02a871baeb38e42..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-nested-iframe-expected.txt >+++ /dev/null >@@ -1,10 +0,0 @@ >-Tests that cross-origin iframe storage access is denied if the iframe is sandboxed, has the allow token, but is nested. >- >-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >- >- >-PASS Storage access was denied. document.cookie == , cookies seen server-side == "No cookies" >-PASS successfullyParsed is true >- >-TEST COMPLETE >- >diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-nested-iframe.html b/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-nested-iframe.html >deleted file mode 100644 >index 3bff7a4a44794a8ac7d7c762e643c056aa02c5d2..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-nested-iframe.html >+++ /dev/null >@@ -1,75 +0,0 @@ >-<!DOCTYPE html> >-<html> >-<head> >- <script src="/js-test-resources/js-test.js"></script> >- <script src="/js-test-resources/ui-helper.js"></script> >- <script> >- description("Tests that cross-origin iframe storage access is denied if the iframe is sandboxed, has the allow token, but is nested."); >- jsTestIsAsync = true; >- >- const hostUnderTest = "localhost:8000"; >- const statisticsUrl = "http://" + hostUnderTest + "/temp"; >- >- window.addEventListener("message", receiveMessage, false); >- >- function setEnableFeature(enable) { >- if (!enable) >- testRunner.statisticsResetToConsistentState(); >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- testRunner.setStorageAccessAPIEnabled(enable); >- } >- >- function receiveMessage(event) { >- if (event.origin === "http://localhost:8000") { >- if (event.data.indexOf("PASS") !== -1) >- testPassed(event.data.replace("PASS ", "")); >- else >- testFailed(event.data.replace("FAIL ", "")); >- } else >- testFailed("Received a message from an unexpected origin: " + event.origin); >- setEnableFeature(false); >- finishJSTest(); >- } >- >- function activateElement(elementId) { >- var element = document.getElementById(elementId); >- var centerX = element.offsetLeft + element.offsetWidth / 2; >- var centerY = element.offsetTop + element.offsetHeight / 2; >- UIHelper.activateAt(centerX, centerY).then( >- function () { >- if (window.eventSender) >- eventSender.keyDown("escape"); >- else { >- testFailed("No eventSender."); >- setEnableFeature(false); >- finishJSTest(); >- } >- }, >- function () { >- testFailed("Promise rejected."); >- setEnableFeature(false); >- finishJSTest(); >- } >- ); >- } >- >- function runTest() { >- setEnableFeature(true); >- >- testRunner.setStatisticsPrevalentResource(statisticsUrl, true); >- if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >- testFailed("Host did not get set as prevalent resource."); >- testRunner.setStatisticsHasHadNonRecentUserInteraction(statisticsUrl); >- if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) >- testFailed("Host did not get logged for user interaction."); >- testRunner.statisticsUpdateCookiePartitioning(); >- >- activateElement("theIframe"); >- } >- </script> >-</head> >-<body> >-<iframe sandbox="allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals" onload="runTest()" id="theIframe" src="resources/nesting-iframe.html"></iframe> >-</body> >-</html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin.html b/LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin.html >index 393a7e902e804a3f9fb50d6fe6c6154d741f8e06..a2f6d838d73313246bdb945b5ab2be0003839ba6 100644 >--- a/LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin.html >+++ b/LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin.html >@@ -41,11 +41,11 @@ > } > > function runTest() { >- activateElement("theIframe"); >+ activateElement("TheIframeThatRequestsStorageAccess"); > } > </script> > </head> > <body> >- <iframe sandbox="allow-storage-access-by-user-activation allow-scripts allow-modals" onload="runTest()" id="theIframe" src="http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldGrantAccess,userShouldNotBeConsulted,policyShouldDenyAccess,isNotSameOriginIframe,originIsNull"></iframe> >+ <iframe sandbox="allow-storage-access-by-user-activation allow-scripts allow-modals" onload="runTest()" id="TheIframeThatRequestsStorageAccess" src="http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldGrantAccess,userShouldNotBeConsulted,policyShouldDenyAccess,isNotSameOriginIframe,originIsNull"></iframe> > </body> > </html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-allow-token.html b/LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-allow-token.html >index aeadcaf6a7eadb1791f0d96fa5544a619544756e..358be814c4fc55bb63711f3aab9a66bb97d3bc59 100644 >--- a/LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-allow-token.html >+++ b/LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-allow-token.html >@@ -3,6 +3,7 @@ > <head> > <script src="/js-test-resources/js-test.js"></script> > <script src="/js-test-resources/ui-helper.js"></script> >+ <script src="/resourceLoadStatistics/resources/util.js"></script> > <script> > description("Tests that cross-origin iframe storage access is denied if the iframe is sandboxed and doesn't have the allow token."); > jsTestIsAsync = true; >@@ -12,14 +13,6 @@ > > window.addEventListener("message", receiveMessage, false); > >- function setEnableFeature(enable) { >- if (!enable) >- testRunner.statisticsResetToConsistentState(); >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- testRunner.setStorageAccessAPIEnabled(enable); >- } >- > function receiveMessage(event) { > if (event.origin === "http://localhost:8000") { > if (event.data.indexOf("PASS") !== -1) >@@ -28,8 +21,7 @@ > testFailed(event.data.replace("FAIL ", "")); > } else > testFailed("Received a message from an unexpected origin: " + event.origin); >- setEnableFeature(false); >- finishJSTest(); >+ setEnableFeature(false, finishJSTest); > } > > function activateElement(elementId) { >@@ -42,34 +34,40 @@ > eventSender.keyDown("escape"); > else { > testFailed("No eventSender."); >- setEnableFeature(false); >- finishJSTest(); >+ setEnableFeature(false, finishJSTest); > } > }, > function () { > testFailed("Promise rejected."); >- setEnableFeature(false); >- finishJSTest(); >+ setEnableFeature(false, finishJSTest); > } > ); > } > > function runTest() { >- setEnableFeature(true); >- >- testRunner.setStatisticsPrevalentResource(statisticsUrl, true); >- if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >- testFailed("Host did not get set as prevalent resource."); >- testRunner.setStatisticsHasHadNonRecentUserInteraction(statisticsUrl); >- if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) >- testFailed("Host did not get logged for user interaction."); >- testRunner.statisticsUpdateCookiePartitioning(); >- >- activateElement("theIframe"); >+ setEnableFeature(true, function() { >+ testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() { >+ if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >+ testFailed("Host did not get set as prevalent resource."); >+ testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, true, function() { >+ if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) >+ testFailed("Host did not get logged for user interaction."); >+ testRunner.statisticsUpdateCookieBlocking(function() { >+ let iframeElement = document.createElement("iframe"); >+ iframeElement.setAttribute("sandbox", "allow-scripts allow-same-origin allow-modals"); >+ iframeElement.onload = function() { >+ activateElement("TheIframeThatRequestsStorageAccess"); >+ }; >+ iframeElement.id = "TheIframeThatRequestsStorageAccess"; >+ iframeElement.src = "http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldGrantAccess,userShouldNotBeConsulted,policyShouldDenyAccess,isNotSameOriginIframe"; >+ document.body.appendChild(iframeElement); >+ }); >+ }); >+ }); >+ }); > } > </script> > </head> >-<body> >- <iframe sandbox="allow-scripts allow-same-origin allow-modals" onload="runTest()" id="theIframe" src="http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldGrantAccess,userShouldNotBeConsulted,policyShouldDenyAccess,isNotSameOriginIframe"></iframe> >+<body onload="runTest()"> > </body> > </html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-user-gesture.html b/LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-user-gesture.html >index 6640f798be6a5adae9bdbab2876b85aeb8a5ea2c..45a0e3c5452acf604caaa5667213dc5876f99dbc 100644 >--- a/LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-user-gesture.html >+++ b/LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-user-gesture.html >@@ -3,6 +3,7 @@ > <head> > <script src="/js-test-resources/js-test.js"></script> > <script src="/js-test-resources/ui-helper.js"></script> >+ <script src="/resourceLoadStatistics/resources/util.js"></script> > <script> > description("Tests that cross-origin iframe storage access is denied if the iframe is sandboxed, has the allow token, but calls the API without a user gesture being processed."); > jsTestIsAsync = true; >@@ -12,14 +13,6 @@ > > window.addEventListener("message", receiveMessage, false); > >- function setEnableFeature(enable) { >- if (!enable) >- testRunner.statisticsResetToConsistentState(); >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- testRunner.setStorageAccessAPIEnabled(enable); >- } >- > function receiveMessage(event) { > if (event.origin === "http://localhost:8000") { > if (event.data.indexOf("PASS") !== -1) >@@ -28,23 +21,30 @@ > testFailed(event.data.replace("FAIL ", "")); > } else > testFailed("Received a message from an unexpected origin: " + event.origin); >- setEnableFeature(false); >- finishJSTest(); >+ setEnableFeature(false, finishJSTest); > } > >- setEnableFeature(true); >- >- testRunner.setStatisticsPrevalentResource(statisticsUrl, true); >- if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >- testFailed("Host did not get set as prevalent resource."); >- testRunner.setStatisticsHasHadNonRecentUserInteraction(statisticsUrl); >- if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) >- testFailed("Host did not get logged for user interaction."); >- testRunner.statisticsUpdateCookiePartitioning(); >- >+ function runTest() { >+ setEnableFeature(true, function() { >+ testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() { >+ if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >+ testFailed("Host did not get set as prevalent resource."); >+ testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, true, function() { >+ if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) >+ testFailed("Host did not get logged for user interaction."); >+ testRunner.statisticsUpdateCookieBlocking(function() { >+ let iframeElement = document.createElement("iframe"); >+ iframeElement.setAttribute("sandbox", "allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals"); >+ iframeElement.id = "TheIframeThatRequestsStorageAccess"; >+ iframeElement.src = "http://localhost:8000/storageAccess/resources/request-storage-access-without-user-gesture-iframe.html#userShouldGrantAccess,userShouldNotBeConsulted,policyShouldNotGrantAccess,isNotSameOriginIframe"; >+ document.body.appendChild(iframeElement); >+ }); >+ }); >+ }); >+ }); >+ } > </script> > </head> >-<body> >-<iframe sandbox="allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals" id="theIframe" src="http://localhost:8000/storageAccess/resources/request-storage-access-without-user-gesture-iframe.html#userShouldGrantAccess,userShouldNotBeConsulted,policyShouldNotGrantAccess,isNotSameOriginIframe"></iframe> >+<body onload="runTest()"> > </body> > </html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-iframe.html b/LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-iframe.html >index 2daedd597c5aad8126ff435b62e96d5ac9667581..09d45e21a7f1f00bf79178962858ab3da32261ab 100644 >--- a/LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-iframe.html >+++ b/LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-iframe.html >@@ -41,11 +41,11 @@ > } > > function runTest() { >- activateElement("theIframe"); >+ activateElement("TheIframeThatRequestsStorageAccess"); > } > </script> > </head> > <body> >- <iframe onload="runTest()" id="theIframe" src="http://127.0.0.1:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldDenyAccess,userShouldNotBeConsulted,policyShouldGrantAccess,isSameOriginIframe"></iframe> >+ <iframe onload="runTest()" id="TheIframeThatRequestsStorageAccess" src="http://127.0.0.1:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldDenyAccess,userShouldNotBeConsulted,policyShouldGrantAccess,isSameOriginIframe"></iframe> > </body> > </html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe-without-allow-token.html b/LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe-without-allow-token.html >index bf149ac558914d25422f609be07f7690a326ff2f..62dd3784a5734a95a03d3a6773b23eb2d8dbaa3f 100644 >--- a/LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe-without-allow-token.html >+++ b/LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe-without-allow-token.html >@@ -3,6 +3,7 @@ > <head> > <script src="/js-test-resources/js-test.js"></script> > <script src="/js-test-resources/ui-helper.js"></script> >+ <script src="/resourceLoadStatistics/resources/util.js"></script> > <script> > description("Tests that same-origin iframe storage access is granted if the iframe is sandboxed but doesn't have the allow token."); > jsTestIsAsync = true; >@@ -12,14 +13,6 @@ > > window.addEventListener("message", receiveMessage, false); > >- function setEnableFeature(enable) { >- if (!enable) >- testRunner.statisticsResetToConsistentState(); >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- testRunner.setStorageAccessAPIEnabled(enable); >- } >- > function receiveMessage(event) { > if (event.origin === "http://127.0.0.1:8000") { > if (event.data.indexOf("PASS") !== -1) >@@ -28,8 +21,7 @@ > testFailed(event.data.replace("FAIL ", "")); > } else > testFailed("Received a message from an unexpected origin: " + event.origin); >- setEnableFeature(false); >- finishJSTest(); >+ setEnableFeature(false, finishJSTest); > } > > function activateElement(elementId) { >@@ -42,34 +34,40 @@ > eventSender.keyDown("escape"); > else { > testFailed("No eventSender."); >- setEnableFeature(false); >- finishJSTest(); >+ setEnableFeature(false, finishJSTest); > } > }, > function () { > testFailed("Promise rejected."); >- setEnableFeature(false); >- finishJSTest(); >+ setEnableFeature(false, finishJSTest); > } > ); > } > > function runTest() { >- setEnableFeature(true); >- >- testRunner.setStatisticsPrevalentResource(statisticsUrl, true); >- if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >- testFailed("Host did not get set as prevalent resource."); >- testRunner.setStatisticsHasHadNonRecentUserInteraction(statisticsUrl); >- if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) >- testFailed("Host did not get logged for user interaction."); >- testRunner.statisticsUpdateCookiePartitioning(); >- >- activateElement("theIframe"); >+ setEnableFeature(true, function() { >+ testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() { >+ if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >+ testFailed("Host did not get set as prevalent resource."); >+ testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, true, function() { >+ if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl)) >+ testFailed("Host did not get logged for user interaction."); >+ testRunner.statisticsUpdateCookieBlocking(function() { >+ let iframeElement = document.createElement("iframe"); >+ iframeElement.setAttribute("sandbox", "allow-scripts allow-same-origin allow-modals"); >+ iframeElement.onload = function() { >+ activateElement("TheIframeThatRequestsStorageAccess"); >+ }; >+ iframeElement.id = "TheIframeThatRequestsStorageAccess"; >+ iframeElement.src = "http://127.0.0.1:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldDenyAccess,userShouldNotBeConsulted,policyShouldGrantAccess,isSameOriginIframe"; >+ document.body.appendChild(iframeElement); >+ }); >+ }); >+ }); >+ }); > } > </script> > </head> >-<body> >- <iframe sandbox="allow-scripts allow-same-origin allow-modals" onload="runTest()" id="theIframe" src="http://127.0.0.1:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldDenyAccess,userShouldNotBeConsulted,policyShouldGrantAccess,isSameOriginIframe"></iframe> >+<body onload="runTest()"> > </body> > </html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe.html b/LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe.html >index 46674a224a71df332e61c50cd9918f9022af0417..b7eabf90cde7aed82485a57fb0e4444915a1c372 100644 >--- a/LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe.html >+++ b/LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe.html >@@ -41,11 +41,11 @@ > } > > function runTest() { >- activateElement("theIframe"); >+ activateElement("TheIframeThatRequestsStorageAccess"); > } > </script> > </head> > <body> >- <iframe sandbox="allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals" onload="runTest()" id="theIframe" src="http://127.0.0.1:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldDenyAccess,userShouldNotBeConsulted,policyShouldGrantAccess,isSameOriginIframe"></iframe> >+ <iframe sandbox="allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals" onload="runTest()" id="TheIframeThatRequestsStorageAccess" src="http://127.0.0.1:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldDenyAccess,userShouldNotBeConsulted,policyShouldGrantAccess,isSameOriginIframe"></iframe> > </body> > </html> >\ No newline at end of file >diff --git a/LayoutTests/http/tests/storageAccess/request-storage-access-top-frame.html b/LayoutTests/http/tests/storageAccess/request-storage-access-top-frame.html >index d35557cb185e70bf4c933e3882c96f565e410557..6a497daa65c3ae6b61543d3c261ca048722f72e3 100644 >--- a/LayoutTests/http/tests/storageAccess/request-storage-access-top-frame.html >+++ b/LayoutTests/http/tests/storageAccess/request-storage-access-top-frame.html >@@ -3,18 +3,11 @@ > <body onload="runTest()"> > <script src="/js-test-resources/js-test.js"></script> > <script src="/js-test-resources/ui-helper.js"></script> >+<script src="/resourceLoadStatistics/resources/util.js"></script> > <script> > description("Tests that top frame storage access is always granted in case the page requests it."); > jsTestIsAsync = true; > >- function setEnableFeature(enable) { >- if (!enable) >- testRunner.statisticsResetToConsistentState(); >- internals.setResourceLoadStatisticsEnabled(enable); >- testRunner.setCookieStoragePartitioningEnabled(enable); >- testRunner.setStorageAccessAPIEnabled(enable); >- } >- > function activateElement(elementId) { > var element = document.getElementById(elementId); > var centerX = element.offsetLeft + element.offsetWidth / 2; >@@ -24,8 +17,7 @@ > }, > function () { > testFailed("Promise rejected."); >- setEnableFeature(false); >- finishJSTest(); >+ setEnableFeature(false, finishJSTest); > } > ); > } >@@ -54,13 +46,11 @@ > hasStorageAccess = hasAccess; > shouldBe("requestStorageAccessResolved", "true"); > shouldBe("hasStorageAccess", "true"); >- setEnableFeature(false); >- finishJSTest(); >+ setEnableFeature(false, finishJSTest); > }, > function (reason) { > testFailed("document.hasStorageAccess() was rejected. Reason: " + reason); >- setEnableFeature(false); >- finishJSTest(); >+ setEnableFeature(false, finishJSTest); > } > ); > } >diff --git a/LayoutTests/http/tests/storageAccess/resources/nesting-iframe.html b/LayoutTests/http/tests/storageAccess/resources/nesting-iframe.html >index 6081d7b3650d95ef7992a89329fd28a39080c877..9e08006124826c6baf9529106113e2bfacaf9535 100644 >--- a/LayoutTests/http/tests/storageAccess/resources/nesting-iframe.html >+++ b/LayoutTests/http/tests/storageAccess/resources/nesting-iframe.html >@@ -3,6 +3,6 @@ > <head> > </head> > <body> >-<iframe sandbox="allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals" id="theIframe" src="http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldGrantAccess,userShouldNotBeConsulted,policyShouldDenyAccess,isNotSameOriginIframe"></iframe> >+<iframe sandbox="allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals" id="TheIframeThatRequestsStorageAccess" src="http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldGrantAccess,userShouldNotBeConsulted,policyShouldDenyAccess,isNotSameOriginIframe"></iframe> > </body> > </html> >\ No newline at end of file >diff --git a/LayoutTests/platform/ios/TestExpectations b/LayoutTests/platform/ios/TestExpectations >index 6c1c46f79301c908a5430070eded1d1f1e9ec9c9..4812e2fd5c9427f6ac439e32ea0b68a0c1a2fe77 100644 >--- a/LayoutTests/platform/ios/TestExpectations >+++ b/LayoutTests/platform/ios/TestExpectations >@@ -3024,14 +3024,10 @@ webkit.org/b/174120 http/tests/resourceLoadStatistics/user-interaction-in-cross- > http/tests/resourceLoadStatistics/user-interaction-only-reported-once-within-short-period-of-time.html [ Skip ] > http/tests/resourceLoadStatistics/user-interaction-reported-after-website-data-removal.html [ Skip ] > # Skipped in WK2 expectations because cookie partitioning is only available in macOS High Sierra and iOS 11. >-http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion.html [ Pass ] >-http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html [ Pass ] >-http/tests/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html [ Pass ] >-http/tests/resourceLoadStatistics/third-party-cookie-with-and-without-user-interaction.html [ Pass ] >+http/tests/resourceLoadStatistics/cookie-deletion.html [ Pass ] >+http/tests/resourceLoadStatistics/cookies-with-and-without-user-interaction.html [ Pass ] > http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html [ Pass ] >-webkit.org/b/183216 [ Release ] http/tests/resourceLoadStatistics/add-partitioning-to-redirect.html [ Pass ] >-webkit.org/b/183216 [ Release ] http/tests/resourceLoadStatistics/add-blocking-to-redirect.html [ Pass ] >-webkit.org/b/183216 [ Release ] http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html [ Pass ] >+http/tests/resourceLoadStatistics/add-blocking-to-redirect.html [ Pass ] > http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html [ Pass ] > http/tests/resourceLoadStatistics/grandfathering.html [ Pass ] > http/tests/resourceLoadStatistics/clear-in-memory-and-persistent-store.html [ Pass ] >diff --git a/LayoutTests/platform/mac-wk2/TestExpectations b/LayoutTests/platform/mac-wk2/TestExpectations >index 7e91f6a7e215f4b39247e05e2e948243cbbae9cf..9d422c8edbad3ee6526b0a31f311abddf857f45e 100644 >--- a/LayoutTests/platform/mac-wk2/TestExpectations >+++ b/LayoutTests/platform/mac-wk2/TestExpectations >@@ -726,23 +726,22 @@ http/tests/resourceLoadStatistics/user-interaction-in-cross-origin-sub-frame.htm > http/tests/resourceLoadStatistics/user-interaction-reported-after-website-data-removal.html [ Pass ] > > [ HighSierra+ ] http/tests/storageAccess/has-storage-access-crash.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-and-grant-access-cross-origin-non-sandboxed-iframe.html [ Pass ] >+[ HighSierra+ ] http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe.html [ Pass ] > [ HighSierra+ ] http/tests/storageAccess/request-storage-access-crash.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-and-try-access-from-right-frame.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-without-user-interaction.html [ Pass ] >+[ HighSierra+ ] http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-nested-iframe.html [ Pass ] >+[ HighSierra+ ] http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction.html [ Pass ] >+[ HighSierra+ ] http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame.html [ Pass ] >+[ HighSierra+ ] http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-but-access-from-wrong-frame.html [ Pass ] >+[ HighSierra+ ] http/tests/storageAccess/request-and-grant-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 ] >+[ HighSierra+ ] http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-user-interaction.html [ Pass ] > [ HighSierra+ ] http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access.html [ Pass ] > [ HighSierra+ ] http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access.html [ Pass ] > [ HighSierra+ ] http/tests/storageAccess/deny-storage-access-under-opener.html [ Pass ] >@@ -792,14 +791,10 @@ webkit.org/b/185994 [ Debug ] fast/text/user-installed-fonts/shadow-postscript-f > [ HighSierra+ ] http/tests/ssl/applepay/ApplePaySessionV3.html [ Pass ] > [ HighSierra+ ] http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https.html [ Pass ] > # <rdar://problem/31634451> >-[ HighSierra+ ] http/tests/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html [ Pass ] >-[ HighSierra+ ] http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html [ Pass ] >-[ HighSierra+ ] http/tests/resourceLoadStatistics/third-party-cookie-with-and-without-user-interaction.html [ Pass ] >-[ HighSierra+ ] http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion.html [ Pass Failure ] >+[ HighSierra+ ] http/tests/resourceLoadStatistics/cookies-with-and-without-user-interaction.html [ Pass ] >+[ HighSierra+ ] http/tests/resourceLoadStatistics/cookie-deletion.html [ Pass ] > [ HighSierra+ ] http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html [ Pass ] >-[ HighSierra+ ] http/tests/resourceLoadStatistics/add-partitioning-to-redirect.html [ Pass ] > [ HighSierra+ ] http/tests/resourceLoadStatistics/add-blocking-to-redirect.html [ Pass ] >-[ HighSierra+ ] http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html [ Pass ] > [ HighSierra+ ] http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html [ Pass ] > [ HighSierra+ ] http/tests/resourceLoadStatistics/clear-in-memory-and-persistent-store.html [ Pass ] > [ HighSierra+ ] http/tests/resourceLoadStatistics/clear-in-memory-and-persistent-store-one-hour.html [ Pass ] >diff --git a/LayoutTests/platform/wk2/TestExpectations b/LayoutTests/platform/wk2/TestExpectations >index eb17740f603eb546ddd3117631b5c5f3b04b29fc..39ebc2e8254e362c6366ad6d73c681a67962ff11 100644 >--- a/LayoutTests/platform/wk2/TestExpectations >+++ b/LayoutTests/platform/wk2/TestExpectations >@@ -716,18 +716,14 @@ http/tests/resourceLoadStatistics/grandfathering.html [ Pass ] > webkit.org/b/180703 http/tests/resourceLoadStatistics/telemetry-generation.html [ Pass Failure ] > http/tests/resourceLoadStatistics/prune-statistics.html [ Pass ] > http/tests/resourceLoadStatistics [ Pass ] >-# Cookie partitioning is only supported in macOS High Sierra and iOS 11. >-http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion.html [ Skip ] >-http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html [ Skip ] >-http/tests/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html [ Skip ] >-http/tests/resourceLoadStatistics/third-party-cookie-with-and-without-user-interaction.html [ Skip ] >-http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html [ Skip ] >-http/tests/resourceLoadStatistics/add-partitioning-to-redirect.html [ Skip ] >-http/tests/resourceLoadStatistics/add-blocking-to-redirect.html [ Skip ] >-http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html [ Skip ] >-http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html [ Skip ] >+# These are only supported behind a compile time flag in macOS High Sierra + iOS 11, and above. >+http/tests/resourceLoadStatistics/cookie-deletion.html [ Skip ] >+http/tests/resourceLoadStatistics/cookies-with-and-without-user-interaction.html [ Skip ] > http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects.html [ Skip ] > http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-requests.html [ Skip ] >+http/tests/resourceLoadStatistics/add-blocking-to-redirect.html [ Skip ] >+http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html [ Skip ] >+http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html [ Skip ] > > # Process swapping is only implemented on WebKit2. > http/tests/navigation/process-swap-window-open.html [ Pass ]
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 188109
:
345946
|
345954
|
345960
|
346085
|
346102
|
346128
|
346136
|
346145
|
346200
| 346208