Changeset 252549 in webkit
- Timestamp:
- Nov 18, 2019, 10:15:44 AM (6 years ago)
- Location:
- branches/safari-608.4.9.0-branch
- Files:
-
- 2 added
- 13 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/http/tests/resourceLoadStatistics/no-third-party-cookie-blocking-when-itp-is-off-expected.txt (added)
-
LayoutTests/http/tests/resourceLoadStatistics/no-third-party-cookie-blocking-when-itp-is-off.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/platform/network/NetworkStorageSession.cpp (modified) (3 diffs)
-
Source/WebCore/platform/network/NetworkStorageSession.h (modified) (2 diffs)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/NetworkProcess/NetworkSession.cpp (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (modified) (1 diff)
-
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (modified) (2 diffs)
-
Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (modified) (1 diff)
-
Tools/WebKitTestRunner/TestController.cpp (modified) (1 diff)
-
Tools/WebKitTestRunner/TestController.h (modified) (1 diff)
-
Tools/WebKitTestRunner/TestInvocation.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-608.4.9.0-branch/LayoutTests/ChangeLog
r252039 r252549 1 2019-11-18 Kocsen Chung <kocsen_chung@apple.com> 2 3 Apply patch. rdar://problem/57283187 4 5 2019-11-18 John Wilander <wilander@apple.com> 6 7 Check if ITP is on before applying third-party cookie blocking 8 https://bugs.webkit.org/show_bug.cgi?id=204109 9 <rdar://problem/57120772> 10 11 Reviewed by Chris Dumez and Alexey Proskuryakov. 12 13 * http/tests/resourceLoadStatistics/no-third-party-cookie-blocking-when-itp-is-off-expected.txt: Added. 14 * http/tests/resourceLoadStatistics/no-third-party-cookie-blocking-when-itp-is-off.html: Added. 15 1 16 2019-11-04 Alan Coon <alancoon@apple.com> 2 17 -
branches/safari-608.4.9.0-branch/Source/WebCore/ChangeLog
r252321 r252549 1 2019-11-18 Kocsen Chung <kocsen_chung@apple.com> 2 3 Apply patch. rdar://problem/57283187 4 5 2019-11-18 John Wilander <wilander@apple.com> 6 7 Check if ITP is on before applying third-party cookie blocking 8 https://bugs.webkit.org/show_bug.cgi?id=204109 9 <rdar://problem/57120772> 10 11 Reviewed by Chris Dumez and Alexey Proskuryakov. 12 13 This change makes sure WebCore::NetworkStorageSession knows 14 whether ITP is on or off and checks that first thing in 15 WebCore::NetworkStorageSession::shouldBlockCookies(). 16 17 This check was never needed before since if ITP was off, 18 there would be no classified domains and thus the function 19 would always return false. However, 20 https://trac.webkit.org/changeset/251353/webkit introduced 21 full third-party cookie blocking for websites without user 22 interaction and that rule is checked before checking domain 23 classification. The effect was unconditional third-party 24 cookie blocking if ITP is off. This changes fixes that bug. 25 26 Note that this patch is branch-specific and expected to not 27 apply to trunk. 28 29 Test: http/tests/resourceLoadStatistics/no-third-party-cookie-blocking-when-itp-is-off.html 30 31 * platform/network/NetworkStorageSession.cpp: 32 (WebCore::NetworkStorageSession::shouldBlockThirdPartyCookies const): 33 (WebCore::NetworkStorageSession::shouldBlockCookies const): 34 Now checks whether ITP is on or off. 35 * platform/network/NetworkStorageSession.h: 36 (WebCore::NetworkStorageSession::setResourceLoadStatisticsEnabled): 37 1 38 2019-11-10 Kocsen Chung <kocsen_chung@apple.com> 2 39 -
branches/safari-608.4.9.0-branch/Source/WebCore/platform/network/NetworkStorageSession.cpp
r251353 r252549 61 61 bool NetworkStorageSession::shouldBlockThirdPartyCookies(const RegistrableDomain& registrableDomain) const 62 62 { 63 if (!m_isResourceLoadStatisticsEnabled || registrableDomain.isEmpty()) 64 return false; 65 66 return m_registrableDomainsToBlockCookieFor.contains(registrableDomain); 67 } 68 69 bool NetworkStorageSession::hasHadUserInteractionAsFirstParty(const RegistrableDomain& registrableDomain) const 70 { 63 71 if (registrableDomain.isEmpty()) 64 72 return false; 65 73 66 return m_registrableDomainsToBlockCookieFor.contains(registrableDomain);67 }68 69 bool NetworkStorageSession::hasHadUserInteractionAsFirstParty(const RegistrableDomain& registrableDomain) const70 {71 if (registrableDomain.isEmpty())72 return false;73 74 74 return m_registrableDomainsWithUserInteractionAsFirstParty.contains(registrableDomain); 75 75 } … … 77 77 bool NetworkStorageSession::shouldBlockCookies(const ResourceRequest& request, Optional<uint64_t> frameID, Optional<PageIdentifier> pageID) const 78 78 { 79 if (!m_isResourceLoadStatisticsEnabled) 80 return false; 81 79 82 return shouldBlockCookies(request.firstPartyForCookies(), request.url(), frameID, pageID); 80 83 } … … 82 85 bool NetworkStorageSession::shouldBlockCookies(const URL& firstPartyForCookies, const URL& resource, Optional<uint64_t> frameID, Optional<PageIdentifier> pageID) const 83 86 { 87 if (!m_isResourceLoadStatisticsEnabled) 88 return false; 89 84 90 RegistrableDomain firstPartyDomain { firstPartyForCookies }; 85 91 if (firstPartyDomain.isEmpty()) -
branches/safari-608.4.9.0-branch/Source/WebCore/platform/network/NetworkStorageSession.h
r251353 r252549 166 166 WEBCORE_EXPORT void resetCrossSiteLoadsWithLinkDecorationForTesting(); 167 167 void setIsThirdPartyCookieBlockingOnSitesWithoutUserInteractionEnabled(bool enabled) { m_isThirdPartyCookieBlockingOnSitesWithoutUserInteractionEnabled = enabled; } 168 void setResourceLoadStatisticsEnabled(bool enabled) { m_isResourceLoadStatisticsEnabled = enabled; } 168 169 #endif 169 170 … … 200 201 bool m_navigationWithLinkDecorationTestMode = false; 201 202 bool m_isThirdPartyCookieBlockingOnSitesWithoutUserInteractionEnabled = true; 203 bool m_isResourceLoadStatisticsEnabled = false; 202 204 #endif 203 205 -
branches/safari-608.4.9.0-branch/Source/WebKit/ChangeLog
r252372 r252549 1 2019-11-18 Kocsen Chung <kocsen_chung@apple.com> 2 3 Apply patch. rdar://problem/57283187 4 5 2019-11-18 John Wilander <wilander@apple.com> 6 7 Check if ITP is on before applying third-party cookie blocking 8 https://bugs.webkit.org/show_bug.cgi?id=204109 9 <rdar://problem/57120772> 10 11 Reviewed by Chris Dumez and Alexey Proskuryakov. 12 13 This change makes sure WebCore::NetworkStorageSession knows 14 whether ITP is on or off and checks that first thing in 15 WebCore::NetworkStorageSession::shouldBlockCookies(). 16 17 This check was never needed before since if ITP was off, 18 there would be no classified domains and thus the function 19 would always return false. However, 20 https://trac.webkit.org/changeset/251353/webkit introduced 21 full third-party cookie blocking for websites without user 22 interaction and that rule is checked before checking domain 23 classification. The effect was unconditional third-party 24 cookie blocking if ITP is off. This changes fixes that bug. 25 26 Note that this patch is branch-specific and expected to not 27 apply to trunk. 28 29 * NetworkProcess/NetworkSession.cpp: 30 (WebKit::NetworkSession::setResourceLoadStatisticsEnabled): 31 Now tells WebCore::NetworkStorageSession the status of 32 ITP. 33 1 34 2019-11-12 Kocsen Chung <kocsen_chung@apple.com> 2 35 -
branches/safari-608.4.9.0-branch/Source/WebKit/NetworkProcess/NetworkSession.cpp
r250493 r252549 131 131 { 132 132 ASSERT(!m_isInvalidated); 133 if (auto* storageSession = networkStorageSession()) 134 storageSession->setResourceLoadStatisticsEnabled(enable); 133 135 if (!enable) { 134 136 destroyResourceLoadStatistics(); -
branches/safari-608.4.9.0-branch/Tools/ChangeLog
r252326 r252549 1 2019-11-18 Kocsen Chung <kocsen_chung@apple.com> 2 3 Apply patch. rdar://problem/57283187 4 5 2019-11-18 John Wilander <wilander@apple.com> 6 7 Check if ITP is on before applying third-party cookie blocking 8 https://bugs.webkit.org/show_bug.cgi?id=204109 9 <rdar://problem/57120772> 10 11 Reviewed by Chris Dumez and Alexey Proskuryakov. 12 13 This is test infrastructure to allow a layout test to 14 disable ITP in the network process. 15 16 * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: 17 * WebKitTestRunner/InjectedBundle/TestRunner.cpp: 18 (WTR::TestRunner::setStatisticsEnabled): 19 (WTR::TestRunner::setStatisticsDebugMode): 20 * WebKitTestRunner/InjectedBundle/TestRunner.h: 21 * WebKitTestRunner/TestController.cpp: 22 (WTR::TestController::setStatisticsEnabled): 23 * WebKitTestRunner/TestController.h: 24 * WebKitTestRunner/TestInvocation.cpp: 25 (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): 26 1 27 2019-11-11 Kocsen Chung <kocsen_chung@apple.com> 2 28 -
branches/safari-608.4.9.0-branch/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
r251899 r252549 293 293 294 294 // Resource Load Statistics 295 void setStatisticsEnabled(boolean value); 295 296 void installStatisticsDidModifyDataRecordsCallback(object callback); 296 297 void installStatisticsDidScanDataRecordsCallback(object callback); -
branches/safari-608.4.9.0-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
r251899 r252549 1378 1378 } 1379 1379 1380 void TestRunner::setStatisticsEnabled(bool value) 1381 { 1382 WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("SetStatisticsEnabled")); 1383 WKRetainPtr<WKBooleanRef> messageBody = adoptWK(WKBooleanCreate(value)); 1384 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); 1385 } 1386 1380 1387 void TestRunner::setStatisticsDebugMode(bool value, JSValueRef completionHandler) 1381 1388 { … … 1385 1392 WKRetainPtr<WKBooleanRef> messageBody = adoptWK(WKBooleanCreate(value)); 1386 1393 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); 1387 1388 1394 } 1389 1395 -
branches/safari-608.4.9.0-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
r251899 r252549 381 381 382 382 // Resource Load Statistics 383 void setStatisticsEnabled(bool value); 383 384 void installStatisticsDidModifyDataRecordsCallback(JSValueRef callback); 384 385 void installStatisticsDidScanDataRecordsCallback(JSValueRef callback); -
branches/safari-608.4.9.0-branch/Tools/WebKitTestRunner/TestController.cpp
r251899 r252549 3211 3211 } 3212 3212 3213 void TestController::setStatisticsEnabled(bool value) 3214 { 3215 auto* dataStore = WKContextGetWebsiteDataStore(platformContext()); 3216 WKWebsiteDataStoreSetResourceLoadStatisticsEnabled(dataStore, value); 3217 } 3218 3213 3219 void TestController::setStatisticsDebugMode(bool value) 3214 3220 { -
branches/safari-608.4.9.0-branch/Tools/WebKitTestRunner/TestController.h
r251899 r252549 205 205 void setShouldAllowDeviceOrientationAndMotionAccess(bool value) { m_shouldAllowDeviceOrientationAndMotionAccess = value; } 206 206 207 void setStatisticsEnabled(bool value); 207 208 void setStatisticsDebugMode(bool value); 208 209 void setStatisticsPrevalentResourceForDebugMode(WKStringRef hostName); -
branches/safari-608.4.9.0-branch/Tools/WebKitTestRunner/TestInvocation.cpp
r251899 r252549 1062 1062 } 1063 1063 1064 if (WKStringIsEqualToUTF8CString(messageName, "SetStatisticsEnabled")) { 1065 ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID()); 1066 WKBooleanRef value = static_cast<WKBooleanRef>(messageBody); 1067 TestController::singleton().setStatisticsEnabled(WKBooleanGetValue(value)); 1068 return nullptr; 1069 } 1070 1064 1071 if (WKStringIsEqualToUTF8CString(messageName, "SetStatisticsDebugMode")) { 1065 1072 ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
Note:
See TracChangeset
for help on using the changeset viewer.