Changeset 252840 in webkit
- Timestamp:
- Nov 23, 2019 7:05:49 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 46 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r252838 r252840 1 2019-11-23 John Wilander <wilander@apple.com> 2 3 Resource Load Statistics: Allow multiple third-party cookie blocking settings 4 https://bugs.webkit.org/show_bug.cgi?id=204389 5 <rdar://problem/57344054> 6 7 Reviewed by Brent Fulgham. 8 9 The added tests existed before and are not re-introduced to test their dedicated setting. 10 11 The changed tests have been expanded to cover the new code paths. 12 13 * http/tests/resourceLoadStatistics/third-party-cookie-blocking-on-sites-without-user-interaction-database-expected.txt: Added. 14 * http/tests/resourceLoadStatistics/third-party-cookie-blocking-on-sites-without-user-interaction-database.html: Added. 15 * http/tests/resourceLoadStatistics/third-party-cookie-blocking-on-sites-without-user-interaction-expected.txt: Added. 16 * http/tests/resourceLoadStatistics/third-party-cookie-blocking-on-sites-without-user-interaction.html: Added. 17 * http/tests/storageAccess/grant-with-prompt-under-general-third-party-cookie-blocking-database-expected.txt: 18 * http/tests/storageAccess/grant-with-prompt-under-general-third-party-cookie-blocking-database.html: 19 * http/tests/storageAccess/grant-with-prompt-under-general-third-party-cookie-blocking-expected.txt: 20 * http/tests/storageAccess/grant-with-prompt-under-general-third-party-cookie-blocking.html: 21 * http/tests/storageAccess/has-storage-access-under-general-third-party-cookie-blocking-with-cookie-database-expected.txt: 22 * http/tests/storageAccess/has-storage-access-under-general-third-party-cookie-blocking-with-cookie-database.html: 23 * http/tests/storageAccess/has-storage-access-under-general-third-party-cookie-blocking-with-cookie-expected.txt: 24 * http/tests/storageAccess/has-storage-access-under-general-third-party-cookie-blocking-with-cookie.html: 25 1 26 2019-11-23 Jonathan Bedard <jbedard@apple.com> 2 27 -
trunk/LayoutTests/http/tests/storageAccess/grant-with-prompt-under-general-third-party-cookie-blocking-database-expected.txt
r251663 r252840 5 5 6 6 PASS Storage access was granted. document.cookie == firstPartyCookie=value, cookies seen server-side == {"firstPartyCookie":"value"} 7 PASS Storage access was granted. document.cookie == firstPartyCookie=value, cookies seen server-side == {"firstPartyCookie":"value"} 7 8 PASS successfullyParsed is true 8 9 -
trunk/LayoutTests/http/tests/storageAccess/grant-with-prompt-under-general-third-party-cookie-blocking-database.html
r252210 r252840 21 21 } else 22 22 testFailed("Received a message from an unexpected origin: " + event.origin); 23 testRunner.setStatisticsShouldBlockThirdPartyCookies(false, function() { 24 setEnableFeature(false, finishJSTest); 25 }); 23 24 switch (document.location.hash) { 25 case "#firstTest": 26 document.location.hash = "secondTest"; 27 // Clear all data so that the previous grant doesn't count toward the next test. 28 testRunner.statisticsClearInMemoryAndPersistentStore(runTest); 29 break; 30 case "#secondTest": 31 testRunner.setStatisticsShouldBlockThirdPartyCookies(false, function() { 32 setEnableFeature(false, finishJSTest); 33 }); 34 break; 35 default: 36 testFailed("Message handler called under unknown circumstances."); 37 testRunner.setStatisticsShouldBlockThirdPartyCookies(false, function() { 38 setEnableFeature(false, finishJSTest); 39 }); 40 } 26 41 } 27 42 … … 53 68 54 69 function runTest() { 55 if (document.location.hash !== "#cookieSet") { 56 setEnableFeature(true, function() { 57 document.location.href = thirdPartyUrl + "/storageAccess/resources/set-cookie.php?name=firstPartyCookie&value=value#" + firstPartyUrl + "/storageAccess/grant-with-prompt-under-general-third-party-cookie-blocking-database.html#cookieSet"; 58 }); 59 } else { 60 testRunner.setStatisticsShouldBlockThirdPartyCookies(true, function() { 61 if (testRunner.isStatisticsPrevalentResource(thirdPartyUrl)) 62 testFailed("Third-party set as prevalent resource."); 63 testRunner.setStatisticsHasHadUserInteraction(firstPartyUrl, true, function() { 64 if (!testRunner.isStatisticsHasHadUserInteraction(firstPartyUrl)) 65 testFailed("First-party did not get logged for user interaction."); 70 switch (document.location.hash) { 71 case "": 72 setEnableFeature(true, function() { 73 document.location.href = thirdPartyUrl + "/storageAccess/resources/set-cookie.php?dummy=" + Math.random() + "&name=firstPartyCookie&value=value#" + firstPartyUrl + "/storageAccess/grant-with-prompt-under-general-third-party-cookie-blocking-database.html#firstTest"; 74 }); 75 break; 76 case "#firstTest": 77 // Test that the request is granted if third-party cookies are blocked under first-parties without 78 // user interaction. 79 testRunner.setStatisticsShouldBlockThirdPartyCookies(true, function() { 80 if (testRunner.isStatisticsPrevalentResource(thirdPartyUrl)) 81 testFailed("Third-party set as prevalent resource."); 82 if (testRunner.isStatisticsHasHadUserInteraction(firstPartyUrl)) 83 testFailed("First-party was logged for user interaction."); 66 84 testRunner.setStatisticsHasHadUserInteraction(thirdPartyUrl, true, function() { 67 85 if (!testRunner.isStatisticsHasHadUserInteraction(thirdPartyUrl)) … … 69 87 let iframeElement = document.createElement("iframe"); 70 88 iframeElement.onload = function() { 71 activateElement("The IframeThatRequestsStorageAccess");89 activateElement("TheFirstIframeThatRequestsStorageAccess"); 72 90 }; 73 iframeElement.id = "The IframeThatRequestsStorageAccess";74 iframeElement.src = "http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html #userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess,isNotSameOriginIframe";91 iframeElement.id = "TheFirstIframeThatRequestsStorageAccess"; 92 iframeElement.src = "http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html?dummy=" + Math.random() + "#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess,isNotSameOriginIframe"; 75 93 document.body.appendChild(iframeElement); 76 94 }); 77 }); 78 }); 95 }, true); 96 break; 97 case "#secondTest": 98 // Test that the request is granted if third-party cookies are blocked unconditionally. 99 testRunner.setStatisticsShouldBlockThirdPartyCookies(true, function() { 100 if (testRunner.isStatisticsPrevalentResource(thirdPartyUrl)) 101 testFailed("Third-party set as prevalent resource."); 102 testRunner.setStatisticsHasHadUserInteraction(thirdPartyUrl, true, function() { 103 if (!testRunner.isStatisticsHasHadUserInteraction(thirdPartyUrl)) 104 testFailed("Third-party did not get logged for user interaction."); 105 let iframeElement = document.createElement("iframe"); 106 iframeElement.onload = function() { 107 activateElement("TheSecondIframeThatRequestsStorageAccess"); 108 }; 109 iframeElement.id = "TheSecondIframeThatRequestsStorageAccess"; 110 iframeElement.src = "http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html?dummy=" + Math.random() + "#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess,isNotSameOriginIframe"; 111 document.body.appendChild(iframeElement); 112 }); 113 }, false); 114 break; 79 115 } 80 116 } -
trunk/LayoutTests/http/tests/storageAccess/grant-with-prompt-under-general-third-party-cookie-blocking-expected.txt
r251663 r252840 5 5 6 6 PASS Storage access was granted. document.cookie == firstPartyCookie=value, cookies seen server-side == {"firstPartyCookie":"value"} 7 PASS Storage access was granted. document.cookie == firstPartyCookie=value, cookies seen server-side == {"firstPartyCookie":"value"} 7 8 PASS successfullyParsed is true 8 9 -
trunk/LayoutTests/http/tests/storageAccess/grant-with-prompt-under-general-third-party-cookie-blocking.html
r251663 r252840 20 20 } else 21 21 testFailed("Received a message from an unexpected origin: " + event.origin); 22 testRunner.setStatisticsShouldBlockThirdPartyCookies(false, function() { 23 setEnableFeature(false, finishJSTest); 24 }); 22 23 switch (document.location.hash) { 24 case "#firstTest": 25 document.location.hash = "secondTest"; 26 // Clear all data so that the previous grant doesn't count toward the next test. 27 testRunner.statisticsClearInMemoryAndPersistentStore(runTest); 28 break; 29 case "#secondTest": 30 testRunner.setStatisticsShouldBlockThirdPartyCookies(false, function() { 31 setEnableFeature(false, finishJSTest); 32 }); 33 break; 34 default: 35 testFailed("Message handler called under unknown circumstances."); 36 testRunner.setStatisticsShouldBlockThirdPartyCookies(false, function() { 37 setEnableFeature(false, finishJSTest); 38 }); 39 } 25 40 } 26 41 … … 52 67 53 68 function runTest() { 54 if (document.location.hash !== "#cookieSet") { 55 setEnableFeature(true, function() { 56 document.location.href = thirdPartyUrl + "/storageAccess/resources/set-cookie.php?name=firstPartyCookie&value=value#" + firstPartyUrl + "/storageAccess/grant-with-prompt-under-general-third-party-cookie-blocking.html#cookieSet"; 57 }); 58 } else { 59 testRunner.setStatisticsShouldBlockThirdPartyCookies(true, function() { 60 if (testRunner.isStatisticsPrevalentResource(thirdPartyUrl)) 61 testFailed("Third-party set as prevalent resource."); 62 testRunner.setStatisticsHasHadUserInteraction(firstPartyUrl, true, function() { 63 if (!testRunner.isStatisticsHasHadUserInteraction(firstPartyUrl)) 64 testFailed("First-party did not get logged for user interaction."); 69 switch (document.location.hash) { 70 case "": 71 setEnableFeature(true, function() { 72 document.location.href = thirdPartyUrl + "/storageAccess/resources/set-cookie.php?dummy=" + Math.random() + "&name=firstPartyCookie&value=value#" + firstPartyUrl + "/storageAccess/grant-with-prompt-under-general-third-party-cookie-blocking.html#firstTest"; 73 }); 74 break; 75 case "#firstTest": 76 // Test that the request is granted if third-party cookies are blocked under first-parties without 77 // user interaction. 78 testRunner.setStatisticsShouldBlockThirdPartyCookies(true, function() { 79 if (testRunner.isStatisticsPrevalentResource(thirdPartyUrl)) 80 testFailed("Third-party set as prevalent resource."); 81 if (testRunner.isStatisticsHasHadUserInteraction(firstPartyUrl)) 82 testFailed("First-party was logged for user interaction."); 83 testRunner.setStatisticsHasHadUserInteraction(thirdPartyUrl, true, function() { 84 if (!testRunner.isStatisticsHasHadUserInteraction(thirdPartyUrl)) 85 testFailed("Third-party did not get logged for user interaction."); 86 let iframeElement = document.createElement("iframe"); 87 iframeElement.onload = function() { 88 activateElement("TheFirstIframeThatRequestsStorageAccess"); 89 }; 90 iframeElement.id = "TheFirstIframeThatRequestsStorageAccess"; 91 iframeElement.src = "http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html?dummy=" + Math.random() + "#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess,isNotSameOriginIframe"; 92 document.body.appendChild(iframeElement); 93 }); 94 }, true); 95 break; 96 case "#secondTest": 97 // Test that the request is granted if third-party cookies are blocked unconditionally. 98 testRunner.setStatisticsShouldBlockThirdPartyCookies(true, function() { 99 if (testRunner.isStatisticsPrevalentResource(thirdPartyUrl)) 100 testFailed("Third-party set as prevalent resource."); 65 101 testRunner.setStatisticsHasHadUserInteraction(thirdPartyUrl, true, function() { 66 102 if (!testRunner.isStatisticsHasHadUserInteraction(thirdPartyUrl)) … … 68 104 let iframeElement = document.createElement("iframe"); 69 105 iframeElement.onload = function() { 70 activateElement("The IframeThatRequestsStorageAccess");106 activateElement("TheSecondIframeThatRequestsStorageAccess"); 71 107 }; 72 iframeElement.id = "The IframeThatRequestsStorageAccess";73 iframeElement.src = "http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html #userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess,isNotSameOriginIframe";108 iframeElement.id = "TheSecondIframeThatRequestsStorageAccess"; 109 iframeElement.src = "http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html?dummy=" + Math.random() + "#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess,isNotSameOriginIframe"; 74 110 document.body.appendChild(iframeElement); 75 111 }); 76 } );77 });112 }, false); 113 break; 78 114 } 79 115 } -
trunk/LayoutTests/http/tests/storageAccess/has-storage-access-under-general-third-party-cookie-blocking-with-cookie-database-expected.txt
r251663 r252840 9 9 PASS No storage access. document.cookie == , cookies seen server-side == "No cookies" 10 10 PASS No storage access. document.cookie == , cookies seen server-side == "No cookies" 11 PASS No storage access. document.cookie == , cookies seen server-side == "No cookies" 11 12 PASS successfullyParsed is true 12 13 -
trunk/LayoutTests/http/tests/storageAccess/has-storage-access-under-general-third-party-cookie-blocking-with-cookie-database.html
r252210 r252840 22 22 } else 23 23 testFailed("Received a message from an unexpected origin: " + event.origin); 24 24 25 if (document.location.hash === "#lastStep") { 25 26 testRunner.setStatisticsShouldBlockThirdPartyCookies(false, function() { … … 51 52 // No general third-party cookie blocking, no user interaction, not prevalent. 52 53 let iframeElement = document.createElement("iframe"); 53 iframeElement.src = thirdPartyUrl + "/storageAccess/resources/has-storage-access-iframe.html #policyShouldGrantAccess";54 iframeElement.src = thirdPartyUrl + "/storageAccess/resources/has-storage-access-iframe.html?dummy=" + Math.random() + "#policyShouldGrantAccess"; 54 55 document.body.appendChild(iframeElement); 55 56 break; … … 61 62 testFailed("Third-party did not get logged for user interaction."); 62 63 let iframeElement = document.createElement("iframe"); 63 iframeElement.src = thirdPartyUrl + "/storageAccess/resources/has-storage-access-iframe.html #policyShouldGrantAccess";64 iframeElement.src = thirdPartyUrl + "/storageAccess/resources/has-storage-access-iframe.html?dummy=" + Math.random() + "#policyShouldGrantAccess"; 64 65 document.body.appendChild(iframeElement); 65 66 }); … … 72 73 testFailed("First-party did not get logged for user interaction."); 73 74 let iframeElement = document.createElement("iframe"); 74 iframeElement.src = thirdPartyUrl + "/storageAccess/resources/has-storage-access-iframe.html #policyShouldGrantAccess";75 iframeElement.src = thirdPartyUrl + "/storageAccess/resources/has-storage-access-iframe.html?dummy=" + Math.random() + "#policyShouldGrantAccess"; 75 76 document.body.appendChild(iframeElement); 76 77 }); … … 78 79 case "#step4": 79 80 document.location.hash = "step5"; 81 // Third-party cookie blocking under first-parties without user interaction, only third-party user interaction, not prevalent. 82 testRunner.setStatisticsShouldBlockThirdPartyCookies(true, function() { 83 testRunner.setStatisticsHasHadUserInteraction(firstPartyUrl, false, function() { 84 if (testRunner.isStatisticsHasHadUserInteraction(firstPartyUrl)) 85 testFailed("First-party got logged for user interaction."); 86 let iframeElement = document.createElement("iframe"); 87 iframeElement.src = thirdPartyUrl + "/storageAccess/resources/has-storage-access-iframe.html?dummy=" + Math.random() + "#policyShouldNotGrantAccess"; 88 document.body.appendChild(iframeElement); 89 }); 90 }, true); 91 break; 92 case "#step5": 93 document.location.hash = "step6"; 80 94 // General third-party cookie blocking, first- and third-party user interaction, not prevalent. 81 95 testRunner.setStatisticsShouldBlockThirdPartyCookies(true, function() { 82 let iframeElement = document.createElement("iframe"); 83 iframeElement.src = thirdPartyUrl + "/storageAccess/resources/has-storage-access-iframe.html#policyShouldNotGrantAccess"; 84 document.body.appendChild(iframeElement); 85 }); 96 testRunner.setStatisticsHasHadUserInteraction(firstPartyUrl, true, function() { 97 if (!testRunner.isStatisticsHasHadUserInteraction(firstPartyUrl)) 98 testFailed("First-party did not get logged for user interaction."); 99 let iframeElement = document.createElement("iframe"); 100 iframeElement.src = thirdPartyUrl + "/storageAccess/resources/has-storage-access-iframe.html?dummy=" + Math.random() + "#policyShouldNotGrantAccess"; 101 document.body.appendChild(iframeElement); 102 }); 103 }, false); 86 104 break; 87 case "#step 5":105 case "#step6": 88 106 document.location.hash = "lastStep"; 89 107 // General third-party cookie blocking, first- and third-party user interaction, prevalent. … … 93 111 testRunner.statisticsUpdateCookieBlocking(function() { 94 112 let iframeElement = document.createElement("iframe"); 95 iframeElement.src = thirdPartyUrl + "/storageAccess/resources/has-storage-access-iframe.html #policyShouldNotGrantAccess";113 iframeElement.src = thirdPartyUrl + "/storageAccess/resources/has-storage-access-iframe.html?dummy=" + Math.random() + "#policyShouldNotGrantAccess"; 96 114 document.body.appendChild(iframeElement); 97 115 }); -
trunk/LayoutTests/http/tests/storageAccess/has-storage-access-under-general-third-party-cookie-blocking-with-cookie-expected.txt
r251663 r252840 9 9 PASS No storage access. document.cookie == , cookies seen server-side == "No cookies" 10 10 PASS No storage access. document.cookie == , cookies seen server-side == "No cookies" 11 PASS No storage access. document.cookie == , cookies seen server-side == "No cookies" 11 12 PASS successfullyParsed is true 12 13 -
trunk/LayoutTests/http/tests/storageAccess/has-storage-access-under-general-third-party-cookie-blocking-with-cookie.html
r251663 r252840 21 21 } else 22 22 testFailed("Received a message from an unexpected origin: " + event.origin); 23 23 24 if (document.location.hash === "#lastStep") { 24 25 testRunner.setStatisticsShouldBlockThirdPartyCookies(false, function() { … … 50 51 // No general third-party cookie blocking, no user interaction, not prevalent. 51 52 let iframeElement = document.createElement("iframe"); 52 iframeElement.src = thirdPartyUrl + "/storageAccess/resources/has-storage-access-iframe.html #policyShouldGrantAccess";53 iframeElement.src = thirdPartyUrl + "/storageAccess/resources/has-storage-access-iframe.html?dummy=" + Math.random() + "#policyShouldGrantAccess"; 53 54 document.body.appendChild(iframeElement); 54 55 break; … … 60 61 testFailed("Third-party did not get logged for user interaction."); 61 62 let iframeElement = document.createElement("iframe"); 62 iframeElement.src = thirdPartyUrl + "/storageAccess/resources/has-storage-access-iframe.html #policyShouldGrantAccess";63 iframeElement.src = thirdPartyUrl + "/storageAccess/resources/has-storage-access-iframe.html?dummy=" + Math.random() + "#policyShouldGrantAccess"; 63 64 document.body.appendChild(iframeElement); 64 65 }); … … 71 72 testFailed("First-party did not get logged for user interaction."); 72 73 let iframeElement = document.createElement("iframe"); 73 iframeElement.src = thirdPartyUrl + "/storageAccess/resources/has-storage-access-iframe.html #policyShouldGrantAccess";74 iframeElement.src = thirdPartyUrl + "/storageAccess/resources/has-storage-access-iframe.html?dummy=" + Math.random() + "#policyShouldGrantAccess"; 74 75 document.body.appendChild(iframeElement); 75 76 }); … … 77 78 case "#step4": 78 79 document.location.hash = "step5"; 80 // Third-party cookie blocking under first-parties without user interaction, only third-party user interaction, not prevalent. 81 testRunner.setStatisticsShouldBlockThirdPartyCookies(true, function() { 82 testRunner.setStatisticsHasHadUserInteraction(firstPartyUrl, false, function() { 83 if (testRunner.isStatisticsHasHadUserInteraction(firstPartyUrl)) 84 testFailed("First-party got logged for user interaction."); 85 let iframeElement = document.createElement("iframe"); 86 iframeElement.src = thirdPartyUrl + "/storageAccess/resources/has-storage-access-iframe.html?dummy=" + Math.random() + "#policyShouldNotGrantAccess"; 87 document.body.appendChild(iframeElement); 88 }); 89 }, true); 90 break; 91 case "#step5": 92 document.location.hash = "step6"; 79 93 // General third-party cookie blocking, first- and third-party user interaction, not prevalent. 80 94 testRunner.setStatisticsShouldBlockThirdPartyCookies(true, function() { 95 testRunner.setStatisticsHasHadUserInteraction(firstPartyUrl, true, function() { 96 if (!testRunner.isStatisticsHasHadUserInteraction(firstPartyUrl)) 97 testFailed("First-party did not get logged for user interaction."); 81 98 let iframeElement = document.createElement("iframe"); 82 iframeElement.src = thirdPartyUrl + "/storageAccess/resources/has-storage-access-iframe.html #policyShouldNotGrantAccess";99 iframeElement.src = thirdPartyUrl + "/storageAccess/resources/has-storage-access-iframe.html?dummy=" + Math.random() + "#policyShouldNotGrantAccess"; 83 100 document.body.appendChild(iframeElement); 84 }); 101 }); 102 }, false); 85 103 break; 86 case "#step 5":104 case "#step6": 87 105 document.location.hash = "lastStep"; 88 106 // General third-party cookie blocking, first- and third-party user interaction, prevalent. … … 92 110 testRunner.statisticsUpdateCookieBlocking(function() { 93 111 let iframeElement = document.createElement("iframe"); 94 iframeElement.src = thirdPartyUrl + "/storageAccess/resources/has-storage-access-iframe.html #policyShouldNotGrantAccess";112 iframeElement.src = thirdPartyUrl + "/storageAccess/resources/has-storage-access-iframe.html?dummy=" + Math.random() + "#policyShouldNotGrantAccess"; 95 113 document.body.appendChild(iframeElement); 96 114 }); -
trunk/Source/WebCore/ChangeLog
r252839 r252840 1 2019-11-23 John Wilander <wilander@apple.com> 2 3 Resource Load Statistics: Allow multiple third-party cookie blocking settings 4 https://bugs.webkit.org/show_bug.cgi?id=204389 5 <rdar://problem/57344054> 6 7 Reviewed by Brent Fulgham. 8 9 This change introduces an enum ThirdPartyCookieBlockingMode for how third-party 10 cookie blocking should be carried out. It then uses the set mode in 11 NetworkStorageSession::shouldBlockCookies(). 12 13 The reason for supporting three different modes is that what is now named 14 OnlyAccordingToPerDomainPolicy is shipping, AllOnSitesWithoutUserInteraction is 15 in beta, and All is behind an experimental flag. 16 17 Tests: http/tests/resourceLoadStatistics/third-party-cookie-blocking-on-sites-without-user-interaction-database.html 18 http/tests/resourceLoadStatistics/third-party-cookie-blocking-on-sites-without-user-interaction.html 19 20 * page/Settings.yaml: 21 Flipped the isThirdPartyCookieBlockingEnabled flag to on by default. 22 * platform/network/NetworkStorageSession.cpp: 23 (WebCore::NetworkStorageSession::shouldBlockCookies const): 24 (WebCore::NetworkStorageSession::setThirdPartyCookieBlockingMode): 25 * platform/network/NetworkStorageSession.h: 26 (WebCore::NetworkStorageSession::setIsThirdPartyCookieBlockingEnabled): Deleted. 27 1 28 2019-11-23 Commit Queue <commit-queue@webkit.org> 2 29 -
trunk/Source/WebCore/page/Settings.yaml
r252762 r252840 882 882 883 883 isThirdPartyCookieBlockingEnabled: 884 initial: false884 initial: true 885 885 886 886 isLoggedInAPIEnabled: -
trunk/Source/WebCore/platform/network/NetworkStorageSession.cpp
r252623 r252840 114 114 return false; 115 115 116 if (m_isThirdPartyCookieBlockingEnabled) 116 switch (m_thirdPartyCookieBlockingMode) { 117 case ThirdPartyCookieBlockingMode::All: 117 118 return true; 118 119 return shouldBlockThirdPartyCookies(resourceDomain); 119 case ThirdPartyCookieBlockingMode::AllOnSitesWithoutUserInteraction: 120 if (!hasHadUserInteractionAsFirstParty(firstPartyDomain)) 121 return true; 122 FALLTHROUGH; 123 case ThirdPartyCookieBlockingMode::OnlyAccordingToPerDomainPolicy: 124 return shouldBlockThirdPartyCookies(resourceDomain); 125 } 120 126 } 121 127 … … 270 276 } 271 277 278 void NetworkStorageSession::setThirdPartyCookieBlockingMode(ThirdPartyCookieBlockingMode blockingMode) 279 { 280 m_thirdPartyCookieBlockingMode = blockingMode; 281 } 282 272 283 Optional<Seconds> NetworkStorageSession::clientSideCookieCap(const RegistrableDomain& firstParty, Optional<PageIdentifier> pageID) const 273 284 { -
trunk/Source/WebCore/platform/network/NetworkStorageSession.h
r252623 r252840 75 75 enum class IncludeSecureCookies : bool; 76 76 enum class IncludeHttpOnlyCookies : bool; 77 enum class ThirdPartyCookieBlockingMode : uint8_t { All, AllOnSitesWithoutUserInteraction, OnlyAccordingToPerDomainPolicy }; 77 78 78 79 class NetworkStorageSession { … … 166 167 WEBCORE_EXPORT void didCommitCrossSiteLoadWithDataTransferFromPrevalentResource(const RegistrableDomain& toDomain, PageIdentifier); 167 168 WEBCORE_EXPORT void resetCrossSiteLoadsWithLinkDecorationForTesting(); 168 void setIsThirdPartyCookieBlockingEnabled(bool enabled) { m_isThirdPartyCookieBlockingEnabled = enabled; }169 WEBCORE_EXPORT void setThirdPartyCookieBlockingMode(ThirdPartyCookieBlockingMode); 169 170 #endif 170 171 … … 202 203 HashMap<WebCore::PageIdentifier, RegistrableDomain> m_navigatedToWithLinkDecorationByPrevalentResource; 203 204 bool m_navigationWithLinkDecorationTestMode = false; 204 bool m_isThirdPartyCookieBlockingEnabled = false;205 ThirdPartyCookieBlockingMode m_thirdPartyCookieBlockingMode { ThirdPartyCookieBlockingMode::AllOnSitesWithoutUserInteraction }; 205 206 #endif 206 207 … … 220 221 221 222 } 223 224 namespace WTF { 225 226 template<> struct EnumTraits<WebCore::ThirdPartyCookieBlockingMode> { 227 using values = EnumValues< 228 WebCore::ThirdPartyCookieBlockingMode, 229 WebCore::ThirdPartyCookieBlockingMode::All, 230 WebCore::ThirdPartyCookieBlockingMode::AllOnSitesWithoutUserInteraction, 231 WebCore::ThirdPartyCookieBlockingMode::OnlyAccordingToPerDomainPolicy 232 >; 233 }; 234 235 } -
trunk/Source/WebKit/ChangeLog
r252839 r252840 1 2019-11-23 John Wilander <wilander@apple.com> 2 3 Resource Load Statistics: Allow multiple third-party cookie blocking settings 4 https://bugs.webkit.org/show_bug.cgi?id=204389 5 <rdar://problem/57344054> 6 7 Reviewed by Brent Fulgham. 8 9 This change make the third-party cookie blocking setting go from a boolean to 10 the new enum WebCore::ThirdPartyCookieBlockingMode with three different settings. 11 Functions and member variables are renamed accordingly. 12 13 The reason for supporting three different modes is that what is now named 14 OnlyAccordingToPerDomainPolicy is shipping, AllOnSitesWithoutUserInteraction is 15 in beta, and All is behind an experimental flag. 16 17 The change also updates the test API to map the TestRunner call to the enum. 18 19 * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp: 20 (WebKit::ResourceLoadStatisticsDatabaseStore::hasStorageAccess): 21 (WebKit::ResourceLoadStatisticsDatabaseStore::requestStorageAccess): 22 (WebKit::ResourceLoadStatisticsDatabaseStore::clearUserInteraction): 23 Now makes use of a completion handler and updates the cookie blocking state. 24 (WebKit::ResourceLoadStatisticsDatabaseStore::hasHadUserInteraction): 25 (WebKit::ResourceLoadStatisticsDatabaseStore::areAllThirdPartyCookiesBlockedUnder): 26 New convenience function to check the cookie blocking status per first-party domain. 27 (WebKit::ResourceLoadStatisticsDatabaseStore::cookieAccess): 28 Restructured the code to make it very clear that the logic is the same as the 29 corresponding function in ResourceLoadStatisticsMemoryStore. 30 Can no longer be const since it calls areAllThirdPartyCookiesBlockedUnder() which 31 in turn calls hasHadUserInteraction() and that function may clear user interaction data. 32 (WebKit::ResourceLoadStatisticsDatabaseStore::hasHadUnexpiredRecentUserInteraction): 33 (WebKit::ResourceLoadStatisticsDatabaseStore::cookieAccess const): Deleted. 34 See comment above on the non-const version of this function. 35 * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h: 36 * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: 37 (WebKit::ResourceLoadStatisticsMemoryStore::areAllThirdPartyCookiesBlockedUnder): 38 New convenience function to check the cookie blocking status per first-party domain. 39 (WebKit::ResourceLoadStatisticsMemoryStore::cookieAccess): 40 Restructured the code to make it very clear that the logic is the same as the 41 corresponding function in ResourceLoadStatisticsDatabaseStore. 42 Can no longer be const since it calls areAllThirdPartyCookiesBlockedUnder() which 43 in turn calls hasHadUserInteraction() and that function may clear user interaction data. 44 (WebKit::ResourceLoadStatisticsMemoryStore::hasStorageAccess): 45 (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess): 46 (WebKit::ResourceLoadStatisticsMemoryStore::clearUserInteraction): 47 Now makes use of a completion handler and updates the cookie blocking state. 48 (WebKit::ResourceLoadStatisticsMemoryStore::cookieAccess const): Deleted. 49 See comment above on the non-const version of this function. 50 * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h: 51 * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h: 52 (WebKit::ResourceLoadStatisticsStore::setThirdPartyCookieBlockingMode): 53 (WebKit::ResourceLoadStatisticsStore::thirdPartyCookieBlockingMode const): 54 (WebKit::ResourceLoadStatisticsStore::setIsThirdPartyCookieBlockingEnabled): Deleted. 55 (WebKit::ResourceLoadStatisticsStore::isThirdPartyCookieBlockingEnabled const): Deleted. 56 * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: 57 (WebKit::WebResourceLoadStatisticsStore::setThirdPartyCookieBlockingMode): 58 (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction): 59 Now forwards the completion handler. 60 (WebKit::WebResourceLoadStatisticsStore::setIsThirdPartyCookieBlockingEnabled): Deleted. 61 * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: 62 * NetworkProcess/NetworkProcess.cpp: 63 (WebKit::NetworkProcess::setShouldBlockThirdPartyCookiesForTesting): 64 * NetworkProcess/NetworkProcess.h: 65 * NetworkProcess/NetworkProcess.messages.in: 66 The SetShouldBlockThirdPartyCookiesForTesting message now uses an enum instead of a 67 boolean. 68 * NetworkProcess/NetworkSession.cpp: 69 (WebKit::NetworkSession::setResourceLoadStatisticsEnabled): 70 Now forwards the enum value instead of a boolean. 71 (WebKit::NetworkSession::recreateResourceLoadStatisticStore): 72 Now makes sure the cookie blocking setting is forwarded to the recreated store. 73 (WebKit::NetworkSession::setThirdPartyCookieBlockingMode): 74 (WebKit::NetworkSession::setIsThirdPartyCookieBlockingEnabled): Deleted. 75 * NetworkProcess/NetworkSession.h: 76 * NetworkProcess/NetworkSessionCreationParameters.cpp: 77 (WebKit::NetworkSessionCreationParameters::encode const): 78 (WebKit::NetworkSessionCreationParameters::decode): 79 Support for the new enum. 80 * NetworkProcess/NetworkSessionCreationParameters.h: 81 * NetworkProcess/cocoa/NetworkSessionCocoa.mm: 82 (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): 83 * Scripts/webkit/messages.py: 84 Tells the IPC code generator where to find WebCore::ThirdPartyCookieBlockingMode. 85 * Shared/WebPreferences.yaml: 86 Flipped the IsThirdPartyCookieBlockingEnabled flag to on by default. 87 * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: 88 (WKWebsiteDataStoreSetResourceLoadStatisticsShouldBlockThirdPartyCookiesForTesting): 89 (WKWebsiteDataStoreStatisticsResetToConsistentState): 90 * UIProcess/API/C/WKWebsiteDataStoreRef.h: 91 * UIProcess/Network/NetworkProcessProxy.cpp: 92 (WebKit::NetworkProcessProxy::setShouldBlockThirdPartyCookiesForTesting): 93 * UIProcess/Network/NetworkProcessProxy.h: 94 * UIProcess/WebProcessPool.cpp: 95 (WebKit::WebProcessPool::ensureNetworkProcess): 96 Makes use of the enum in the NetworkSessionCreationParameters. 97 * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: 98 (WebKit::WebsiteDataStore::parameters): 99 * UIProcess/WebsiteData/WebsiteDataStore.cpp: 100 (WebKit::WebsiteDataStore::setResourceLoadStatisticsShouldBlockThirdPartyCookiesForTesting): 101 * UIProcess/WebsiteData/WebsiteDataStore.h: 102 1 103 2019-11-23 Commit Queue <commit-queue@webkit.org> 2 104 -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp
r252817 r252840 1258 1258 ensureResourceStatisticsForRegistrableDomain(subFrameDomain); 1259 1259 1260 switch (cookieAccess(subFrameDomain )) {1260 switch (cookieAccess(subFrameDomain, topFrameDomain)) { 1261 1261 case CookieAccess::CannotRequest: 1262 1262 completionHandler(false); … … 1291 1291 auto subFrameStatus = ensureResourceStatisticsForRegistrableDomain(subFrameDomain); 1292 1292 1293 switch (cookieAccess(subFrameDomain )) {1293 switch (cookieAccess(subFrameDomain, topFrameDomain)) { 1294 1294 case CookieAccess::CannotRequest: 1295 1295 RELEASE_LOG_INFO_IF(debugLoggingEnabled(), ITPDebug, "Cannot grant storage access to %{private}s since its cookies are blocked in third-party contexts and it has not received user interaction as first-party.", subFrameDomain.string().utf8().data()); … … 1500 1500 } 1501 1501 1502 void ResourceLoadStatisticsDatabaseStore::clearUserInteraction(const RegistrableDomain& domain )1502 void ResourceLoadStatisticsDatabaseStore::clearUserInteraction(const RegistrableDomain& domain, CompletionHandler<void()>&& completionHandler) 1503 1503 { 1504 1504 ASSERT(!RunLoop::isMain()); … … 1514 1514 ASSERT_NOT_REACHED(); 1515 1515 } 1516 1517 // Update cookie blocking unconditionally since a call to hasHadUserInteraction() 1518 // to check the previous user interaction status could call clearUserInteraction(), 1519 // blowing the call stack. 1520 updateCookieBlocking(WTFMove(completionHandler)); 1516 1521 } 1517 1522 … … 1542 1547 // Set timestamp to 0 so that statistics merge will know 1543 1548 // it has been reset as opposed to its default -1. 1544 clearUserInteraction(domain );1549 clearUserInteraction(domain, [] { }); 1545 1550 hadUserInteraction = false; 1546 1551 } … … 1853 1858 } 1854 1859 1855 CookieAccess ResourceLoadStatisticsDatabaseStore::cookieAccess(const RegistrableDomain& domain) const 1860 bool ResourceLoadStatisticsDatabaseStore::areAllThirdPartyCookiesBlockedUnder(const TopFrameDomain& topFrameDomain) 1861 { 1862 if (thirdPartyCookieBlockingMode() == ThirdPartyCookieBlockingMode::All) 1863 return true; 1864 1865 if (thirdPartyCookieBlockingMode() == ThirdPartyCookieBlockingMode::AllOnSitesWithoutUserInteraction && !hasHadUserInteraction(topFrameDomain, OperatingDatesWindow::Long)) 1866 return true; 1867 1868 return false; 1869 } 1870 1871 CookieAccess ResourceLoadStatisticsDatabaseStore::cookieAccess(const SubResourceDomain& subresourceDomain, const TopFrameDomain& topFrameDomain) 1856 1872 { 1857 1873 ASSERT(!RunLoop::isMain()); … … 1859 1875 SQLiteStatement statement(m_database, "SELECT isPrevalent, hadUserInteraction FROM ObservedDomains WHERE registrableDomain = ?"); 1860 1876 if (statement.prepare() != SQLITE_OK 1861 || statement.bindText(1, domain.string()) != SQLITE_OK) {1877 || statement.bindText(1, subresourceDomain.string()) != SQLITE_OK) { 1862 1878 RELEASE_LOG_ERROR_IF_ALLOWED(m_sessionID, "%p - ResourceLoadStatisticsDatabaseStore::cookieAccess failed to bind, error message: %{private}s", this, m_database.lastErrorMsg()); 1863 1879 ASSERT_NOT_REACHED(); 1864 1880 } 1865 1881 1866 1882 bool hasNoEntry = statement.step() != SQLITE_ROW; 1867 if (hasNoEntry) { 1868 if (isThirdPartyCookieBlockingEnabled()) 1869 return CookieAccess::OnlyIfGranted; 1883 bool isPrevalent = !hasNoEntry && !!statement.getColumnInt(0); 1884 bool hadUserInteraction = !hasNoEntry && statement.getColumnInt(1) ? true : false; 1885 1886 if (!areAllThirdPartyCookiesBlockedUnder(topFrameDomain) && !isPrevalent) 1870 1887 return CookieAccess::BasedOnCookiePolicy; 1871 } 1872 1873 bool isPrevalent = !!statement.getColumnInt(0); 1874 if (!isPrevalent && !isThirdPartyCookieBlockingEnabled()) 1875 return CookieAccess::BasedOnCookiePolicy; 1876 1877 bool hadUserInteraction = statement.getColumnInt(1) ? true : false; 1888 1878 1889 if (!hadUserInteraction) 1879 1890 return CookieAccess::CannotRequest; … … 2063 2074 { 2064 2075 if (resourceStatistic.hadUserInteraction && hasStatisticsExpired(resourceStatistic.mostRecentUserInteractionTime, operatingDatesWindow)) { 2065 clearUserInteraction(resourceStatistic.registrableDomain );2076 clearUserInteraction(resourceStatistic.registrableDomain, [] { }); 2066 2077 return false; 2067 2078 } -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h
r252817 r252840 128 128 void logCrossSiteLoadWithLinkDecoration(const NavigatedFromDomain&, const NavigatedToDomain&) override; 129 129 130 void clearUserInteraction(const RegistrableDomain& ) override;130 void clearUserInteraction(const RegistrableDomain&, CompletionHandler<void()>&&) override; 131 131 bool hasHadUserInteraction(const RegistrableDomain&, OperatingDatesWindow) override; 132 132 … … 195 195 bool predicateValueForDomain(WebCore::SQLiteStatement&, const RegistrableDomain&) const; 196 196 197 CookieAccess cookieAccess(const RegistrableDomain&) const; 198 197 bool areAllThirdPartyCookiesBlockedUnder(const TopFrameDomain&) override; 198 CookieAccess cookieAccess(const SubResourceDomain&, const TopFrameDomain&); 199 199 200 void setPrevalentResource(const RegistrableDomain&, ResourceLoadPrevalence); 200 201 unsigned recursivelyFindNonPrevalentDomainsThatRedirectedToThisDomain(unsigned primaryDomainID, StdSet<unsigned>& nonPrevalentRedirectionSources, unsigned numberOfRecursiveCalls); -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp
r252641 r252840 213 213 } 214 214 215 CookieAccess ResourceLoadStatisticsMemoryStore::cookieAccess(const ResourceLoadStatistics& resourceStatistic) const 216 { 217 if (!isThirdPartyCookieBlockingEnabled() && !resourceStatistic.isPrevalentResource) 215 bool ResourceLoadStatisticsMemoryStore::areAllThirdPartyCookiesBlockedUnder(const TopFrameDomain& topFrameDomain) 216 { 217 if (thirdPartyCookieBlockingMode() == ThirdPartyCookieBlockingMode::All) 218 return true; 219 220 if (thirdPartyCookieBlockingMode() == ThirdPartyCookieBlockingMode::AllOnSitesWithoutUserInteraction && !hasHadUserInteraction(topFrameDomain, OperatingDatesWindow::Long)) 221 return true; 222 223 return false; 224 } 225 226 CookieAccess ResourceLoadStatisticsMemoryStore::cookieAccess(const ResourceLoadStatistics& resourceStatistic, const TopFrameDomain& topFrameDomain) 227 { 228 bool isPrevalent = resourceStatistic.isPrevalentResource; 229 bool hadUserInteraction = resourceStatistic.hadUserInteraction; 230 231 if (!areAllThirdPartyCookiesBlockedUnder(topFrameDomain) && !isPrevalent) 218 232 return CookieAccess::BasedOnCookiePolicy; 219 233 220 if (! resourceStatistic.hadUserInteraction)234 if (!hadUserInteraction) 221 235 return CookieAccess::CannotRequest; 222 236 … … 229 243 230 244 auto& subFrameStatistic = ensureResourceStatisticsForRegistrableDomain(subFrameDomain); 231 switch (cookieAccess(subFrameStatistic )) {245 switch (cookieAccess(subFrameStatistic, topFrameDomain)) { 232 246 case CookieAccess::CannotRequest: 233 247 completionHandler(false); … … 261 275 262 276 auto& subFrameStatistic = ensureResourceStatisticsForRegistrableDomain(subFrameDomain); 263 switch (cookieAccess(subFrameStatistic )) {277 switch (cookieAccess(subFrameStatistic, topFrameDomain)) { 264 278 case CookieAccess::CannotRequest: 265 279 RELEASE_LOG_INFO_IF(debugLoggingEnabled(), ITPDebug, "Cannot grant storage access to %{public}s since its cookies are blocked in third-party contexts and it has not received user interaction as first-party.", subFrameDomain.string().utf8().data()); … … 440 454 } 441 455 442 void ResourceLoadStatisticsMemoryStore::clearUserInteraction(const RegistrableDomain& domain )456 void ResourceLoadStatisticsMemoryStore::clearUserInteraction(const RegistrableDomain& domain, CompletionHandler<void()>&& completionHandler) 443 457 { 444 458 ASSERT(!RunLoop::isMain()); 445 459 446 460 auto& statistics = ensureResourceStatisticsForRegistrableDomain(domain); 461 bool didHavePreviousUserInteraction = statistics.hadUserInteraction; 447 462 statistics.hadUserInteraction = false; 448 463 statistics.mostRecentUserInteractionTime = { }; 464 if (!didHavePreviousUserInteraction) { 465 completionHandler(); 466 return; 467 } 468 updateCookieBlocking(WTFMove(completionHandler)); 449 469 } 450 470 -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h
r251663 r252840 98 98 void calculateAndSubmitTelemetry() const override; 99 99 100 CookieAccess cookieAccess(const ResourceLoadStatistics&) const; 100 bool areAllThirdPartyCookiesBlockedUnder(const TopFrameDomain&) override; 101 CookieAccess cookieAccess(const ResourceLoadStatistics&, const TopFrameDomain&); 101 102 void hasStorageAccess(const SubFrameDomain&, const TopFrameDomain&, Optional<WebCore::FrameIdentifier>, WebCore::PageIdentifier, CompletionHandler<void(bool)>&&) override; 102 103 void requestStorageAccess(SubFrameDomain&&, TopFrameDomain&&, WebCore::FrameIdentifier, WebCore::PageIdentifier, CompletionHandler<void(StorageAccessStatus)>&&) override; … … 107 108 void logCrossSiteLoadWithLinkDecoration(const NavigatedFromDomain&, const NavigatedToDomain&) override; 108 109 109 void clearUserInteraction(const RegistrableDomain& ) override;110 void clearUserInteraction(const RegistrableDomain&, CompletionHandler<void()>&&) override; 110 111 bool hasHadUserInteraction(const RegistrableDomain&, OperatingDatesWindow) override; 111 112 -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.h
r251663 r252840 31 31 #include "WebResourceLoadStatisticsStore.h" 32 32 #include <WebCore/FrameIdentifier.h> 33 #include <WebCore/NetworkStorageSession.h> 33 34 #include <wtf/CompletionHandler.h> 34 35 #include <wtf/Vector.h> … … 162 163 bool isDebugModeEnabled() const { return m_debugModeEnabled; }; 163 164 void setPrevalentResourceForDebugMode(const RegistrableDomain&); 164 void setIsThirdPartyCookieBlockingEnabled(bool enabled) { m_thirdPartyCookieBlockingEnabled = enabled; }; 165 bool isThirdPartyCookieBlockingEnabled() const { return m_thirdPartyCookieBlockingEnabled; }; 166 165 void setThirdPartyCookieBlockingMode(WebCore::ThirdPartyCookieBlockingMode mode) { m_thirdPartyCookieBlockingMode = mode; }; 166 WebCore::ThirdPartyCookieBlockingMode thirdPartyCookieBlockingMode() const { return m_thirdPartyCookieBlockingMode; }; 167 168 virtual bool areAllThirdPartyCookiesBlockedUnder(const TopFrameDomain&) = 0; 167 169 virtual void hasStorageAccess(const SubFrameDomain&, const TopFrameDomain&, Optional<WebCore::FrameIdentifier>, WebCore::PageIdentifier, CompletionHandler<void(bool)>&&) = 0; 168 170 virtual void requestStorageAccess(SubFrameDomain&&, TopFrameDomain&&, WebCore::FrameIdentifier, WebCore::PageIdentifier, CompletionHandler<void(StorageAccessStatus)>&&) = 0; … … 173 175 virtual void logCrossSiteLoadWithLinkDecoration(const NavigatedFromDomain&, const NavigatedToDomain&) = 0; 174 176 175 virtual void clearUserInteraction(const RegistrableDomain& ) = 0;177 virtual void clearUserInteraction(const RegistrableDomain&, CompletionHandler<void()>&&) = 0; 176 178 virtual bool hasHadUserInteraction(const RegistrableDomain&, OperatingDatesWindow) = 0; 177 179 … … 271 273 bool m_debugLoggingEnabled { false }; 272 274 bool m_debugModeEnabled { false }; 273 bool m_thirdPartyCookieBlockingEnabled { false};275 WebCore::ThirdPartyCookieBlockingMode m_thirdPartyCookieBlockingMode { WebCore::ThirdPartyCookieBlockingMode::AllOnSitesWithoutUserInteraction }; 274 276 bool m_dataRecordsBeingRemoved { false }; 275 277 ShouldIncludeLocalhost m_shouldIncludeLocalhost { ShouldIncludeLocalhost::Yes }; -
trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp
r252123 r252840 463 463 } 464 464 465 void WebResourceLoadStatisticsStore::set IsThirdPartyCookieBlockingEnabled(bool enabled)465 void WebResourceLoadStatisticsStore::setThirdPartyCookieBlockingMode(ThirdPartyCookieBlockingMode blockingMode) 466 466 { 467 467 ASSERT(RunLoop::isMain()); … … 469 469 if (m_networkSession) { 470 470 if (auto* storageSession = m_networkSession->networkStorageSession()) 471 storageSession->set IsThirdPartyCookieBlockingEnabled(enabled);471 storageSession->setThirdPartyCookieBlockingMode(blockingMode); 472 472 else 473 473 ASSERT_NOT_REACHED(); 474 474 } 475 475 476 postTask([this, enabled]() {476 postTask([this, blockingMode]() { 477 477 if (!m_statisticsStore) 478 478 return; 479 479 480 m_statisticsStore->set IsThirdPartyCookieBlockingEnabled(enabled);480 m_statisticsStore->setThirdPartyCookieBlockingMode(blockingMode); 481 481 }); 482 482 } … … 612 612 613 613 postTask([this, domain = domain.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable { 614 if (m_statisticsStore) 615 m_statisticsStore->clearUserInteraction(domain); 616 postTaskReply(WTFMove(completionHandler)); 614 auto innerCompletionHandler = [completionHandler = WTFMove(completionHandler)]() mutable { 615 postTaskReply(WTFMove(completionHandler)); 616 }; 617 if (m_statisticsStore) { 618 m_statisticsStore->clearUserInteraction(domain, WTFMove(innerCompletionHandler)); 619 return; 620 } 621 innerCompletionHandler(); 617 622 }); 618 623 } -
trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h
r251672 r252840 53 53 enum class StorageAccessPromptWasShown : bool; 54 54 enum class StorageAccessWasGranted : bool; 55 enum class ThirdPartyCookieBlockingMode : uint8_t; 55 56 } 56 57 … … 180 181 181 182 void hasCookies(const RegistrableDomain&, CompletionHandler<void(bool)>&&); 182 void set IsThirdPartyCookieBlockingEnabled(bool);183 void setThirdPartyCookieBlockingMode(WebCore::ThirdPartyCookieBlockingMode); 183 184 void didCreateNetworkProcess(); 184 185 -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp
r252839 r252840 1254 1254 } 1255 1255 1256 void NetworkProcess::setShouldBlockThirdPartyCookiesForTesting(PAL::SessionID sessionID, bool enabled, CompletionHandler<void()>&& completionHandler)1256 void NetworkProcess::setShouldBlockThirdPartyCookiesForTesting(PAL::SessionID sessionID, WebCore::ThirdPartyCookieBlockingMode blockingMode, CompletionHandler<void()>&& completionHandler) 1257 1257 { 1258 1258 if (auto* networkSession = this->networkSession(sessionID)) 1259 networkSession->set IsThirdPartyCookieBlockingEnabled(enabled);1259 networkSession->setThirdPartyCookieBlockingMode(blockingMode); 1260 1260 else 1261 1261 ASSERT_NOT_REACHED(); -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.h
r252839 r252840 261 261 bool isITPDatabaseEnabled() const { return m_isITPDatabaseEnabled; } 262 262 void setShouldDowngradeReferrerForTesting(bool, CompletionHandler<void()>&&); 263 void setShouldBlockThirdPartyCookiesForTesting(PAL::SessionID, bool, CompletionHandler<void()>&&);263 void setShouldBlockThirdPartyCookiesForTesting(PAL::SessionID, WebCore::ThirdPartyCookieBlockingMode, CompletionHandler<void()>&&); 264 264 #endif 265 265 -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in
r252839 r252840 137 137 HasIsolatedSession(PAL::SessionID sessionID, WebCore::RegistrableDomain domain) -> (bool hasIsolatedSession) Async 138 138 SetShouldDowngradeReferrerForTesting(bool enabled) -> () Async 139 SetShouldBlockThirdPartyCookiesForTesting(PAL::SessionID sessionID, bool enabled) -> () Async139 SetShouldBlockThirdPartyCookiesForTesting(PAL::SessionID sessionID, enum:uint8_t WebCore::ThirdPartyCookieBlockingMode blockingMode) -> () Async 140 140 #endif 141 141 -
trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp
r252623 r252840 40 40 #include <WebCore/AdClickAttribution.h> 41 41 #include <WebCore/CookieJar.h> 42 #include <WebCore/NetworkStorageSession.h>43 42 #include <WebCore/ResourceRequest.h> 44 43 … … 176 175 if (!m_resourceLoadStatisticsManualPrevalentResource.isEmpty()) 177 176 m_resourceLoadStatistics->setPrevalentResourceForDebugMode(m_resourceLoadStatisticsManualPrevalentResource, [] { }); 178 m_resourceLoadStatistics->set IsThirdPartyCookieBlockingEnabled(m_thirdPartyCookieBlockingEnabled);177 m_resourceLoadStatistics->setThirdPartyCookieBlockingMode(m_thirdPartyCookieBlockingMode); 179 178 } 180 179 … … 184 183 m_resourceLoadStatistics = WebResourceLoadStatisticsStore::create(*this, m_resourceLoadStatisticsDirectory, m_shouldIncludeLocalhostInResourceLoadStatistics); 185 184 m_resourceLoadStatistics->populateMemoryStoreFromDisk(WTFMove(completionHandler)); 185 m_resourceLoadStatistics->setThirdPartyCookieBlockingMode(m_thirdPartyCookieBlockingMode); 186 186 } 187 187 … … 226 226 } 227 227 228 void NetworkSession::set IsThirdPartyCookieBlockingEnabled(bool enabled)228 void NetworkSession::setThirdPartyCookieBlockingMode(ThirdPartyCookieBlockingMode blockingMode) 229 229 { 230 230 ASSERT(m_resourceLoadStatistics); 231 m_thirdPartyCookieBlocking Enabled = enabled;231 m_thirdPartyCookieBlockingMode = blockingMode; 232 232 if (m_resourceLoadStatistics) 233 m_resourceLoadStatistics->set IsThirdPartyCookieBlockingEnabled(m_thirdPartyCookieBlockingEnabled);233 m_resourceLoadStatistics->setThirdPartyCookieBlockingMode(blockingMode); 234 234 } 235 235 #endif // ENABLE(RESOURCE_LOAD_STATISTICS) -
trunk/Source/WebKit/NetworkProcess/NetworkSession.h
r252397 r252840 31 31 #include <WebCore/AdClickAttribution.h> 32 32 #include <WebCore/BlobRegistryImpl.h> 33 #include <WebCore/NetworkStorageSession.h> 33 34 #include <WebCore/RegistrableDomain.h> 34 35 #include <pal/SessionID.h> … … 98 99 void setShouldDowngradeReferrerForTesting(bool); 99 100 bool shouldDowngradeReferrer() const; 100 void set IsThirdPartyCookieBlockingEnabled(bool);101 void setThirdPartyCookieBlockingMode(WebCore::ThirdPartyCookieBlockingMode); 101 102 #endif 102 103 void storeAdClickAttribution(WebCore::AdClickAttribution&&); … … 145 146 bool m_enableResourceLoadStatisticsLogTestingEvent; 146 147 bool m_downgradeReferrer { true }; 147 bool m_thirdPartyCookieBlockingEnabled { false};148 WebCore::ThirdPartyCookieBlockingMode m_thirdPartyCookieBlockingMode { WebCore::ThirdPartyCookieBlockingMode::AllOnSitesWithoutUserInteraction }; 148 149 #endif 149 150 bool m_isStaleWhileRevalidateEnabled { false }; -
trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp
r252397 r252840 69 69 encoder << enableResourceLoadStatisticsDebugMode; 70 70 encoder << resourceLoadStatisticsManualPrevalentResource; 71 encoder << enableThirdPartyCookieBlocking;71 encoder << thirdPartyCookieBlockingMode; 72 72 73 73 encoder << networkCacheDirectory << networkCacheDirectoryExtensionHandle; … … 201 201 return WTF::nullopt; 202 202 203 Optional< bool> enableThirdPartyCookieBlocking;204 decoder >> enableThirdPartyCookieBlocking;205 if (! enableThirdPartyCookieBlocking)203 Optional<WebCore::ThirdPartyCookieBlockingMode> thirdPartyCookieBlockingMode; 204 decoder >> thirdPartyCookieBlockingMode; 205 if (!thirdPartyCookieBlockingMode) 206 206 return WTF::nullopt; 207 207 … … 289 289 , WTFMove(*shouldIncludeLocalhostInResourceLoadStatistics) 290 290 , WTFMove(*enableResourceLoadStatisticsDebugMode) 291 , WTFMove(* enableThirdPartyCookieBlocking)291 , WTFMove(*thirdPartyCookieBlockingMode) 292 292 , WTFMove(*deviceManagementRestrictionsEnabled) 293 293 , WTFMove(*allLoadsBlockedByDeviceManagementRestrictionsForTesting) -
trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h
r252397 r252840 27 27 28 28 #include "SandboxExtension.h" 29 #include <WebCore/NetworkStorageSession.h> 29 30 #include <WebCore/RegistrableDomain.h> 30 31 #include <pal/SessionID.h> … … 86 87 bool shouldIncludeLocalhostInResourceLoadStatistics { true }; 87 88 bool enableResourceLoadStatisticsDebugMode { false }; 88 bool enableThirdPartyCookieBlocking { false};89 WebCore::ThirdPartyCookieBlockingMode thirdPartyCookieBlockingMode { WebCore::ThirdPartyCookieBlockingMode::AllOnSitesWithoutUserInteraction }; 89 90 bool deviceManagementRestrictionsEnabled { false }; 90 91 bool allLoadsBlockedByDeviceManagementRestrictionsForTesting { false }; -
trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm
r252819 r252840 1136 1136 m_enableResourceLoadStatisticsDebugMode = parameters.enableResourceLoadStatisticsDebugMode ? EnableResourceLoadStatisticsDebugMode::Yes : EnableResourceLoadStatisticsDebugMode::No; 1137 1137 m_resourceLoadStatisticsManualPrevalentResource = parameters.resourceLoadStatisticsManualPrevalentResource; 1138 m_thirdPartyCookieBlocking Enabled = parameters.enableThirdPartyCookieBlocking;1138 m_thirdPartyCookieBlockingMode = parameters.thirdPartyCookieBlockingMode; 1139 1139 setResourceLoadStatisticsEnabled(parameters.enableResourceLoadStatistics); 1140 1140 #endif -
trunk/Source/WebKit/Scripts/webkit/messages.py
r252655 r252840 589 589 'WebCore::TextCheckingType': ['<WebCore/TextChecking.h>'], 590 590 'WebCore::TextIndicatorData': ['<WebCore/TextIndicator.h>'], 591 'WebCore::ThirdPartyCookieBlockingMode': ['<WebCore/NetworkStorageSession.h>'], 591 592 'WebCore::ViewportAttributes': ['<WebCore/ViewportArguments.h>'], 592 593 'WebCore::WillContinueLoading': ['<WebCore/FrameLoaderTypes.h>'], -
trunk/Source/WebKit/Shared/WebPreferences.yaml
r252361 r252840 1796 1796 IsThirdPartyCookieBlockingEnabled: 1797 1797 type: bool 1798 defaultValue: false1798 defaultValue: true 1799 1799 humanReadableName: "Block All 3rd-Party Cookies (ITP)" 1800 1800 humanReadableDescription: "Block all third-party cookies when Intelligent Tracking Prevention is enabled" -
trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp
r252839 r252840 539 539 } 540 540 541 void WKWebsiteDataStoreSetResourceLoadStatisticsShouldBlockThirdPartyCookiesForTesting(WKWebsiteDataStoreRef dataStoreRef, bool enabled, void* context, WKWebsiteDataStoreSetResourceLoadStatisticsShouldBlockThirdPartyCookiesForTestingFunction completionHandler)542 { 543 #if ENABLE(RESOURCE_LOAD_STATISTICS) 544 WebKit::toImpl(dataStoreRef)->setResourceLoadStatisticsShouldBlockThirdPartyCookiesForTesting(enabled, [context, completionHandler] {541 void WKWebsiteDataStoreSetResourceLoadStatisticsShouldBlockThirdPartyCookiesForTesting(WKWebsiteDataStoreRef dataStoreRef, bool enabled, bool onlyOnSitesWithoutUserInteraction, void* context, WKWebsiteDataStoreSetResourceLoadStatisticsShouldBlockThirdPartyCookiesForTestingFunction completionHandler) 542 { 543 #if ENABLE(RESOURCE_LOAD_STATISTICS) 544 WebKit::toImpl(dataStoreRef)->setResourceLoadStatisticsShouldBlockThirdPartyCookiesForTesting(enabled, onlyOnSitesWithoutUserInteraction, [context, completionHandler] { 545 545 completionHandler(context); 546 546 }); … … 562 562 store.resetCrossSiteLoadsWithLinkDecorationForTesting([callbackAggregator = callbackAggregator.copyRef()] { }); 563 563 store.setResourceLoadStatisticsShouldDowngradeReferrerForTesting(true, [callbackAggregator = callbackAggregator.copyRef()] { }); 564 store.setResourceLoadStatisticsShouldBlockThirdPartyCookiesForTesting(false, [callbackAggregator = callbackAggregator.copyRef()] { });564 store.setResourceLoadStatisticsShouldBlockThirdPartyCookiesForTesting(false, false, [callbackAggregator = callbackAggregator.copyRef()] { }); 565 565 store.resetParametersToDefaultValues([callbackAggregator = callbackAggregator.copyRef()] { }); 566 566 store.scheduleClearInMemoryAndPersistent(WebKit::ShouldGrandfatherStatistics::No, [callbackAggregator = callbackAggregator.copyRef()] { }); -
trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h
r252839 r252840 121 121 WK_EXPORT void WKWebsiteDataStoreSetResourceLoadStatisticsShouldDowngradeReferrerForTesting(WKWebsiteDataStoreRef dataStoreRef, bool enabled, void* context, WKWebsiteDataStoreSetResourceLoadStatisticsShouldDowngradeReferrerForTestingFunction completionHandler); 122 122 typedef void (*WKWebsiteDataStoreSetResourceLoadStatisticsShouldBlockThirdPartyCookiesForTestingFunction)(void* functionContext); 123 WK_EXPORT void WKWebsiteDataStoreSetResourceLoadStatisticsShouldBlockThirdPartyCookiesForTesting(WKWebsiteDataStoreRef dataStoreRef, bool enabled, void* context, WKWebsiteDataStoreSetResourceLoadStatisticsShouldBlockThirdPartyCookiesForTestingFunction completionHandler);123 WK_EXPORT void WKWebsiteDataStoreSetResourceLoadStatisticsShouldBlockThirdPartyCookiesForTesting(WKWebsiteDataStoreRef dataStoreRef, bool enabled, bool onlyOnSitesWithoutUserInteraction, void* context, WKWebsiteDataStoreSetResourceLoadStatisticsShouldBlockThirdPartyCookiesForTestingFunction completionHandler); 124 124 typedef void (*WKWebsiteDataStoreStatisticsResetToConsistentStateFunction)(void* functionContext); 125 125 WK_EXPORT void WKWebsiteDataStoreStatisticsResetToConsistentState(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreStatisticsResetToConsistentStateFunction completionHandler); -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
r252839 r252840 1058 1058 } 1059 1059 1060 void NetworkProcessProxy::setShouldBlockThirdPartyCookiesForTesting(PAL::SessionID sessionID, bool enabled, CompletionHandler<void()>&& completionHandler)1061 { 1062 if (!canSendMessage()) { 1063 completionHandler(); 1064 return; 1065 } 1066 1067 sendWithAsyncReply(Messages::NetworkProcess::SetShouldBlockThirdPartyCookiesForTesting(sessionID, enabled), WTFMove(completionHandler));1060 void NetworkProcessProxy::setShouldBlockThirdPartyCookiesForTesting(PAL::SessionID sessionID, ThirdPartyCookieBlockingMode blockingMode, CompletionHandler<void()>&& completionHandler) 1061 { 1062 if (!canSendMessage()) { 1063 completionHandler(); 1064 return; 1065 } 1066 1067 sendWithAsyncReply(Messages::NetworkProcess::SetShouldBlockThirdPartyCookiesForTesting(sessionID, blockingMode), WTFMove(completionHandler)); 1068 1068 } 1069 1069 #endif // ENABLE(RESOURCE_LOAD_STATISTICS) -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
r252839 r252840 158 158 void hasIsolatedSession(PAL::SessionID, const RegistrableDomain&, CompletionHandler<void(bool)>&&); 159 159 void setShouldDowngradeReferrerForTesting(bool, CompletionHandler<void()>&&); 160 void setShouldBlockThirdPartyCookiesForTesting(PAL::SessionID, bool, CompletionHandler<void()>&&);160 void setShouldBlockThirdPartyCookiesForTesting(PAL::SessionID, WebCore::ThirdPartyCookieBlockingMode, CompletionHandler<void()>&&); 161 161 #endif 162 162 -
trunk/Source/WebKit/UIProcess/WebProcessPool.cpp
r252839 r252840 563 563 bool shouldIncludeLocalhost = true; 564 564 bool enableResourceLoadStatisticsDebugMode = false; 565 bool enableThirdPartyCookieBlocking = false;565 WebCore::ThirdPartyCookieBlockingMode thirdPartyCookieBlockingMode = WebCore::ThirdPartyCookieBlockingMode::AllOnSitesWithoutUserInteraction; 566 566 WebCore::RegistrableDomain manualPrevalentResource { }; 567 567 if (withWebsiteDataStore) { … … 574 574 shouldIncludeLocalhost = networkSessionParameters.shouldIncludeLocalhostInResourceLoadStatistics; 575 575 enableResourceLoadStatisticsDebugMode = networkSessionParameters.enableResourceLoadStatisticsDebugMode; 576 enableThirdPartyCookieBlocking = networkSessionParameters.enableThirdPartyCookieBlocking;576 thirdPartyCookieBlockingMode = networkSessionParameters.thirdPartyCookieBlockingMode; 577 577 manualPrevalentResource = networkSessionParameters.resourceLoadStatisticsManualPrevalentResource; 578 578 } … … 595 595 shouldIncludeLocalhost = networkSessionParameters.shouldIncludeLocalhostInResourceLoadStatistics; 596 596 enableResourceLoadStatisticsDebugMode = networkSessionParameters.enableResourceLoadStatisticsDebugMode; 597 enableThirdPartyCookieBlocking = networkSessionParameters.enableThirdPartyCookieBlocking;597 thirdPartyCookieBlockingMode = networkSessionParameters.thirdPartyCookieBlockingMode; 598 598 manualPrevalentResource = networkSessionParameters.resourceLoadStatisticsManualPrevalentResource; 599 599 } … … 619 619 parameters.defaultDataStoreParameters.networkSessionParameters.shouldIncludeLocalhostInResourceLoadStatistics = shouldIncludeLocalhost; 620 620 parameters.defaultDataStoreParameters.networkSessionParameters.enableResourceLoadStatisticsDebugMode = enableResourceLoadStatisticsDebugMode; 621 parameters.defaultDataStoreParameters.networkSessionParameters. enableThirdPartyCookieBlocking = enableThirdPartyCookieBlocking;621 parameters.defaultDataStoreParameters.networkSessionParameters.thirdPartyCookieBlockingMode = thirdPartyCookieBlockingMode; 622 622 parameters.defaultDataStoreParameters.networkSessionParameters.resourceLoadStatisticsManualPrevalentResource = manualPrevalentResource; 623 623 -
trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm
r252839 r252840 33 33 #import "WebResourceLoadStatisticsStore.h" 34 34 #import "WebsiteDataStoreParameters.h" 35 #import <WebCore/NetworkStorageSession.h> 35 36 #import <WebCore/RegistrableDomain.h> 36 37 #import <WebCore/RuntimeApplicationChecks.h> … … 70 71 bool shouldLogCookieInformation = false; 71 72 bool enableResourceLoadStatisticsDebugMode = false; 72 bool enableThirdPartyCookieBlocking = false;73 auto thirdPartyCookieBlockingMode = WebCore::ThirdPartyCookieBlockingMode::OnlyAccordingToPerDomainPolicy; 73 74 bool enableLegacyTLS = true; 74 75 if (id value = [defaults objectForKey:@"WebKitEnableLegacyTLS"]) … … 77 78 #if ENABLE(RESOURCE_LOAD_STATISTICS) 78 79 enableResourceLoadStatisticsDebugMode = [defaults boolForKey:@"ITPDebugMode"]; 79 enableThirdPartyCookieBlocking = [defaults boolForKey:[NSString stringWithFormat:@"Experimental%@", WebPreferencesKey::isThirdPartyCookieBlockingEnabledKey().createCFString().get()]]; 80 if ([defaults boolForKey:[NSString stringWithFormat:@"Experimental%@", WebPreferencesKey::isThirdPartyCookieBlockingEnabledKey().createCFString().get()]]) 81 thirdPartyCookieBlockingMode = WebCore::ThirdPartyCookieBlockingMode::All; 82 else 83 thirdPartyCookieBlockingMode = WebCore::ThirdPartyCookieBlockingMode::AllOnSitesWithoutUserInteraction; 80 84 auto* manualPrevalentResource = [defaults stringForKey:@"ITPManualPrevalentResource"]; 81 85 if (manualPrevalentResource) { … … 141 145 shouldIncludeLocalhostInResourceLoadStatistics, 142 146 enableResourceLoadStatisticsDebugMode, 143 enableThirdPartyCookieBlocking,147 thirdPartyCookieBlockingMode, 144 148 m_configuration->deviceManagementRestrictionsEnabled(), 145 149 m_configuration->allLoadsBlockedByDeviceManagementRestrictionsForTesting(), -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
r252839 r252840 50 50 #include <WebCore/DatabaseTracker.h> 51 51 #include <WebCore/HTMLMediaElement.h> 52 #include <WebCore/NetworkStorageSession.h> 52 53 #include <WebCore/OriginLock.h> 53 54 #include <WebCore/RegistrableDomain.h> … … 1788 1789 } 1789 1790 1790 void WebsiteDataStore::setResourceLoadStatisticsShouldBlockThirdPartyCookiesForTesting(bool enabled, CompletionHandler<void()>&& completionHandler) 1791 { 1792 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 1793 1791 void WebsiteDataStore::setResourceLoadStatisticsShouldBlockThirdPartyCookiesForTesting(bool enabled, bool onlyOnSitesWithoutUserInteraction, CompletionHandler<void()>&& completionHandler) 1792 { 1793 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 1794 WebCore::ThirdPartyCookieBlockingMode blockingMode = WebCore::ThirdPartyCookieBlockingMode::OnlyAccordingToPerDomainPolicy; 1795 if (enabled) 1796 blockingMode = onlyOnSitesWithoutUserInteraction ? WebCore::ThirdPartyCookieBlockingMode::AllOnSitesWithoutUserInteraction : WebCore::ThirdPartyCookieBlockingMode::All; 1797 1794 1798 for (auto& processPool : processPools()) { 1795 1799 if (auto* networkProcess = processPool->networkProcess()) { 1796 networkProcess->setShouldBlockThirdPartyCookiesForTesting(m_sessionID, enabled, [callbackAggregator = callbackAggregator.copyRef()] { });1800 networkProcess->setShouldBlockThirdPartyCookiesForTesting(m_sessionID, blockingMode, [callbackAggregator = callbackAggregator.copyRef()] { }); 1797 1801 ASSERT(processPools().size() == 1); 1798 1802 break; -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
r252839 r252840 195 195 void hasIsolatedSessionForTesting(const URL&, CompletionHandler<void(bool)>&&) const; 196 196 void setResourceLoadStatisticsShouldDowngradeReferrerForTesting(bool, CompletionHandler<void()>&&); 197 void setResourceLoadStatisticsShouldBlockThirdPartyCookiesForTesting(bool , CompletionHandler<void()>&&);197 void setResourceLoadStatisticsShouldBlockThirdPartyCookiesForTesting(bool enabled, bool onlyOnSitesWithoutUserInteraction, CompletionHandler<void()>&&); 198 198 #endif 199 199 void setCacheMaxAgeCapForPrevalentResources(Seconds, CompletionHandler<void()>&&); -
trunk/Tools/ChangeLog
r252839 r252840 1 2019-11-23 John Wilander <wilander@apple.com> 2 3 Resource Load Statistics: Allow multiple third-party cookie blocking settings 4 https://bugs.webkit.org/show_bug.cgi?id=204389 5 <rdar://problem/57344054> 6 7 Reviewed by Brent Fulgham. 8 9 This change allows the existing TestRunner function 10 setStatisticsShouldBlockThirdPartyCookies() to set an optional boolean 11 parameter onlyOnSitesWithoutUserInteraction to opt in to that behavior. 12 13 * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: 14 * WebKitTestRunner/InjectedBundle/TestRunner.cpp: 15 (WTR::TestRunner::setStatisticsShouldBlockThirdPartyCookies): 16 * WebKitTestRunner/InjectedBundle/TestRunner.h: 17 * WebKitTestRunner/TestController.cpp: 18 (WTR::TestController::setStatisticsShouldBlockThirdPartyCookies): 19 * WebKitTestRunner/TestController.h: 20 * WebKitTestRunner/TestInvocation.cpp: 21 (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): 22 1 23 2019-11-23 Commit Queue <commit-queue@webkit.org> 2 24 -
trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
r252623 r252840 343 343 boolean hasStatisticsIsolatedSession(DOMString hostName); 344 344 void setStatisticsShouldDowngradeReferrer(boolean value, object callback); 345 void setStatisticsShouldBlockThirdPartyCookies(boolean value, object callback );345 void setStatisticsShouldBlockThirdPartyCookies(boolean value, object callback, optional boolean onlyOnSitesWithoutUserInteraction); 346 346 347 347 // Injected bundle form client. -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
r252623 r252840 34 34 #include "TestController.h" 35 35 #include <JavaScriptCore/JSCTestRunnerUtils.h> 36 #include <WebCore/NetworkStorageSession.h> 36 37 #include <WebCore/ResourceLoadObserver.h> 37 38 #include <WebKit/WKBundle.h> … … 2224 2225 } 2225 2226 2226 void TestRunner::setStatisticsShouldBlockThirdPartyCookies(bool value, JSValueRef completionHandler )2227 void TestRunner::setStatisticsShouldBlockThirdPartyCookies(bool value, JSValueRef completionHandler, bool onlyOnSitesWithoutUserInteraction) 2227 2228 { 2228 2229 if (m_hasSetBlockThirdPartyCookiesCallback) 2229 2230 return; 2230 2231 2231 2232 cacheTestRunnerCallback(StatisticsDidSetShouldBlockThirdPartyCookiesCallbackID, completionHandler); 2232 2233 WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("SetStatisticsShouldBlockThirdPartyCookies")); 2234 if (onlyOnSitesWithoutUserInteraction) 2235 messageName = adoptWK(WKStringCreateWithUTF8CString("SetStatisticsShouldBlockThirdPartyCookiesOnSitesWithoutUserInteraction")); 2233 2236 WKRetainPtr<WKBooleanRef> messageBody = adoptWK(WKBooleanCreate(value)); 2234 2237 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr); -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
r252623 r252840 443 443 void setStatisticsShouldDowngradeReferrer(bool, JSValueRef callback); 444 444 void statisticsCallDidSetShouldDowngradeReferrerCallback(); 445 void setStatisticsShouldBlockThirdPartyCookies(bool , JSValueRef callback);445 void setStatisticsShouldBlockThirdPartyCookies(bool value, JSValueRef callback, bool onlyOnSitesWithoutUserInteraction); 446 446 void statisticsCallDidSetShouldBlockThirdPartyCookiesCallback(); 447 447 void statisticsResetToConsistentState(JSValueRef completionHandler); -
trunk/Tools/WebKitTestRunner/TestController.cpp
r252839 r252840 3568 3568 } 3569 3569 3570 void TestController::setStatisticsShouldBlockThirdPartyCookies(bool value )3570 void TestController::setStatisticsShouldBlockThirdPartyCookies(bool value, bool onlyOnSitesWithoutUserInteraction) 3571 3571 { 3572 3572 ResourceStatisticsCallbackContext context(*this); 3573 WKWebsiteDataStoreSetResourceLoadStatisticsShouldBlockThirdPartyCookiesForTesting(TestController::websiteDataStore(), value, &context, resourceStatisticsVoidResultCallback);3573 WKWebsiteDataStoreSetResourceLoadStatisticsShouldBlockThirdPartyCookiesForTesting(TestController::websiteDataStore(), value, onlyOnSitesWithoutUserInteraction, &context, resourceStatisticsVoidResultCallback); 3574 3574 runUntil(context.done, noTimeout); 3575 3575 m_currentInvocation->didSetShouldBlockThirdPartyCookies(); -
trunk/Tools/WebKitTestRunner/TestController.h
r252839 r252840 254 254 bool hasStatisticsIsolatedSession(WKStringRef hostName); 255 255 void setStatisticsShouldDowngradeReferrer(bool value); 256 void setStatisticsShouldBlockThirdPartyCookies(bool value );256 void setStatisticsShouldBlockThirdPartyCookies(bool value, bool onlyOnSitesWithoutUserInteraction); 257 257 void statisticsResetToConsistentState(); 258 258 -
trunk/Tools/WebKitTestRunner/TestInvocation.cpp
r252623 r252840 1550 1550 } 1551 1551 1552 if (WKStringIsEqualToUTF8CString(messageName, "SetStatisticsShouldBlockThirdPartyCookiesOnSitesWithoutUserInteraction")) { 1553 ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID()); 1554 WKBooleanRef value = static_cast<WKBooleanRef>(messageBody); 1555 TestController::singleton().setStatisticsShouldBlockThirdPartyCookies(WKBooleanGetValue(value), true); 1556 return nullptr; 1557 } 1558 1552 1559 if (WKStringIsEqualToUTF8CString(messageName, "SetStatisticsShouldBlockThirdPartyCookies")) { 1553 1560 ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID()); 1554 1561 WKBooleanRef value = static_cast<WKBooleanRef>(messageBody); 1555 TestController::singleton().setStatisticsShouldBlockThirdPartyCookies(WKBooleanGetValue(value) );1562 TestController::singleton().setStatisticsShouldBlockThirdPartyCookies(WKBooleanGetValue(value), false); 1556 1563 return nullptr; 1557 1564 }
Note: See TracChangeset
for help on using the changeset viewer.