Resource Load Statistics: Remove partitioned cookies for reduced complexity, lower...
authorwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Jul 2018 23:23:43 +0000 (23:23 +0000)
committerwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Jul 2018 23:23:43 +0000 (23:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=188109
<rdar://problem/42664391>

Reviewed by Brent Fulgham, Chris Dumez, and Alex Christensen.

Source/WebCore:

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().

Source/WebKit:

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:

Tools:

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):

LayoutTests:

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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234440 268f45cc-cd09-0410-ab3c-d52691b4dbfc

139 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/resourceLoadStatistics/add-blocking-to-redirect.html
LayoutTests/http/tests/resourceLoadStatistics/add-partitioning-to-redirect-expected.txt [deleted file]
LayoutTests/http/tests/resourceLoadStatistics/add-partitioning-to-redirect.html [deleted file]
LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-redirect-collusion.html
LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-redirect-to-prevalent.html
LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-collusion.html
LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-to-prevalent.html
LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-unique-redirects-to.html
LayoutTests/http/tests/resourceLoadStatistics/classify-as-very-prevalent-based-on-mixed-statistics.html
LayoutTests/http/tests/resourceLoadStatistics/cookie-deletion-expected.txt [moved from LayoutTests/http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion-expected.txt with 69% similarity]
LayoutTests/http/tests/resourceLoadStatistics/cookie-deletion.html [moved from LayoutTests/http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion.html with 62% similarity]
LayoutTests/http/tests/resourceLoadStatistics/cookies-with-and-without-user-interaction-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/resourceLoadStatistics/cookies-with-and-without-user-interaction.html [moved from LayoutTests/http/tests/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html with 68% similarity]
LayoutTests/http/tests/resourceLoadStatistics/do-not-block-top-level-navigation-redirect.html
LayoutTests/http/tests/resourceLoadStatistics/enable-debug-mode.html
LayoutTests/http/tests/resourceLoadStatistics/grandfathering.html
LayoutTests/http/tests/resourceLoadStatistics/non-prevalent-resource-with-user-interaction.html
LayoutTests/http/tests/resourceLoadStatistics/non-prevalent-resource-without-user-interaction.html
LayoutTests/http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context-expected.txt
LayoutTests/http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html
LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
LayoutTests/http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout-expected.txt [deleted file]
LayoutTests/http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html [deleted file]
LayoutTests/http/tests/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction-expected.txt [deleted file]
LayoutTests/http/tests/resourceLoadStatistics/remove-blocking-in-redirect-expected.txt
LayoutTests/http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html
LayoutTests/http/tests/resourceLoadStatistics/remove-partitioning-in-redirect-expected.txt [deleted file]
LayoutTests/http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html [deleted file]
LayoutTests/http/tests/resourceLoadStatistics/resources/get-cookies.php
LayoutTests/http/tests/resourceLoadStatistics/resources/set-cookie-on-redirect.php [new file with mode: 0644]
LayoutTests/http/tests/resourceLoadStatistics/resources/util.js [new file with mode: 0644]
LayoutTests/http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
LayoutTests/http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
LayoutTests/http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
LayoutTests/http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
LayoutTests/http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
LayoutTests/http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
LayoutTests/http/tests/resourceLoadStatistics/set-custom-prevalent-resource-in-debug-mode.html
LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects.html
LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-requests.html
LayoutTests/http/tests/resourceLoadStatistics/telemetry-generation.html
LayoutTests/http/tests/resourceLoadStatistics/third-party-cookie-with-and-without-user-interaction-expected.txt [deleted file]
LayoutTests/http/tests/resourceLoadStatistics/third-party-cookie-with-and-without-user-interaction.html [deleted file]
LayoutTests/http/tests/resourceLoadStatistics/user-interaction-in-cross-origin-sub-frame.html
LayoutTests/http/tests/resourceLoadStatistics/user-interaction-only-reported-once-within-short-period-of-time.html
LayoutTests/http/tests/resourceLoadStatistics/user-interaction-reported-after-website-data-removal.html
LayoutTests/http/tests/storageAccess/deny-storage-access-under-opener.html
LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener-expected.txt
LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener.html
LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction-expected.txt [deleted file]
LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction.html [deleted file]
LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction.html [deleted file]
LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-user-interaction-expected.txt [moved from LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction-expected.txt with 66% similarity]
LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-user-interaction.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-expected.txt [moved from LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe-expected.txt with 100% similarity]
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-pop-window-expected.txt [moved from LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe-pop-window-expected.txt with 100% similarity]
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-pop-window.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe.html [moved from LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe.html with 54% similarity]
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-expected.txt [moved from LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-expected.txt with 100% similarity]
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 [moved 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 with 81% similarity]
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame.html [moved 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 with 57% similarity]
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 [moved 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 with 82% similarity]
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-but-access-from-wrong-frame.html [moved 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 with 62% similarity]
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-expected.txt [moved from LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-recent-user-interaction-expected.txt with 100% similarity]
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction.html [moved from LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-recent-user-interaction.html with 63% similarity]
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction-expected.txt [moved from LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction-expected.txt with 100% similarity]
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction.html [moved from LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction.html with 70% similarity]
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe.html [moved from LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe.html with 85% similarity]
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-nested-iframe-expected.txt [moved from LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-nested-iframe-expected.txt with 100% similarity]
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-nested-iframe.html [moved from LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-nested-iframe.html with 50% similarity]
LayoutTests/http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access-expected.txt
LayoutTests/http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access.html
LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access.html
LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe-pop-window.html [deleted file]
LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin.html
LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-allow-token.html
LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-user-gesture.html
LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-iframe.html
LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe-without-allow-token.html
LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe.html
LayoutTests/http/tests/storageAccess/request-storage-access-top-frame.html
LayoutTests/http/tests/storageAccess/resources/nesting-iframe.html
LayoutTests/platform/ios/TestExpectations
LayoutTests/platform/mac-wk2/TestExpectations
LayoutTests/platform/wk2/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/loader/ResourceLoadStatistics.cpp
Source/WebCore/loader/ResourceLoadStatistics.h
Source/WebCore/platform/network/NetworkStorageSession.h
Source/WebCore/platform/network/ResourceHandle.h
Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp
Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm
Source/WebCore/platform/network/mac/ResourceHandleMac.mm
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkProcess.cpp
Source/WebKit/NetworkProcess/NetworkProcess.h
Source/WebKit/NetworkProcess/NetworkProcess.messages.in
Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.cpp
Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h
Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp
Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.h
Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm
Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm
Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm
Source/WebKit/UIProcess/API/C/WKCookieManager.cpp
Source/WebKit/UIProcess/API/C/WKCookieManager.h
Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp
Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h
Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h
Source/WebKit/UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm
Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in
Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp
Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.h
Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.cpp
Source/WebKit/UIProcess/WebCookieManagerProxy.cpp
Source/WebKit/UIProcess/WebCookieManagerProxy.h
Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp
Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestController.h
Tools/WebKitTestRunner/TestInvocation.cpp
Tools/WebKitTestRunner/TestInvocation.h
Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm

