Changeset 252623 in webkit
- Timestamp:
- Nov 18, 2019 10:30:46 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r252622 r252623 1 2019-11-18 John Wilander <wilander@apple.com> 2 3 Check if ITP is on before applying third-party cookie blocking 4 https://bugs.webkit.org/show_bug.cgi?id=204322 5 <rdar://problem/57120772> 6 7 Reviewed by Chris Dumez and Alexey Proskuryakov. 8 9 * http/tests/resourceLoadStatistics/no-third-party-cookie-blocking-when-itp-is-off-expected.txt: Added. 10 * http/tests/resourceLoadStatistics/no-third-party-cookie-blocking-when-itp-is-off.html: Added. 11 1 12 2019-11-18 Simon Fraser <simon.fraser@apple.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r252622 r252623 1 2019-11-18 John Wilander <wilander@apple.com> 2 3 Check if ITP is on before applying third-party cookie blocking 4 https://bugs.webkit.org/show_bug.cgi?id=204322 5 <rdar://problem/57120772> 6 7 Reviewed by Chris Dumez and Alexey Proskuryakov. 8 9 This change makes sure WebCore::NetworkStorageSession knows 10 whether ITP is on or off and checks that first thing in 11 WebCore::NetworkStorageSession::shouldBlockCookies(). 12 13 This check was never needed before since if ITP was off, 14 there would be no classified domains and thus the function 15 would always return false. However, 16 https://trac.webkit.org/changeset/251353/webkit introduced 17 full third-party cookie blocking for websites without user 18 interaction and that rule is checked before checking domain 19 classification. The effect was unconditional third-party 20 cookie blocking if ITP is off. This changes fixes that bug. 21 22 Note that this patch already landed as branch-specific in 23 https://trac.webkit.org/changeset/252549/webkit 24 25 Test: http/tests/resourceLoadStatistics/no-third-party-cookie-blocking-when-itp-is-off.html 26 27 * platform/network/NetworkStorageSession.cpp: 28 (WebCore::NetworkStorageSession::shouldBlockThirdPartyCookies const): 29 (WebCore::NetworkStorageSession::shouldBlockThirdPartyCookiesButKeepFirstPartyCookiesFor const): 30 (WebCore::NetworkStorageSession::shouldBlockCookies const): 31 Now checks whether ITP is on or off. 32 * platform/network/NetworkStorageSession.h: 33 (WebCore::NetworkStorageSession::setResourceLoadStatisticsEnabled): 34 1 35 2019-11-18 Simon Fraser <simon.fraser@apple.com> 2 36 -
trunk/Source/WebCore/platform/network/NetworkStorageSession.cpp
r251467 r252623 60 60 bool NetworkStorageSession::shouldBlockThirdPartyCookies(const RegistrableDomain& registrableDomain) const 61 61 { 62 if ( registrableDomain.isEmpty())62 if (!m_isResourceLoadStatisticsEnabled || registrableDomain.isEmpty()) 63 63 return false; 64 64 … … 71 71 bool NetworkStorageSession::shouldBlockThirdPartyCookiesButKeepFirstPartyCookiesFor(const RegistrableDomain& registrableDomain) const 72 72 { 73 if (!m_isResourceLoadStatisticsEnabled || registrableDomain.isEmpty()) 74 return false; 75 76 ASSERT(!(m_registrableDomainsToBlockAndDeleteCookiesFor.contains(registrableDomain) && m_registrableDomainsToBlockButKeepCookiesFor.contains(registrableDomain))); 77 78 return m_registrableDomainsToBlockButKeepCookiesFor.contains(registrableDomain); 79 } 80 81 bool NetworkStorageSession::hasHadUserInteractionAsFirstParty(const RegistrableDomain& registrableDomain) const 82 { 73 83 if (registrableDomain.isEmpty()) 74 84 return false; 75 85 76 ASSERT(!(m_registrableDomainsToBlockAndDeleteCookiesFor.contains(registrableDomain) && m_registrableDomainsToBlockButKeepCookiesFor.contains(registrableDomain)));77 78 return m_registrableDomainsToBlockButKeepCookiesFor.contains(registrableDomain);79 }80 81 bool NetworkStorageSession::hasHadUserInteractionAsFirstParty(const RegistrableDomain& registrableDomain) const82 {83 if (registrableDomain.isEmpty())84 return false;85 86 86 return m_registrableDomainsWithUserInteractionAsFirstParty.contains(registrableDomain); 87 87 } … … 89 89 bool NetworkStorageSession::shouldBlockCookies(const ResourceRequest& request, Optional<FrameIdentifier> frameID, Optional<PageIdentifier> pageID) const 90 90 { 91 if (!m_isResourceLoadStatisticsEnabled) 92 return false; 93 91 94 return shouldBlockCookies(request.firstPartyForCookies(), request.url(), frameID, pageID); 92 95 } … … 94 97 bool NetworkStorageSession::shouldBlockCookies(const URL& firstPartyForCookies, const URL& resource, Optional<FrameIdentifier> frameID, Optional<PageIdentifier> pageID) const 95 98 { 99 if (!m_isResourceLoadStatisticsEnabled) 100 return false; 101 96 102 RegistrableDomain firstPartyDomain { firstPartyForCookies }; 97 103 if (firstPartyDomain.isEmpty()) -
trunk/Source/WebCore/platform/network/NetworkStorageSession.h
r251467 r252623 144 144 145 145 #if ENABLE(RESOURCE_LOAD_STATISTICS) 146 void setResourceLoadStatisticsEnabled(bool enabled) { m_isResourceLoadStatisticsEnabled = enabled; } 146 147 WEBCORE_EXPORT bool shouldBlockCookies(const ResourceRequest&, Optional<FrameIdentifier>, Optional<PageIdentifier>) const; 147 148 WEBCORE_EXPORT bool shouldBlockCookies(const URL& firstPartyForCookies, const URL& resource, Optional<FrameIdentifier>, Optional<PageIdentifier>) const; … … 189 190 190 191 #if ENABLE(RESOURCE_LOAD_STATISTICS) 192 bool m_isResourceLoadStatisticsEnabled = false; 191 193 Optional<Seconds> clientSideCookieCap(const RegistrableDomain& firstParty, Optional<PageIdentifier>) const; 192 194 HashSet<RegistrableDomain> m_registrableDomainsToBlockAndDeleteCookiesFor; -
trunk/Source/WebKit/ChangeLog
r252619 r252623 1 2019-11-18 John Wilander <wilander@apple.com> 2 3 Check if ITP is on before applying third-party cookie blocking 4 https://bugs.webkit.org/show_bug.cgi?id=204322 5 <rdar://problem/57120772> 6 7 Reviewed by Chris Dumez and Alexey Proskuryakov. 8 9 This change makes sure WebCore::NetworkStorageSession knows 10 whether ITP is on or off and checks that first thing in 11 WebCore::NetworkStorageSession::shouldBlockCookies(). 12 13 This check was never needed before since if ITP was off, 14 there would be no classified domains and thus the function 15 would always return false. However, 16 https://trac.webkit.org/changeset/251353/webkit introduced 17 full third-party cookie blocking for websites without user 18 interaction and that rule is checked before checking domain 19 classification. The effect was unconditional third-party 20 cookie blocking if ITP is off. This changes fixes that bug. 21 22 Note that this patch already landed as branch-specific in 23 https://trac.webkit.org/changeset/252549/webkit 24 25 * NetworkProcess/NetworkSession.cpp: 26 (WebKit::NetworkSession::setResourceLoadStatisticsEnabled): 27 Now tells WebCore::NetworkStorageSession the status of 28 ITP. 29 1 30 2019-11-18 David Kilzer <ddkilzer@apple.com> 2 31 -
trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp
r252397 r252623 154 154 { 155 155 ASSERT(!m_isInvalidated); 156 if (auto* storageSession = networkStorageSession()) 157 storageSession->setResourceLoadStatisticsEnabled(enable); 156 158 if (!enable) { 157 159 destroyResourceLoadStatistics(); -
trunk/Tools/ChangeLog
r252617 r252623 1 2019-11-18 John Wilander <wilander@apple.com> 2 3 Check if ITP is on before applying third-party cookie blocking 4 https://bugs.webkit.org/show_bug.cgi?id=204322 5 <rdar://problem/57120772> 6 7 Reviewed by Chris Dumez and Alexey Proskuryakov. 8 9 This is test infrastructure to allow a layout test to 10 disable ITP in the network process. 11 12 * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: 13 * WebKitTestRunner/InjectedBundle/TestRunner.cpp: 14 (WTR::TestRunner::setStatisticsEnabled): 15 (WTR::TestRunner::setStatisticsDebugMode): 16 * WebKitTestRunner/InjectedBundle/TestRunner.h: 17 * WebKitTestRunner/TestController.cpp: 18 (WTR::TestController::setStatisticsEnabled): 19 * WebKitTestRunner/TestController.h: 20 * WebKitTestRunner/TestInvocation.cpp: 21 (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): 22 1 23 2019-11-18 Fujii Hironori <Hironori.Fujii@sony.com> 2 24 -
trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
r251213 r252623 293 293 294 294 // Resource Load Statistics 295 void setStatisticsEnabled(boolean value); 295 296 void installStatisticsDidModifyDataRecordsCallback(object callback); 296 297 void installStatisticsDidScanDataRecordsCallback(object callback); -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
r251950 r252623 1409 1409 } 1410 1410 1411 void TestRunner::setStatisticsEnabled(bool value) 1412 { 1413 WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("SetStatisticsEnabled")); 1414 WKRetainPtr<WKBooleanRef> messageBody = adoptWK(WKBooleanCreate(value)); 1415 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); 1416 } 1417 1411 1418 void TestRunner::setStatisticsDebugMode(bool value, JSValueRef completionHandler) 1412 1419 { … … 1416 1423 WKRetainPtr<WKBooleanRef> messageBody = adoptWK(WKBooleanCreate(value)); 1417 1424 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); 1418 1419 1425 } 1420 1426 -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
r251950 r252623 381 381 382 382 // Resource Load Statistics 383 void setStatisticsEnabled(bool value); 383 384 void installStatisticsDidModifyDataRecordsCallback(JSValueRef callback); 384 385 void installStatisticsDidScanDataRecordsCallback(JSValueRef callback); -
trunk/Tools/WebKitTestRunner/TestController.cpp
r252397 r252623 3255 3255 } 3256 3256 3257 void TestController::setStatisticsEnabled(bool value) 3258 { 3259 WKWebsiteDataStoreSetResourceLoadStatisticsEnabled(TestController::websiteDataStore(), value); 3260 } 3261 3257 3262 void TestController::setStatisticsDebugMode(bool value) 3258 3263 { -
trunk/Tools/WebKitTestRunner/TestController.h
r252228 r252623 208 208 void setShouldAllowDeviceOrientationAndMotionAccess(bool value) { m_shouldAllowDeviceOrientationAndMotionAccess = value; } 209 209 210 void setStatisticsEnabled(bool value); 210 211 void setStatisticsDebugMode(bool value); 211 212 void setStatisticsPrevalentResourceForDebugMode(WKStringRef hostName); -
trunk/Tools/WebKitTestRunner/TestInvocation.cpp
r252259 r252623 1072 1072 } 1073 1073 1074 if (WKStringIsEqualToUTF8CString(messageName, "SetStatisticsEnabled")) { 1075 ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID()); 1076 WKBooleanRef value = static_cast<WKBooleanRef>(messageBody); 1077 TestController::singleton().setStatisticsEnabled(WKBooleanGetValue(value)); 1078 return nullptr; 1079 } 1080 1074 1081 if (WKStringIsEqualToUTF8CString(messageName, "SetStatisticsDebugMode")) { 1075 1082 ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
Note: See TracChangeset
for help on using the changeset viewer.