Changeset 250589 in webkit
- Timestamp:
- Oct 1, 2019, 6:18:48 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 16 edited
- 2 copied
- 1 moved
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/http/tests/storageAccess/has-storage-access-false-by-default-ephemeral-expected.txt (added)
-
LayoutTests/http/tests/storageAccess/has-storage-access-false-by-default-ephemeral.html (copied) (copied from trunk/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html ) (3 diffs)
-
LayoutTests/http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral-expected.txt (added)
-
LayoutTests/http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral.html (copied) (copied from trunk/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html ) (2 diffs)
-
LayoutTests/http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-expected.txt (added)
-
LayoutTests/http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies.html (moved) (moved from trunk/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html ) (2 diffs)
-
LayoutTests/platform/ios/TestExpectations (modified) (1 diff)
-
LayoutTests/platform/mac-wk2/TestExpectations (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/platform/network/NetworkStorageSession.h (modified) (2 diffs)
-
Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm (modified) (1 diff)
-
Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp (modified) (1 diff)
-
Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp (modified) (1 diff)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp (modified) (1 diff)
-
Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp (modified) (1 diff)
-
Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h (modified) (1 diff)
-
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp (modified) (1 diff)
-
Source/WebKit/NetworkProcess/NetworkProcess.cpp (modified) (2 diffs)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebCore/PublicSuffix.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r250570 r250589 1 2019-10-01 John Wilander <wilander@apple.com> 2 3 Storage Access API: document.hasStorageAccess() should return true when the cookie policy allows access 4 https://bugs.webkit.org/show_bug.cgi?id=202435 5 <rdar://problem/55718526> 6 7 Reviewed by Brent Fulgham. 8 9 WebKit's Storage Access API implementation has so far only looked at whether ITP is 10 blocking cookie access or not. However, the default cookie policy is still in 11 effect underneath ITP. document.hasStorageAccess() should return true if the 12 third-party: 13 a) is not classified by ITP, and 14 b) has cookies which implies it can use cookies as third-party according to the 15 default cookie policy. 16 17 * http/tests/storageAccess/has-storage-access-false-by-default-ephemeral-expected.txt: Added. 18 * http/tests/storageAccess/has-storage-access-false-by-default-ephemeral.html: Copied from LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html. 19 * http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral-expected.txt: Added. 20 * http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral.html: Copied from LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html. 21 * http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-expected.txt: Added. 22 * http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies.html: Renamed from LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html. 23 * platform/ios/TestExpectations: 24 * platform/mac-wk2/TestExpectations: 25 1 26 2019-10-01 Rob Buis <rbuis@igalia.com> 2 27 -
trunk/LayoutTests/http/tests/storageAccess/has-storage-access-false-by-default-ephemeral.html
r250588 r250589 4 4 <head> 5 5 <script src="/js-test-resources/js-test.js"></script> 6 <script src="/js-test-resources/ui-helper.js"></script>7 6 <script src="/resourceLoadStatistics/resources/util.js"></script> 8 7 <script> 9 description("Tests that document.hasStorageAccess() returns true for a 3rd-party iframe if there is no way to request access (feature off).");8 description("Tests that document.hasStorageAccess() returns false for a 3rd-party iframe by default (ephemeral session)."); 10 9 jsTestIsAsync = true; 11 10 … … 20 19 } else 21 20 testFailed("Received a message from an unexpected origin: " + event.origin); 22 setEnableFeature(false, finishJSTest);21 finishJSTest(); 23 22 } 24 23 … … 26 25 const statisticsUrl = "http://" + hostUnderTest + "/temp"; 27 26 function runTest() { 28 setEnableFeature(false, function() { 29 let iframeElement = document.createElement("iframe"); 30 iframeElement.id = "TheIframeThatRequestsStorageAccess"; 31 iframeElement.src = "http://localhost:8000/storageAccess/resources/has-storage-access-iframe.html#policyShouldGrantAccess"; 32 document.body.appendChild(iframeElement); 33 }); 27 let iframeElement = document.createElement("iframe"); 28 iframeElement.id = "TheIframeThatRequestsStorageAccess"; 29 iframeElement.src = "http://localhost:8000/storageAccess/resources/has-storage-access-iframe.html#policyShouldDenyAccess"; 30 document.body.appendChild(iframeElement); 34 31 } 35 32 </script> -
trunk/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral.html
r250588 r250589 4 4 <head> 5 5 <script src="/js-test-resources/js-test.js"></script> 6 <script src="/js-test-resources/ui-helper.js"></script>7 6 <script src="/resourceLoadStatistics/resources/util.js"></script> 8 7 <script> 9 description("Tests that document.hasStorageAccess() returns true for a 3rd-party iframe if the re is no way to request access (feature off).");8 description("Tests that document.hasStorageAccess() returns true for a 3rd-party iframe if the 3rd-party has cookies set (ephemeral session)."); 10 9 jsTestIsAsync = true; 11 10 … … 20 19 } else 21 20 testFailed("Received a message from an unexpected origin: " + event.origin); 22 setEnableFeature(false, finishJSTest);21 finishJSTest(); 23 22 } 24 23 25 24 const hostUnderTest = "localhost:8000"; 26 const statisticsUrl = "http://" + hostUnderTest + "/temp";25 const statisticsUrl = "http://" + hostUnderTest; 27 26 function runTest() { 28 setEnableFeature(false, function() { 27 if (document.location.hash !== "#firstPartyCookieSet") { 28 document.location.href = statisticsUrl + "/storageAccess/resources/set-cookie.php?name=firstPartyCookie&value=value#http://127.0.0.1:8000/storageAccess/has-storage-access-true-if-third-party-has-cookies.html#firstPartyCookieSet"; 29 } else { 29 30 let iframeElement = document.createElement("iframe"); 30 31 iframeElement.id = "TheIframeThatRequestsStorageAccess"; 31 32 iframeElement.src = "http://localhost:8000/storageAccess/resources/has-storage-access-iframe.html#policyShouldGrantAccess"; 32 33 document.body.appendChild(iframeElement); 33 } );34 } 34 35 } 35 36 </script> -
trunk/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies.html
r250588 r250589 4 4 <head> 5 5 <script src="/js-test-resources/js-test.js"></script> 6 <script src="/js-test-resources/ui-helper.js"></script>7 6 <script src="/resourceLoadStatistics/resources/util.js"></script> 8 7 <script> 9 description("Tests that document.hasStorageAccess() returns true for a 3rd-party iframe if the re is no way to request access (feature off).");8 description("Tests that document.hasStorageAccess() returns true for a 3rd-party iframe if the 3rd-party has cookies set."); 10 9 jsTestIsAsync = true; 11 10 … … 24 23 25 24 const hostUnderTest = "localhost:8000"; 26 const statisticsUrl = "http://" + hostUnderTest + "/temp";25 const statisticsUrl = "http://" + hostUnderTest; 27 26 function runTest() { 28 setEnableFeature(false, function() { 27 if (document.location.hash !== "#firstPartyCookieSet") { 28 setEnableFeature(false, function() { 29 document.location.href = statisticsUrl + "/storageAccess/resources/set-cookie.php?name=firstPartyCookie&value=value#http://127.0.0.1:8000/storageAccess/has-storage-access-true-if-third-party-has-cookies.html#firstPartyCookieSet"; 30 }); 31 } else { 29 32 let iframeElement = document.createElement("iframe"); 30 33 iframeElement.id = "TheIframeThatRequestsStorageAccess"; 31 34 iframeElement.src = "http://localhost:8000/storageAccess/resources/has-storage-access-iframe.html#policyShouldGrantAccess"; 32 35 document.body.appendChild(iframeElement); 33 } );36 } 34 37 } 35 38 </script> -
trunk/LayoutTests/platform/ios/TestExpectations
r250450 r250589 2800 2800 http/tests/resourceLoadStatistics/cap-cache-max-age-for-prevalent-resource.html [ Pass ] 2801 2801 http/tests/storageAccess/has-storage-access-false-by-default.html [ Pass ] 2802 2802 http/tests/storageAccess/has-storage-access-false-by-default-ephemeral.html [ Pass ] 2803 http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral.html [ Pass ] 2804 http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies.html [ Pass ] 2803 2805 2804 2806 # Skipped in general expectations since they only work on iOS and Mac, WK2. -
trunk/LayoutTests/platform/mac-wk2/TestExpectations
r250431 r250589 712 712 [ HighSierra+ ] http/tests/storageAccess/deny-with-prompt-does-not-preserve-gesture.html [ Skip ] 713 713 [ HighSierra+ ] http/tests/storageAccess/deny-without-prompt-preserves-gesture.html [ Pass ] 714 [ HighSierra+ ] http/tests/storageAccess/has-storage-access-true-if-feature-off.html [ Pass ]715 714 [ HighSierra+ ] http/tests/storageAccess/has-storage-access-false-by-default.html [ Pass ] 715 [ HighSierra+ ] http/tests/storageAccess/has-storage-access-false-by-default-ephemeral.html [ Pass ] 716 [ HighSierra+ ] http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral.html [ Pass ] 717 [ HighSierra+ ] http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies.html [ Pass ] 716 718 717 719 # As of https://trac.webkit.org/changeset/227762 the timestampResolution is just 5 seconds which makes this test flaky -
trunk/Source/WebCore/ChangeLog
r250588 r250589 1 2019-10-01 John Wilander <wilander@apple.com> 2 3 Storage Access API: document.hasStorageAccess() should return true when the cookie policy allows access 4 https://bugs.webkit.org/show_bug.cgi?id=202435 5 <rdar://problem/55718526> 6 7 Reviewed by Brent Fulgham. 8 9 WebKit's Storage Access API implementation has so far only looked at whether ITP is 10 blocking cookie access or not. However, the default cookie policy is still in 11 effect underneath ITP. document.hasStorageAccess() should return true if the 12 third-party: 13 a) is not classified by ITP, and 14 b) has cookies which implies it can use cookies as third-party according to the 15 default cookie policy. 16 17 Tests: http/tests/storageAccess/has-storage-access-false-by-default-ephemeral.html 18 http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral.html 19 http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies.html 20 21 * platform/network/NetworkStorageSession.h: 22 * platform/network/cocoa/NetworkStorageSessionCocoa.mm: 23 (WebCore::NetworkStorageSession::hasCookies const): 24 * platform/network/curl/NetworkStorageSessionCurl.cpp: 25 (WebCore::NetworkStorageSession::hasCookies const): 26 Not yet implemented. Always says false. 27 * platform/network/soup/NetworkStorageSessionSoup.cpp: 28 (WebCore::NetworkStorageSession::hasCookies const): 29 Not yet implemented. Always says false. 30 1 31 2019-10-01 Tim Horton <timothy_horton@apple.com> 2 32 -
trunk/Source/WebCore/platform/network/NetworkStorageSession.h
r248902 r250589 31 31 #include "RegistrableDomain.h" 32 32 #include <pal/SessionID.h> 33 #include <wtf/CompletionHandler.h> 33 34 #include <wtf/Function.h> 34 35 #include <wtf/HashMap.h> … … 134 135 WEBCORE_EXPORT Vector<Cookie> getAllCookies(); 135 136 WEBCORE_EXPORT Vector<Cookie> getCookies(const URL&); 137 WEBCORE_EXPORT void hasCookies(const RegistrableDomain&, CompletionHandler<void(bool)>&&) const; 136 138 WEBCORE_EXPORT bool getRawCookies(const URL& firstParty, const SameSiteInfo&, const URL&, Optional<FrameIdentifier>, Optional<PageIdentifier>, Vector<Cookie>&) const; 137 139 WEBCORE_EXPORT void flushCookieStore(); -
trunk/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm
r248902 r250589 103 103 } 104 104 105 void NetworkStorageSession::hasCookies(const RegistrableDomain& domain, CompletionHandler<void(bool)>&& completionHandler) const 106 { 107 ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies)); 108 109 for (NSHTTPCookie *nsCookie in nsCookieStorage().cookies) { 110 if (RegistrableDomain::uncheckedCreateFromHost(nsCookie.domain) == domain) { 111 completionHandler(true); 112 return; 113 } 114 } 115 116 completionHandler(false); 117 } 118 105 119 void NetworkStorageSession::flushCookieStore() 106 120 { -
trunk/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp
r248714 r250589 155 155 } 156 156 157 void NetworkStorageSession::hasCookies(const RegistrableDomain&, CompletionHandler<void(bool)>&& completionHandler) const 158 { 159 // FIXME: Implement. 160 completionHandler(false); 161 } 162 157 163 bool NetworkStorageSession::getRawCookies(const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<FrameIdentifier> frameID, Optional<PageIdentifier> pageID, Vector<Cookie>& rawCookies) const 158 164 { -
trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp
r248846 r250589 415 415 } 416 416 417 void NetworkStorageSession::hasCookies(const RegistrableDomain&, CompletionHandler<void(bool)>&& completionHandler) const 418 { 419 // FIXME: Implement. 420 completionHandler(false); 421 } 422 417 423 bool NetworkStorageSession::getRawCookies(const URL& firstParty, const SameSiteInfo&, const URL& url, Optional<FrameIdentifier> frameID, Optional<PageIdentifier> pageID, Vector<Cookie>& rawCookies) const 418 424 { -
trunk/Source/WebKit/ChangeLog
r250584 r250589 1 2019-10-01 John Wilander <wilander@apple.com> 2 3 Storage Access API: document.hasStorageAccess() should return true when the cookie policy allows access 4 https://bugs.webkit.org/show_bug.cgi?id=202435 5 <rdar://problem/55718526> 6 7 Reviewed by Brent Fulgham. 8 9 WebKit's Storage Access API implementation has so far only looked at whether ITP is 10 blocking cookie access or not. However, the default cookie policy is still in 11 effect underneath ITP. document.hasStorageAccess() should return true if the 12 third-party: 13 a) is not classified by ITP, and 14 b) has cookies which implies it can use cookies as third-party according to the 15 default cookie policy. 16 17 * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: 18 (WebKit::ResourceLoadStatisticsMemoryStore::hasStorageAccess): 19 * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: 20 (WebKit::WebResourceLoadStatisticsStore::hasCookies): 21 * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: 22 * NetworkProcess/NetworkConnectionToWebProcess.cpp: 23 (WebKit::NetworkConnectionToWebProcess::hasStorageAccess): 24 * NetworkProcess/NetworkProcess.cpp: 25 (WebKit::NetworkProcess::registrableDomainsWithWebsiteData): 26 1 27 2019-10-01 Antti Koivisto <antti@apple.com> 2 28 -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp
r250431 r250589 218 218 auto& subFrameStatistic = ensureResourceStatisticsForRegistrableDomain(subFrameDomain); 219 219 // Return false if this domain cannot ask for storage access. 220 if (shouldBlockAndPurgeCookies(subFrameStatistic) || !shouldBlockAndKeepCookies(subFrameStatistic)) {220 if (shouldBlockAndPurgeCookies(subFrameStatistic)) { 221 221 completionHandler(false); 222 return; 223 } 224 225 if (!shouldBlockAndKeepCookies(subFrameStatistic)) { 226 RunLoop::main().dispatch([store = makeRef(store()), subFrameDomain = subFrameDomain.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable { 227 store->hasCookies(subFrameDomain, [store = store.copyRef(), completionHandler = WTFMove(completionHandler)](bool result) mutable { 228 store->statisticsQueue().dispatch([completionHandler = WTFMove(completionHandler), result] () mutable { 229 completionHandler(result); 230 }); 231 }); 232 }); 222 233 return; 223 234 } -
trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp
r250393 r250589 435 435 } 436 436 437 void WebResourceLoadStatisticsStore::hasCookies(const RegistrableDomain& domain, CompletionHandler<void(bool)>&& completionHandler) 438 { 439 ASSERT(RunLoop::isMain()); 440 441 if (m_networkSession) { 442 if (auto* storageSession = m_networkSession->networkStorageSession()) { 443 storageSession->hasCookies(domain, WTFMove(completionHandler)); 444 return; 445 } 446 } 447 448 completionHandler(false); 449 } 450 437 451 void WebResourceLoadStatisticsStore::didCreateNetworkProcess() 438 452 { -
trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h
r249920 r250589 177 177 void callHasStorageAccessForFrameHandler(const SubFrameDomain&, const TopFrameDomain&, WebCore::FrameIdentifier, WebCore::PageIdentifier, CompletionHandler<void(bool)>&&); 178 178 179 void hasCookies(const RegistrableDomain&, CompletionHandler<void(bool)>&&); 180 179 181 void didCreateNetworkProcess(); 180 182 -
trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
r250354 r250589 717 717 resourceLoadStatistics->hasStorageAccess(subFrameDomain, topFrameDomain, frameID, pageID, WTFMove(completionHandler)); 718 718 return; 719 } else { 720 storageSession()->hasCookies(subFrameDomain, WTFMove(completionHandler)); 721 return; 719 722 } 720 723 } 721 724 722 completionHandler( true);725 completionHandler(false); 723 726 } 724 727 -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp
r250521 r250589 1839 1839 auto& websiteDataStore = callbackAggregator->m_websiteData; 1840 1840 1841 Vector<String> hostnamesWithCookiesToDelete;1842 1841 if (websiteDataTypes.contains(WebsiteDataType::Cookies)) { 1843 1842 if (auto* networkStorageSession = storageSession(sessionID)) … … 1845 1844 } 1846 1845 1847 Vector<String> hostnamesWithHSTSToDelete;1848 1846 #if PLATFORM(COCOA) || USE(SOUP) 1849 1847 if (websiteDataTypes.contains(WebsiteDataType::HSTSCache)) { -
trunk/Tools/ChangeLog
r250587 r250589 1 2019-10-01 John Wilander <wilander@apple.com> 2 3 Storage Access API: document.hasStorageAccess() should return true when the cookie policy allows access 4 https://bugs.webkit.org/show_bug.cgi?id=202435 5 <rdar://problem/55718526> 6 7 Reviewed by Brent Fulgham. 8 9 This change makes sure topPrivatelyControlledDomain() correctly handles domains 10 with leading dots, as often used in cookie domains. 11 12 * TestWebKitAPI/Tests/WebCore/PublicSuffix.cpp: 13 (TestWebKitAPI::TEST_F): 14 1 15 2019-10-01 Jonathan Bedard <jbedard@apple.com> 2 16 -
trunk/Tools/TestWebKitAPI/Tests/WebCore/PublicSuffix.cpp
r237584 r250589 180 180 EXPECT_EQ(String("åäö"), topPrivatelyControlledDomain("åäö")); 181 181 EXPECT_EQ(String("ÅÄÖ"), topPrivatelyControlledDomain("ÅÄÖ")); 182 EXPECT_EQ(String("test.com"), topPrivatelyControlledDomain(".test.com")); 182 183 } 183 184
Note:
See TracChangeset
for help on using the changeset viewer.