index ca20d15..26e326d 100644 (file)
@@ -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  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [iOS] Spelling suggestions cannot be selected in focused form controls when zoomed in
index bbb3145..0139195 100644 (file)
@@ -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";
                 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":
 
     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 (file)
index 5ad7298..0000000
+++ /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 (file)
index 01f020b..0000000
+++ /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>
index c3bcd6d..4d0d7c9 100644 (file)
@@ -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>
     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();
 
index 6980ab4..d9cacd4 100644 (file)
@@ -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>
     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.");
index 459bb17..452fbf4 100644 (file)
@@ -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>
     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);
index 9cb8870..7bff973 100644 (file)
@@ -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>
     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.");
index 95977f9..e513fbe 100644 (file)
@@ -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>
     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.");
index 040ca6a..3359f60 100644 (file)
@@ -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>
     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.");
@@ -11,27 +11,35 @@ 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: '<!--frame2-->'
+Frame: '<!--frame3-->'
 --------
-Setting partitioned, third party cookie.
+Try to set third party cookie.
 
 
 --------
-Frame: '<!--frame3-->'
+Frame: '<!--frame4-->'
 --------
-Should only receive partitioned, third party cookie.
+Should receive no cookies.
 Did not receive cookie named 'firstPartyCookie'.
-Received cookie named 'thirdPartyCookie'.
-Client-side document.cookie: thirdPartyCookie=value
+Did not receive cookie named 'thirdPartyCookie'.
+Client-side document.cookie:
 
 --------
-Frame: '<!--frame4-->'
+Frame: '<!--frame5-->'
 --------
 After removal, should receive no cookies.
 Did not receive cookie named 'firstPartyCookie'.
@@ -39,9 +47,9 @@ Did not receive cookie named 'thirdPartyCookie'.
 Client-side document.cookie:
 
 --------
-Frame: '<!--frame5-->'
+Frame: '<!--frame6-->'
 --------
-After user interaction, should receive no cookies.
+After declassified, should receive no cookies.
 Did not receive cookie named 'firstPartyCookie'.
 Did not receive cookie named 'thirdPartyCookie'.
 Client-side document.cookie:
@@ -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>
     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 fragmentWithReturnUrl = "http://" + partitionHost + "/resourceLoadStatistics/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);
     }
         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 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 no cookies.", runTest);
+                openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive first-party cookie.", runTest);
                 break;
             case "#step3":
+                // Classify localhost as prevalent.
                 document.location.hash = "step4";
-                openIframe(thirdPartyBaseUrl + subPathToSetThirdPartyCookie + "&message=Setting partitioned, third party cookie.", runTest);
+                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 only receive partitioned, third party cookie.", fireDataModificationHandlerAndContinue);
+                openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive no cookies.", runTest);
                 break;
             case "#step5":
+                // Try setting a cookie as third-party.
                 document.location.hash = "step6";
-                setTimeout(runTest, 10);
+                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=After removal, should receive no cookies.", setUserInteractionAndContinue);
+                openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive no cookies.", fireDataModificationHandlerAndContinue);
                 break;
             case "#step7":
-                openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=After user interaction, should receive no cookies.", finishTest);
+                // 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;
         }
     }
             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);
-            });
+            runTest();
         });
     } else {
         runTest();
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 (file)
index 0000000..5d1092e
--- /dev/null
@@ -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:
@@ -4,6 +4,7 @@
     <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 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();
-    }
+    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() {
                 break;
             case "#step2":
                 document.location.hash = "step3";
-                openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive no cookies.", runTest);
+                openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive first-party cookie.", runTest);
                 break;
             case "#step3":
                 document.location.hash = "step4";
-                openIframe(thirdPartyBaseUrl + subPathToSetThirdPartyCookie + "&message=Setting partitioned, third party cookie.", runTest);
+                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 only receive partitioned, third party cookie.", setUserInteractionAndContinue);
+                openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive no cookies.", setUserInteractionAndContinue);
                 break;
             case "#step5":
-                openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=After user interaction, should still only receive a partitioned, third-party cookie.", finishTest);
+                openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=After user interaction, should still receive no cookies.", finishTest);
                 break;
         }
     }
@@ -78,8 +71,9 @@
             testRunner.waitUntilDone();
             testRunner.dumpChildFramesAsText();
             document.location.hash = "step1";
-
-            testRunner.statisticsSetShouldPartitionCookiesForHost("localhost", true, runTest);
+            if (testRunner.isStatisticsPrevalentResource(thirdPartyOrigin))
+                testFailed("Localhost was classified as prevalent resource before the test starts.");
+            runTest();
         });
     } else {
         runTest();
index 01a3781..5183e69 100644 (file)
@@ -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>
index 0250d52..0161565 100644 (file)
@@ -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>
 
     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))
index 6cbd872..b1ba5e7 100644 (file)
@@ -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>
     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();
index e4adbde..69dd4c4 100644 (file)
@@ -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>
     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.");
index 3b9aff4..f346d3b 100644 (file)
@@ -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>
     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.");
index 73f18d0..0fb97f9 100644 (file)
@@ -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
index 4669c57..02fc923 100644 (file)
@@ -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() {
         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":
                 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;
         }
     }
         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);
                 });
             });
         });
index 4752395..176ece0 100644 (file)
@@ -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);
         }
index 67fa05c..91ec577 100644 (file)
@@ -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);
         }
index 5fb23a1..2bf1f85 100644 (file)
@@ -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);
         }
index 3a123e8..000785f 100644 (file)
@@ -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);
         }
index c1b37b9..a7640f3 100644 (file)
@@ -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);
         }
index 9ece227..ba965b9 100644 (file)
@@ -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-with-partitioning-timeout-expected.txt b/LayoutTests/http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout-expected.txt
deleted file mode 100644 (file)
index 50e82c8..0000000
+++ /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 (file)
index beff3a3..0000000
+++ /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 (file)
index 81b25e7..0000000
+++ /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
index 0c22b62..2d8d99b 100644 (file)
@@ -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.
 
 
 --------
index 558e8f2..61c7f17 100644 (file)
@@ -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";
                 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.
 
     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 (file)
index 03f0255..0000000
+++ /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 (file)
index a5e3d91..0000000
+++ /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>
index 8e73a2b..fee40c9 100644 (file)
@@ -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 (file)
index 0000000..483ce2d
--- /dev/null
@@ -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 (file)
index 0000000..dc42844
--- /dev/null
@@ -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();
+        });
+    }
+}
index 4a15495..88e7f36 100644 (file)
@@ -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);
         }
index 3d3fbf8..665ce0f 100644 (file)
@@ -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);
         }
index 080929d..877a7e4 100644 (file)
@@ -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);
         }
index 27598c2..aa2d383 100644 (file)
@@ -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);
         }
index 53f7a6c..d472ab5 100644 (file)
@@ -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);
         }
index 6c4c8f4..fd83181 100644 (file)
@@ -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);
         }
index 7f28af3..5aa7dd8 100644 (file)
@@ -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>
 
     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))
index e8b7f09..5d7a3bc 100644 (file)
@@ -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);
                     });
index 2040288..cd7c9cc 100644 (file)
@@ -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) {
index 4db3127..8419562 100644 (file)
@@ -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>
     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 (file)
index 405627c..0000000
+++ /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 (file)
index b72163e..0000000
+++ /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>
index a9c1be6..564ef09 100644 (file)
@@ -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;
index a30b228..2299584 100644 (file)
@@ -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;
     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;
index 55bebd7..f8aee7a 100644 (file)
@@ -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;
     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;
index c1ad838..f98b138 100644 (file)
@@ -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) {
             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>
index bc5a809..5fe43c7 100644 (file)
@@ -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".
index c4a3e47..b6f6761 100644 (file)
@@ -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);
     }
 
     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 (file)
index d044d03..0000000
+++ /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 (file)
index c6ea1db..0000000
+++ /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.html b/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction.html
deleted file mode 100644 (file)
index e532d7b..0000000
+++ /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.html b/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-user-interaction.html
new file mode 100644 (file)
index 0000000..a707c8b
--- /dev/null
@@ -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-pop-window.html b/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-pop-window.html
new file mode 100644 (file)
index 0000000..291f9fb
--- /dev/null
@@ -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
@@ -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 granted if the iframe is not sandboxed and the user accepts.");
         jsTestIsAsync = true;
 
         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);
             } else
                 testFailed("Received a message from an unexpected origin: " + event.origin);
-            finishJSTest();
-            setEnableFeature(false);
+            setEnableFeature(false, finishJSTest);
         }
 
         function activateElement(elementId) {
                         eventSender.keyDown("escape");
                     else {
                         testFailed("No eventSender.");
-                        finishJSTest();
-                        setEnableFeature(false);
+                        setEnableFeature(false, finishJSTest);
                     }
                 },
                 function () {
                     testFailed("Promise rejected.");
-                    finishJSTest();
-                    setEnableFeature(false);
+                    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() {
+                            activateElement("TheIframeThatRequestsStorageAccess");
+                        });
+                    });
+                });
+            });
         }
     </script>
 </head>
 <body>
-    <iframe onload="runTest()" id="theIframe" src="http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess,isNotSameOriginIframe"></iframe>
+    <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
@@ -12,21 +12,13 @@ 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-->'
+Frame: '<!--frame2-->'
 --------
 Should not receive cookies.
 Did not receive cookie named 'firstPartyCookie'.
@@ -34,15 +26,23 @@ Did not receive cookie named 'partitionedCookie'.
 Client-side document.cookie:
 
 --------
-Frame: '<!--frame4-->'
+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-->'
 --------
-Should receive partitioned cookie.
+After the top frame navigates the sub frame, the sub frame should no longer have access to cookies.
 Did not receive cookie named 'firstPartyCookie'.
-Received cookie named 'partitionedCookie'.
-Client-side document.cookie: partitionedCookie=value
+Did not receive cookie named 'partitionedCookie'.
+Client-side document.cookie:
@@ -3,6 +3,9 @@
 <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 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 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 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;
                         eventSender.keyDown("escape");
                     else {
                         testFailed("No eventSender.");
-                        setEnableFeature(false);
-                        finishJSTest();
+                        setEnableFeature(false, finishJSTest);
                     }
                 },
                 function () {
                     testFailed("Promise rejected.");
-                    setEnableFeature(false);
-                    finishJSTest();
+                    setEnableFeature(false, finishJSTest);
                 }
             );
         }
@@ -74,7 +67,6 @@
         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.
                     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);
+                    // 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";
-                    // Set partitioned cookie for localhost.
+                    // Try to set a 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);
+                    // 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";
-                    activateElement("TheIframeThatRequestsStorageAccess");
+                    // 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 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.";
+                    // 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();
+                    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";
+            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>
-</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
@@ -12,18 +12,13 @@ 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-->'
+Frame: '<!--frame2-->'
 --------
 Should not receive cookies.
 Did not receive cookie named 'firstPartyCookie'.
@@ -31,23 +26,28 @@ Did not receive cookie named 'partitionedCookie'.
 Client-side document.cookie:
 
 --------
-Frame: '<!--frame4-->'
+Frame: '<!--frame3-->'
 --------
 
 
 
 --------
-Frame: '<!--frame5-->'
+Frame: '<!--frame4-->'
 --------
-Should receive partitioned cookie.
+Should not receive cookies.
 Did not receive cookie named 'firstPartyCookie'.
-Received cookie named 'partitionedCookie'.
-Client-side document.cookie: partitionedCookie=value
+Did not receive cookie named 'partitionedCookie'.
+Client-side document.cookie:
+
+--------
+Frame: '<!--frame5-->'
+--------
+
 
 --------
 Frame: '<!--frame6-->'
 --------
-Should receive partitioned cookie.
+Should not receive cookies.
 Did not receive cookie named 'firstPartyCookie'.
-Received cookie named 'partitionedCookie'.
-Client-side document.cookie: partitionedCookie=value
+Did not receive cookie named 'partitionedCookie'.
+Client-side document.cookie:
@@ -3,6 +3,9 @@
 <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 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 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 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;
                         eventSender.keyDown("escape");
                     else {
                         testFailed("No eventSender.");
-                        setEnableFeature(false);
-                        finishJSTest();
+                        setEnableFeature(false, finishJSTest);
                     }
                 },
                 function () {
                     testFailed("Promise rejected.");
-                    setEnableFeature(false);
-                    finishJSTest();
+                    setEnableFeature(false, finishJSTest);
                 }
             );
         }
@@ -74,7 +67,6 @@
         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.
                     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);
+                    // 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";
-                    // Set partitioned cookie for localhost.
+                    // Try to set 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);
+                    // 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";
-                    activateElement("theIframe");
+                    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 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);
+                    // 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();
+                    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";
+            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>
-</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
         }
 
         function runTest() {
-            activateElement("theIframe");
+            activateElement("TheIframeThatRequestsStorageAccess");
         }
 
         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.");
+        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>
-    <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
         }
 
         function runTest() {
-            activateElement("theIframe");
+            activateElement("TheIframeThatRequestsStorageAccess");
         }
 
         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.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>
-    <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
         }
 
         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://localhost:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess,isNotSameOriginIframe"></iframe>
+    <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
@@ -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 is nested.");
         jsTestIsAsync = true;
 
         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) {
                         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();
+            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);
 
-            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 onload="runTest()">
 </body>
 </html>
\ No newline at end of file
index 1ed3bd3..ff075cd 100644 (file)
@@ -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";
         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
index 2068391..b9310a6 100644 (file)
@@ -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;
         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-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 (file)
index d1e1813..0000000
+++ /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
index 393a7e9..a2f6d83 100644 (file)
         }
 
         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
index aeadcaf..358be81 100644 (file)
@@ -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;
 
         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) {
                         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
index 6640f79..45a0e3c 100644 (file)
@@ -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;
 
         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)
                     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
index 2daedd5..09d45e2 100644 (file)
         }
 
         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
index bf149ac..62dd378 100644 (file)
@@ -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;
 
         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) {
                         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
index 46674a2..b7eabf9 100644 (file)
         }
 
         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
index d35557c..6a497da 100644 (file)
@@ -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);
             }
         );
     }
                 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);
             }
         );
     }
index 6081d7b..9e08006 100644 (file)
@@ -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
index 6c1c46f..4812e2f 100644 (file)
@@ -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 ]
index 7e91f6a..9d422c8 100644 (file)
@@ -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 ]
index eb17740..39ebc2e 100644 (file)
@@ -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 ]
index 9ad8a32..ef572ec 100644 (file)
@@ -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  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [iOS] Spelling suggestions cannot be selected in focused form controls when zoomed in
index 96b7eb9..d75639c 100644 (file)
@@ -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;
 }
 
index f047c77..eb9c7b6 100644 (file)
@@ -96,7 +96,6 @@ struct ResourceLoadStatistics {
     unsigned timesAccessedAsFirstPartyDueToStorageAccessAPI { 0 };
 
     // In-memory only
-    bool isMarkedForCookiePartitioning { false };
     bool isMarkedForCookieBlocking { false };
 };
 
index 08a82dd..986f7e4 100644 (file)
@@ -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;
index 1272862..f3609d0 100644 (file)
@@ -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)
index f942ec9..8119fd5 100644 (file)
@@ -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
index 385c44b..315e50e 100644 (file)
@@ -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);
index 1b73407..1d7b6e7 100644 (file)
@@ -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];
index 713ea73..bd1d97f 100644 (file)
@@ -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
index 3a039e6..7c0cdd4 100644 (file)
@@ -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)
index d2917d8..c9e9da2 100644 (file)
@@ -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);