Title: [227123] branches/safari-605-branch
Revision
227123
Author
[email protected]
Date
2018-01-17 22:17:39 -0800 (Wed, 17 Jan 2018)

Log Message

Cherry-pick r227093. rdar://problem/36598105

Modified Paths

Added Paths

Removed Paths

Diff

Modified: branches/safari-605-branch/LayoutTests/ChangeLog (227122 => 227123)


--- branches/safari-605-branch/LayoutTests/ChangeLog	2018-01-18 06:06:50 UTC (rev 227122)
+++ branches/safari-605-branch/LayoutTests/ChangeLog	2018-01-18 06:17:39 UTC (rev 227123)
@@ -1,5 +1,22 @@
 2018-01-17  Jason Marcell  <[email protected]>
 
+        Cherry-pick r227093. rdar://problem/36598105
+
+    2018-01-17  Matt Lewis  <[email protected]>
+
+            Unreviewed, rolling out r227076.
+
+            This breaks internal builds
+
+            Reverted changeset:
+
+            "Resource Load Statistics: Block cookies for prevalent
+            resources without user interaction"
+            https://bugs.webkit.org/show_bug.cgi?id=177394
+            https://trac.webkit.org/changeset/227076
+
+2018-01-17  Jason Marcell  <[email protected]>
+
         Cherry-pick r227087. rdar://problem/36597993
 
     2018-01-17  Zalan Bujtas  <[email protected]>

Deleted: branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/add-blocking-to-redirect-expected.txt (227122 => 227123)


--- branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/add-blocking-to-redirect-expected.txt	2018-01-18 06:06:50 UTC (rev 227122)
+++ branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/add-blocking-to-redirect-expected.txt	2018-01-18 06:17:39 UTC (rev 227123)
@@ -1,63 +0,0 @@
-Tests that blocking is added mid-flight in redirects.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
-
---------
-Frame: '<!--framePath //<!--frame0-->-->'
---------
-Should receive first-party cookie.
-Received cookie named 'firstPartyCookie'.
-Did not receive cookie named 'partitionedCookie'.
-Client-side document.cookie: firstPartyCookie=value
-
---------
-Frame: '<!--framePath //<!--frame1-->-->'
---------
-Redirect case 1, should receive first-party cookie.
-Received cookie named 'firstPartyCookie'.
-Did not receive cookie named 'partitionedCookie'.
-Client-side document.cookie: firstPartyCookie=value
-
---------
-Frame: '<!--framePath //<!--frame2-->-->'
---------
-Should receive no cookies.
-Did not receive cookie named 'firstPartyCookie'.
-Did not receive cookie named 'partitionedCookie'.
-Client-side document.cookie:
-
---------
-Frame: '<!--framePath //<!--frame3-->-->'
---------
-Redirect case 2, should receive no cookie.
-Did not receive cookie named 'firstPartyCookie'.
-Did not receive cookie named 'partitionedCookie'.
-Client-side document.cookie:
-
---------
-Frame: '<!--framePath //<!--frame4-->-->'
---------
-Try to set third-party cookie in blocked mode.
-
-
---------
-Frame: '<!--framePath //<!--frame5-->-->'
---------
-After attempted cookie creation, should receive no cookie.
-Did not receive cookie named 'firstPartyCookie'.
-Did not receive cookie named 'partitionedCookie'.
-Client-side document.cookie:
-
---------
-Frame: '<!--framePath //<!--frame6-->-->'
---------
-Redirect case 3, after attempted cookie creation, should receive no cookie.
-Did not receive cookie named 'firstPartyCookie'.
-Did not receive cookie named 'partitionedCookie'.
-Client-side document.cookie:

Deleted: branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/add-blocking-to-redirect.html (227122 => 227123)


--- branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/add-blocking-to-redirect.html	2018-01-18 06:06:50 UTC (rev 227122)
+++ branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/add-blocking-to-redirect.html	2018-01-18 06:17:39 UTC (rev 227123)
@@ -1,108 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-    <meta charset="UTF-8">
-    <script src=""
-</head>
-<body _onload_="runTest()">
-<script>
-    description("Tests that blocking is added mid-flight in redirects.");
-    jsTestIsAsync = true;
-
-    function setEnableFeature(enable) {
-        if (!enable)
-            testRunner.statisticsResetToConsistentState();
-        internals.setResourceLoadStatisticsEnabled(enable);
-        testRunner.setCookieStoragePartitioningEnabled(enable);
-    }
-
-    if (document.location.hash === "") {
-        setEnableFeature(true);
-        if (testRunner.isStatisticsPrevalentResource("http://localhost"))
-            testFailed("Localhost was classified as prevalent resource before the test starts.");
-        // Make sure the network process is up-to-date.
-        testRunner.statisticsSetShouldPartitionCookiesForHost("localhost", false);
-        testRunner.dumpChildFramesAsText();
-        document.location.hash = "step1";
-    }
-
-    const partitionHost = "127.0.0.1:8000";
-    const thirdPartyOrigin = "http://localhost:8000";
-    const resourcePath = "/resourceLoadStatistics/resources";
-    const thirdPartyBaseUrl = thirdPartyOrigin + resourcePath;
-    const firstPartyCookieName = "firstPartyCookie";
-    const subPathToSetFirstPartyCookie = "/set-cookie.php?name=" + firstPartyCookieName + "&value=value";
-    const partitionedCookieName = "partitionedCookie";
-    const subPathToSetPartitionedCookie = "/set-cookie.php?name=" + partitionedCookieName + "&value=value";
-    const returnUrl = "http://" + partitionHost + "/resourceLoadStatistics/add-blocking-to-redirect.html";
-    const subPathToGetCookies = "/get-cookies.php?name1=" + firstPartyCookieName + "&name2=" + partitionedCookieName;
-    const redirectChainUrl = "http://" + partitionHost + resourcePath + "/redirect.php?redirectTo=" + thirdPartyBaseUrl + subPathToGetCookies;
-
-    function openIframe(url, onLoadHandler) {
-        const element = document.createElement("iframe");
-        element.src = ""
-        if (onLoadHandler) {
-            element._onload_ = onLoadHandler;
-        }
-        document.body.appendChild(element);
-    }
-
-    function runTest() {
-        switch (document.location.hash) {
-            case "#step1":
-                // Set first-party cookie for localhost.
-                document.location.href = "" + subPathToSetFirstPartyCookie + "#" + returnUrl + "#step2";
-                break;
-            case "#step2":
-                // Check that the cookie gets sent for localhost under 127.0.0.1 since localhost is not prevalent.
-                document.location.hash = "step3";
-                openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive first-party cookie.", runTest);
-                break;
-            case "#step3":
-                document.location.hash = "step4";
-                // Load an iframe in a redirect chain that starts with 127.0.0.1 and ends with localhost. Expect a cookie for localhost.
-                openIframe(redirectChainUrl + "&message=Redirect case 1, should receive first-party cookie.", runTest);
-                break;
-            case "#step4":
-                // Set localhost as prevalent and with no user interaction to put it in the blocking category.
-                document.location.hash = "step5";
-                testRunner.setStatisticsPrevalentResource("http://localhost", true);
-                testRunner.statisticsUpdateCookiePartitioning();
-                if (!testRunner.isStatisticsPrevalentResource("http://localhost"))
-                    testFailed("Host did not get set as prevalent resource.");
-                runTest();
-                break;
-            case "#step5":
-                // Check that no cookie gets sent for localhost under 127.0.0.1 since localhost's cookies are blocked.
-                document.location.hash = "step6";
-                openIframe(thirdPartyBaseUrl + subPathToGetCookies +  "&message=Should receive no cookies.", runTest);
-                break;
-            case "#step6":
-                // Load an iframe in a redirect chain that starts with 127.0.0.1 and ends with localhost. Expect no cookie for localhost.
-                document.location.hash = "step7";
-                openIframe(redirectChainUrl + "&message=Redirect case 2, should receive no cookie.", runTest);
-                break;
-            case "#step7":
-                // Try to set cookie for localhost under 127.0.0.1.
-                document.location.hash = "step8";
-                openIframe(thirdPartyBaseUrl + subPathToSetPartitionedCookie + "&message=Try to set third-party cookie in blocked mode.", runTest);
-                break;
-            case "#step8":
-                // Check that no cookie gets sent for localhost under 127.0.0.1 since localhost's cookies are blocked.
-                document.location.hash = "step9";
-                openIframe(thirdPartyBaseUrl + subPathToGetCookies +  "&message=After attempted cookie creation, should receive no cookie.", runTest);
-                break;
-            case "#step9":
-                // Load an iframe in a redirect chain that starts with 127.0.0.1 and ends with localhost. Expect no cookie for localhost.
-                document.location.hash = "step10";
-                openIframe(redirectChainUrl + "&message=Redirect case 3, after attempted cookie creation, should receive no cookie.", runTest);
-                break;
-            case "#step10":
-                setEnableFeature(false);
-                finishJSTest();
-                break;
-        }
-    }
-</script>
-</body>
-</html>

Modified: branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/add-partitioning-to-redirect.html (227122 => 227123)


--- branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/add-partitioning-to-redirect.html	2018-01-18 06:06:50 UTC (rev 227122)
+++ branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/add-partitioning-to-redirect.html	2018-01-18 06:17:39 UTC (rev 227123)
@@ -64,10 +64,9 @@
                 openIframe(redirectChainUrl + "&message=Redirect case, should receive first-party cookie.", runTest);
                 break;
             case "#step4":
-                // Set localhost as prevalent and with non-recent user interaction to put it in the partitioning category.
+                // Set localhost as prevalent.
                 document.location.hash = "step5";
                 testRunner.setStatisticsPrevalentResource("http://localhost", true);
-                testRunner.setStatisticsHasHadNonRecentUserInteraction("http://localhost");
                 testRunner.statisticsUpdateCookiePartitioning();
                 if (!testRunner.isStatisticsPrevalentResource("http://localhost"))
                     testFailed("Host did not get set as prevalent resource.");

Deleted: branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context-expected.txt (227122 => 227123)


--- branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context-expected.txt	2018-01-18 06:06:50 UTC (rev 227122)
+++ branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context-expected.txt	2018-01-18 06:17:39 UTC (rev 227123)
@@ -1,34 +0,0 @@
-PASS successfullyParsed is true
-
-TEST COMPLETE
-  
-
---------
-Frame: '<!--framePath //<!--frame0-->-->'
---------
-Should receive one cookie.
-Received cookie named 'firstPartyCookie'.
-Did not receive cookie named 'partitionedCookie'.
-Client-side document.cookie: firstPartyCookie=value
-
---------
-Frame: '<!--framePath //<!--frame1-->-->'
---------
-Setting partitioned, third party cookie.
-
-
---------
-Frame: '<!--framePath //<!--frame2-->-->'
---------
-Should receive one partitioned, third party cookie.
-Did not receive cookie named 'firstPartyCookie'.
-Received cookie named 'partitionedCookie'.
-Client-side document.cookie: partitionedCookie=value
-
---------
-Frame: '<!--framePath //<!--frame3-->-->'
---------
-After user interaction, should receive one non-partitioned, first party cookie.
-Received cookie named 'firstPartyCookie'.
-Did not receive cookie named 'partitionedCookie'.
-Client-side document.cookie: firstPartyCookie=value

Deleted: branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html (227122 => 227123)


--- branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html	2018-01-18 06:06:50 UTC (rev 227122)
+++ branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html	2018-01-18 06:17:39 UTC (rev 227123)
@@ -1,95 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-    <meta charset="UTF-8">
-    <title>Test to ensure non-prevalent resources can access their cookies in a third party context</title>
-    <script src=""
-</head>
-<body>
-<script>
-    const partitionHost = "127.0.0.1:8000";
-    const thirdPartyHostname = "localhost";
-    const thirdPartyOrigin = "http://" + thirdPartyHostname + ":8000";
-    const thirdPartyBaseUrl = thirdPartyOrigin + "/resourceLoadStatistics/resources";
-    const firstPartyCookieName = "firstPartyCookie";
-    const subPathToSetFirstPartyCookie = "/set-cookie.php?name=" + firstPartyCookieName + "&value=value";
-    const partitionedCookieName = "partitionedCookie";
-    const subPathToSetPartitionedCookie = "/set-cookie.php?name=" + partitionedCookieName + "&value=value";
-    const fragmentWithReturnUrl = "http://127.0.0.1:8000/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html";
-    const subPathToGetCookies = "/get-cookies.php?name1=" + firstPartyCookieName + "&name2=" + partitionedCookieName;
-
-    function setEnableFeature(enable) {
-        if (!enable) {
-            testRunner.statisticsResetToConsistentState();
-        }
-        testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(enable);
-        internals.setResourceLoadStatisticsEnabled(enable);
-        testRunner.setCookieStoragePartitioningEnabled(enable);
-    }
-
-    function finishTest() {
-        setEnableFeature(false);
-        testRunner.notifyDone();
-    }
-
-    function openIframe(url, onLoadHandler) {
-        const element = document.createElement("iframe");
-        element.src = ""
-        if (onLoadHandler) {
-            element._onload_ = onLoadHandler;
-        }
-        document.body.appendChild(element);
-    }
-
-    function setUserInteractionAndContinue() {
-        testRunner.setStatisticsHasHadUserInteraction(thirdPartyOrigin, true);
-        if (!testRunner.isStatisticsHasHadUserInteraction(thirdPartyOrigin))
-            testFailed("Third party did not get logged for user interaction.");
-        runTest();
-    }
-
-    function runTest() {
-        switch (document.location.hash) {
-            case "#step1":
-                // Set a first-party cookie for localhost.
-                document.location.href = "" + subPathToSetFirstPartyCookie + "#" + fragmentWithReturnUrl + "#step2";
-                break;
-            case "#step2":
-                // Load localhost under 127.0.0.1 and check that it gets its cookie.
-                document.location.hash = "step3";
-                openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive one cookie.", runTest);
-                break;
-            case "#step3":
-                // Setup localhost for partitioning and set a partitioned cookie for localhost under 127.0.0.1.
-                document.location.hash = "step4";
-                testRunner.statisticsSetShouldPartitionCookiesForHost(thirdPartyHostname, true);
-                openIframe(thirdPartyBaseUrl + subPathToSetPartitionedCookie + "&message=Setting partitioned, third party cookie.", runTest);
-                break;
-            case "#step4":
-                // Load localhost under 127.0.0.1 and check that it gets only the partitioned cookie. End by aquiring user interaction for localhost.
-                document.location.hash = "step5";
-                openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive one partitioned, third party cookie.", setUserInteractionAndContinue);
-                break;
-            case "#step5":
-                // Load localhost under 127.0.0.1 and check that it gets its non-partitioned cookie after user interaction.
-                openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=After user interaction, should receive one non-partitioned, first party cookie.", finishTest);
-                break;
-        }
-    }
-
-    if (document.location.host === partitionHost && document.location.hash == "" && window.testRunner && window.internals) {
-        setEnableFeature(true);
-
-        testRunner.setStatisticsPrevalentResource(thirdPartyHostname, false);
-        testRunner.setStatisticsHasHadUserInteraction(thirdPartyOrigin, false);
-        testRunner.statisticsSetShouldPartitionCookiesForHost(thirdPartyHostname, false);
-
-        testRunner.waitUntilDone();
-        testRunner.dumpChildFramesAsText();
-        document.location.hash = "step1";
-    }
-
-    runTest();
-</script>
-</body>
-</html>

Modified: branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html (227122 => 227123)


--- branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html	2018-01-18 06:06:50 UTC (rev 227122)
+++ branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html	2018-01-18 06:17:39 UTC (rev 227123)
@@ -104,11 +104,9 @@
     if (document.location.hash === "" && window.testRunner && window.internals) {
         setEnableFeature(true);
 
-        // Set localhost as prevalent and with non-recent user interaction to put it in the partitioning category.
         testRunner.setStatisticsPrevalentResource("http://localhost", true);
         if (!testRunner.isStatisticsPrevalentResource("http://localhost"))
             testFailed("Host did not get set as prevalent resource.");
-        testRunner.setStatisticsHasHadNonRecentUserInteraction("http://localhost");
 
         testRunner.statisticsUpdateCookiePartitioning();
 

Deleted: branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/remove-blocking-in-redirect-expected.txt (227122 => 227123)


--- branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/remove-blocking-in-redirect-expected.txt	2018-01-18 06:06:50 UTC (rev 227122)
+++ branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/remove-blocking-in-redirect-expected.txt	2018-01-18 06:17:39 UTC (rev 227123)
@@ -1,47 +0,0 @@
-Tests that blocking is removed mid-flight in redirects.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
-
---------
-Frame: '<!--framePath //<!--frame0-->-->'
---------
-Should receive first-party cookie.
-Received cookie named 'firstPartyCookie'.
-Did not receive cookie named 'partitionedCookie'.
-Client-side document.cookie: firstPartyCookie=value
-
---------
-Frame: '<!--framePath //<!--frame1-->-->'
---------
-Redirect case 1, should receive first-party cookie for 127.0.0.1.
-Received cookie named 'firstPartyCookie'.
-Did not receive cookie named 'partitionedCookie'.
-Client-side document.cookie: firstPartyCookie=127.0.0.1
-
---------
-Frame: '<!--framePath //<!--frame2-->-->'
---------
-Set partitioned, third-party cookie.
-
-
---------
-Frame: '<!--framePath //<!--frame3-->-->'
---------
-Should receive no cookie.
-Did not receive cookie named 'firstPartyCookie'.
-Did not receive cookie named 'partitionedCookie'.
-Client-side document.cookie:
-
---------
-Frame: '<!--framePath //<!--frame4-->-->'
---------
-Redirect case 2, should receive first-party cookie for 127.0.0.1.
-Received cookie named 'firstPartyCookie'.
-Did not receive cookie named 'partitionedCookie'.
-Client-side document.cookie: firstPartyCookie=127.0.0.1

Deleted: branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html (227122 => 227123)


--- branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html	2018-01-18 06:06:50 UTC (rev 227122)
+++ branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html	2018-01-18 06:17:39 UTC (rev 227123)
@@ -1,99 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-    <meta charset="UTF-8">
-    <script src=""
-</head>
-<body _onload_="runTest()">
-<script>
-    description("Tests that blocking is removed mid-flight in redirects.");
-    jsTestIsAsync = true;
-
-    function setEnableFeature(enable) {
-        if (!enable)
-            testRunner.statisticsResetToConsistentState();
-        internals.setResourceLoadStatisticsEnabled(enable);
-        testRunner.setCookieStoragePartitioningEnabled(enable);
-    }
-
-    if (document.location.hash === "") {
-        setEnableFeature(true);
-        if (testRunner.isStatisticsPrevalentResource("http://localhost"))
-            testFailed("Localhost was classified as prevalent resource before the test starts.");
-        // Make sure the network process is up-to-date.
-        testRunner.statisticsSetShouldPartitionCookiesForHost("localhost", false);
-        testRunner.dumpChildFramesAsText();
-        document.location.hash = "step1";
-    }
-
-    const partitionHost = "127.0.0.1:8000";
-    const thirdPartyOrigin = "http://localhost:8000";
-    const resourcePath = "/resourceLoadStatistics/resources";
-    const thirdPartyBaseUrl = thirdPartyOrigin + resourcePath;
-    const firstPartyCookieName = "firstPartyCookie";
-    const subPathToSetFirstPartyCookie = "/set-cookie.php?name=" + firstPartyCookieName + "&value=value";
-    const partitionedCookieName = "partitionedCookie";
-    const subPathToSetPartitionedCookie = "/set-cookie.php?name=" + partitionedCookieName + "&value=value";
-    const returnUrl = "http://" + partitionHost + "/resourceLoadStatistics/remove-blocking-in-redirect.html";
-    const subPathToGetCookies = "/get-cookies.php?name1=" + firstPartyCookieName + "&name2=" + partitionedCookieName;
-    const redirectChainUrl = thirdPartyOrigin + resourcePath + "/redirect.php?redirectTo=http://" + partitionHost + resourcePath + subPathToGetCookies;
-
-    function openIframe(url, onLoadHandler) {
-        const element = document.createElement("iframe");
-        element.src = ""
-        if (onLoadHandler) {
-            element._onload_ = onLoadHandler;
-        }
-        document.body.appendChild(element);
-    }
-
-    function runTest() {
-        switch (document.location.hash) {
-            case "#step1":
-                // Set first-party cookies for 127.0.0.1 and localhost.
-                document.cookie = firstPartyCookieName + "=127.0.0.1;path='/'";
-                document.location.href = "" + subPathToSetFirstPartyCookie + "#" + returnUrl + "#step2";
-                break;
-            case "#step2":
-                // Check that the cookie gets sent for localhost under 127.0.0.1 since localhost is not prevalent.
-                document.location.hash = "step3";
-                openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive first-party cookie.", runTest);
-                break;
-            case "#step3":
-                document.location.hash = "step4";
-                // Load an iframe in a redirect chain that starts with localhost and ends with 127.0.0.1. Expect a cookie for 127.0.0.1.
-                openIframe(redirectChainUrl + "&message=Redirect case 1, should receive first-party cookie for 127.0.0.1.", runTest);
-                break;
-            case "#step4":
-                // Set localhost as prevalent and with non-recent user interaction to put it in the blocking category.
-                document.location.hash = "step5";
-                testRunner.setStatisticsPrevalentResource("http://localhost", true);
-                testRunner.statisticsUpdateCookiePartitioning();
-                if (!testRunner.isStatisticsPrevalentResource("http://localhost"))
-                    testFailed("Host did not get set as prevalent resource.");
-                runTest();
-                break;
-            case "#step5":
-                // Set partitioned cookie for localhost under 127.0.0.1.
-                document.location.hash = "step6";
-                openIframe(thirdPartyBaseUrl + subPathToSetPartitionedCookie + "&message=Set partitioned, third-party cookie.", runTest);
-                break;
-            case "#step6":
-                // Check that no cookie gets sent for localhost under 127.0.0.1 since localhost's cookies are blocked.
-                document.location.hash = "step7";
-                openIframe(thirdPartyBaseUrl + subPathToGetCookies +  "&message=Should receive no cookie.", runTest);
-                break;
-            case "#step7":
-                // Load an iframe in a redirect chain that starts with localhost and ends with 127.0.0.1. Expect a cookie for 127.0.0.1.
-                document.location.hash = "step8";
-                openIframe(redirectChainUrl + "&message=Redirect case 2, should receive first-party cookie for 127.0.0.1.", runTest);
-                break;
-            case "#step8":
-                setEnableFeature(false);
-                finishJSTest();
-                break;
-        }
-    }
-</script>
-</body>
-</html>

Added: branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/remove-partitioning-from-redirect-expected.txt (0 => 227123)


--- branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/remove-partitioning-from-redirect-expected.txt	                        (rev 0)
+++ branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/remove-partitioning-from-redirect-expected.txt	2018-01-18 06:17:39 UTC (rev 227123)
@@ -0,0 +1,25 @@
+Tests that partitioning is removed mid-flight in redirects.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
+--------
+Frame: '<!--framePath //<!--frame0-->-->'
+--------
+Should receive first-party cookie.
+Received cookie named 'firstPartyCookie'.
+Did not receive cookie named 'partitionedCookie'.
+Client-side document.cookie: firstPartyCookie=value
+
+--------
+Frame: '<!--framePath //<!--frame1-->-->'
+--------
+Redirect case, should receive first-party cookie.
+Received cookie named 'firstPartyCookie'.
+Did not receive cookie named 'partitionedCookie'.
+Client-side document.cookie: firstPartyCookie=value

Copied: branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/remove-partitioning-from-redirect.html (from rev 227120, branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html) (0 => 227123)


--- branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/remove-partitioning-from-redirect.html	                        (rev 0)
+++ branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/remove-partitioning-from-redirect.html	2018-01-18 06:17:39 UTC (rev 227123)
@@ -0,0 +1,81 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <script src=""
+</head>
+<body _onload_="runTest()">
+<script>
+    description("Tests that partitioning is removed mid-flight in redirects.");
+    jsTestIsAsync = true;
+
+    function setEnableFeature(enable) {
+        if (!enable)
+            testRunner.statisticsResetToConsistentState();
+        internals.setResourceLoadStatisticsEnabled(enable);
+        testRunner.setCookieStoragePartitioningEnabled(enable);
+    }
+
+    if (document.location.hash === "") {
+        setEnableFeature(true);
+        if (testRunner.isStatisticsPrevalentResource("http://localhost"))
+            testFailed("Localhost was classified as prevalent resource before the test starts.");
+        testRunner.dumpChildFramesAsText();
+        document.location.hash = "step1";
+    }
+
+    const partitionHost = "127.0.0.1:8000";
+    const thirdPartyOrigin = "http://localhost:8000";
+    const resourcePath = "/resourceLoadStatistics/resources";
+    const thirdPartyBaseUrl = thirdPartyOrigin + resourcePath;
+    const partitionBaseUrl = "http://" + partitionHost + resourcePath;
+    const firstPartyCookieName = "firstPartyCookie";
+    const subPathToSetFirstPartyCookie = "/set-cookie.php?name=" + firstPartyCookieName + "&value=value";
+    const partitionedCookieName = "partitionedCookie";
+    const returnUrl = "http://" + partitionHost + "/resourceLoadStatistics/remove-partitioning-from-redirect.html";
+    const subPathToGetCookies = "/get-cookies.php?name1=" + firstPartyCookieName + "&name2=" + partitionedCookieName;
+    const redirectChainUrl = thirdPartyBaseUrl + "/redirect.php?redirectTo=" + partitionBaseUrl + subPathToGetCookies;
+
+    function openIframe(url, onLoadHandler) {
+        const element = document.createElement("iframe");
+        element.src = ""
+        if (onLoadHandler) {
+            element._onload_ = onLoadHandler;
+        }
+        document.body.appendChild(element);
+    }
+
+    function runTest() {
+        switch (document.location.hash) {
+            case "#step1":
+                // Set localhost as prevalent.
+                document.location.hash = "step2";
+                testRunner.setStatisticsPrevalentResource("http://localhost", true);
+                testRunner.statisticsUpdateCookiePartitioning();
+                if (!testRunner.isStatisticsPrevalentResource("http://localhost"))
+                    testFailed("Host did not get set as prevalent resource.");
+                runTest();
+                break;
+            case "#step2":
+                // Set first-party cookie for 127.0.0.1.
+                document.location.href = "" + subPathToSetFirstPartyCookie + "#" + returnUrl + "#step3";
+                break;
+            case "#step3":
+                // Check that the cookie gets sent for 127.0.0.1 under 127.0.0.1.
+                document.location.hash = "step4";
+                openIframe(partitionBaseUrl + subPathToGetCookies + "&message=Should receive first-party cookie.", runTest);
+                break;
+            case "#step4":
+                document.location.hash = "step5";
+                // Load an iframe in a redirect chain that starts with localhost and ends with 127.0.0.1. Expect a cookie for 127.0.0.1.
+                openIframe(redirectChainUrl + "&message=Redirect case, should receive first-party cookie.", runTest);
+                break;
+            case "#step5":
+                setEnableFeature(false);
+                finishJSTest();
+                break;
+        }
+    }
+</script>
+</body>
+</html>

Deleted: branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/remove-partitioning-in-redirect-expected.txt (227122 => 227123)


--- branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/remove-partitioning-in-redirect-expected.txt	2018-01-18 06:06:50 UTC (rev 227122)
+++ branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/remove-partitioning-in-redirect-expected.txt	2018-01-18 06:17:39 UTC (rev 227123)
@@ -1,47 +0,0 @@
-Tests that partitioning is removed mid-flight in redirects.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
-
---------
-Frame: '<!--framePath //<!--frame0-->-->'
---------
-Should receive first-party cookie.
-Received cookie named 'firstPartyCookie'.
-Did not receive cookie named 'partitionedCookie'.
-Client-side document.cookie: firstPartyCookie=value
-
---------
-Frame: '<!--framePath //<!--frame1-->-->'
---------
-Redirect case 1, should receive first-party cookie for 127.0.0.1.
-Received cookie named 'firstPartyCookie'.
-Did not receive cookie named 'partitionedCookie'.
-Client-side document.cookie: firstPartyCookie=127.0.0.1
-
---------
-Frame: '<!--framePath //<!--frame2-->-->'
---------
-Set partitioned, third-party cookie.
-
-
---------
-Frame: '<!--framePath //<!--frame3-->-->'
---------
-Should receive partitioned cookie.
-Did not receive cookie named 'firstPartyCookie'.
-Received cookie named 'partitionedCookie'.
-Client-side document.cookie: partitionedCookie=value
-
---------
-Frame: '<!--framePath //<!--frame4-->-->'
---------
-Redirect case 2, should receive first-party cookie for 127.0.0.1.
-Received cookie named 'firstPartyCookie'.
-Did not receive cookie named 'partitionedCookie'.
-Client-side document.cookie: firstPartyCookie=127.0.0.1

Deleted: branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html (227122 => 227123)


--- branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html	2018-01-18 06:06:50 UTC (rev 227122)
+++ branches/safari-605-branch/LayoutTests/http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html	2018-01-18 06:17:39 UTC (rev 227123)
@@ -1,100 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-    <meta charset="UTF-8">
-    <script src=""
-</head>
-<body _onload_="runTest()">
-<script>
-    description("Tests that partitioning is removed mid-flight in redirects.");
-    jsTestIsAsync = true;
-
-    function setEnableFeature(enable) {
-        if (!enable)
-            testRunner.statisticsResetToConsistentState();
-        internals.setResourceLoadStatisticsEnabled(enable);
-        testRunner.setCookieStoragePartitioningEnabled(enable);
-    }
-
-    if (document.location.hash === "") {
-        setEnableFeature(true);
-        if (testRunner.isStatisticsPrevalentResource("http://localhost"))
-            testFailed("Localhost was classified as prevalent resource before the test starts.");
-        // Make sure the network process is up-to-date.
-        testRunner.statisticsSetShouldPartitionCookiesForHost("localhost", false);
-        testRunner.dumpChildFramesAsText();
-        document.location.hash = "step1";
-    }
-
-    const partitionHost = "127.0.0.1:8000";
-    const thirdPartyOrigin = "http://localhost:8000";
-    const resourcePath = "/resourceLoadStatistics/resources";
-    const thirdPartyBaseUrl = thirdPartyOrigin + resourcePath;
-    const firstPartyCookieName = "firstPartyCookie";
-    const subPathToSetFirstPartyCookie = "/set-cookie.php?name=" + firstPartyCookieName + "&value=value";
-    const partitionedCookieName = "partitionedCookie";
-    const subPathToSetPartitionedCookie = "/set-cookie.php?name=" + partitionedCookieName + "&value=value";
-    const returnUrl = "http://" + partitionHost + "/resourceLoadStatistics/remove-partitioning-in-redirect.html";
-    const subPathToGetCookies = "/get-cookies.php?name1=" + firstPartyCookieName + "&name2=" + partitionedCookieName;
-    const redirectChainUrl = thirdPartyOrigin + resourcePath + "/redirect.php?redirectTo=http://" + partitionHost + resourcePath + subPathToGetCookies;
-
-    function openIframe(url, onLoadHandler) {
-        const element = document.createElement("iframe");
-        element.src = ""
-        if (onLoadHandler) {
-            element._onload_ = onLoadHandler;
-        }
-        document.body.appendChild(element);
-    }
-
-    function runTest() {
-        switch (document.location.hash) {
-            case "#step1":
-                // Set first-party cookies for 127.0.0.1 and localhost.
-                document.cookie = firstPartyCookieName + "=127.0.0.1;path='/'";
-                document.location.href = "" + subPathToSetFirstPartyCookie + "#" + returnUrl + "#step2";
-                break;
-            case "#step2":
-                // Check that the cookie gets sent for localhost under 127.0.0.1 since localhost is not prevalent.
-                document.location.hash = "step3";
-                openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive first-party cookie.", runTest);
-                break;
-            case "#step3":
-                document.location.hash = "step4";
-                // Load an iframe in a redirect chain that starts with localhost and ends with 127.0.0.1. Expect a cookie for 127.0.0.1.
-                openIframe(redirectChainUrl + "&message=Redirect case 1, should receive first-party cookie for 127.0.0.1.", runTest);
-                break;
-            case "#step4":
-                // Set localhost as prevalent and with non-recent user interaction to put it in the partitioning category.
-                document.location.hash = "step5";
-                testRunner.setStatisticsPrevalentResource("http://localhost", true);
-                testRunner.setStatisticsHasHadNonRecentUserInteraction("http://localhost");
-                testRunner.statisticsUpdateCookiePartitioning();
-                if (!testRunner.isStatisticsPrevalentResource("http://localhost"))
-                    testFailed("Host did not get set as prevalent resource.");
-                runTest();
-                break;
-            case "#step5":
-                // Set partitioned cookie for localhost under 127.0.0.1.
-                document.location.hash = "step6";
-                openIframe(thirdPartyBaseUrl + subPathToSetPartitionedCookie + "&message=Set partitioned, third-party cookie.", runTest);
-                break;
-            case "#step6":
-                // Check that partitioned cookie gets sent for localhost under 127.0.0.1 since localhost is partitioned.
-                document.location.hash = "step7";
-                openIframe(thirdPartyBaseUrl + subPathToGetCookies +  "&message=Should receive partitioned cookie.", runTest);
-                break;
-            case "#step7":
-                // Load an iframe in a redirect chain that starts with localhost and ends with 127.0.0.1. Expect a cookie for 127.0.0.1.
-                document.location.hash = "step8";
-                openIframe(redirectChainUrl + "&message=Redirect case 2, should receive first-party cookie for 127.0.0.1.", runTest);
-                break;
-            case "#step8":
-                setEnableFeature(false);
-                finishJSTest();
-                break;
-        }
-    }
-</script>
-</body>
-</html>

Modified: branches/safari-605-branch/LayoutTests/platform/ios/TestExpectations (227122 => 227123)


--- branches/safari-605-branch/LayoutTests/platform/ios/TestExpectations	2018-01-18 06:06:50 UTC (rev 227122)
+++ branches/safari-605-branch/LayoutTests/platform/ios/TestExpectations	2018-01-18 06:17:39 UTC (rev 227123)
@@ -2976,15 +2976,12 @@
 http/tests/resourceLoadStatistics/user-interaction-only-reported-once-within-short-period-of-time.html [ Skip ]
 http/tests/resourceLoadStatistics/user-interaction-reported-after-website-data-removal.html [ Skip ]
 # Skipped in WK2 expectations because cookie partitioning is only available in macOS High Sierra and iOS 11.
+http/tests/resourceLoadStatistics/add-partitioning-to-redirect.html [ Pass ]
+http/tests/resourceLoadStatistics/remove-partitioning-from-redirect.html [ Pass ]
 http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion.html [ Pass ]
 http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html [ Pass ]
 http/tests/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html [ Pass ]
 http/tests/resourceLoadStatistics/third-party-cookie-with-and-without-user-interaction.html [ Pass ]
-http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html [ Pass ]
-http/tests/resourceLoadStatistics/add-partitioning-to-redirect.html [ Pass ]
-http/tests/resourceLoadStatistics/add-blocking-to-redirect.html [ Pass ]
-http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html [ Pass ]
-http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html [ Pass ]
 
 webkit.org/b/175273 imported/w3c/web-platform-tests/html/browsers/windows/noreferrer-window-name.html [ Failure ]
 

Modified: branches/safari-605-branch/LayoutTests/platform/mac-wk2/TestExpectations (227122 => 227123)


--- branches/safari-605-branch/LayoutTests/platform/mac-wk2/TestExpectations	2018-01-18 06:06:50 UTC (rev 227122)
+++ branches/safari-605-branch/LayoutTests/platform/mac-wk2/TestExpectations	2018-01-18 06:17:39 UTC (rev 227123)
@@ -807,11 +807,8 @@
 [ HighSierra+ ] http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html [ Pass ]
 [ HighSierra+ ] http/tests/resourceLoadStatistics/third-party-cookie-with-and-without-user-interaction.html [ Pass ]
 [ HighSierra+ ] http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion.html [ Pass Timeout ]
-[ HighSierra+ ] http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html [ Pass ]
 [ HighSierra+ ] http/tests/resourceLoadStatistics/add-partitioning-to-redirect.html [ Pass ]
-[ HighSierra+ ] http/tests/resourceLoadStatistics/add-blocking-to-redirect.html [ Pass ]
-[ HighSierra+ ] http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html [ Pass ]
-[ HighSierra+ ] http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html [ Pass ]
+[ HighSierra+ ] http/tests/resourceLoadStatistics/remove-partitioning-from-redirect.html [ Pass ]
 
 # <rdar://problem/33555759>
 webkit.org/b/177616 [ HighSierra+ ] http/tests/media/video-buffered-range-contains-currentTime.html [ Pass Timeout ]

Modified: branches/safari-605-branch/LayoutTests/platform/wk2/TestExpectations (227122 => 227123)


--- branches/safari-605-branch/LayoutTests/platform/wk2/TestExpectations	2018-01-18 06:06:50 UTC (rev 227122)
+++ branches/safari-605-branch/LayoutTests/platform/wk2/TestExpectations	2018-01-18 06:17:39 UTC (rev 227123)
@@ -691,15 +691,12 @@
 http/tests/resourceLoadStatistics/prune-statistics.html [ Pass ]
 http/tests/resourceLoadStatistics [ Pass ]
 # Cookie partitioning is only supported in macOS High Sierra and iOS 11.
+http/tests/resourceLoadStatistics/add-partitioning-to-redirect.html [ Skip ]
+http/tests/resourceLoadStatistics/remove-partitioning-from-redirect.html [ Skip ]
 http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-deletion.html [ Skip ]
 http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html [ Skip ]
 http/tests/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html [ Skip ]
 http/tests/resourceLoadStatistics/third-party-cookie-with-and-without-user-interaction.html [ Skip ]
-http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html [ Skip ]
-http/tests/resourceLoadStatistics/add-partitioning-to-redirect.html [ Skip ]
-http/tests/resourceLoadStatistics/add-blocking-to-redirect.html [ Skip ]
-http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html [ Skip ]
-http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html [ Skip ]
 
 ### END OF (5) Progressions, expected successes that are expected failures in WebKit1.
 ########################################

Modified: branches/safari-605-branch/Source/WebCore/ChangeLog (227122 => 227123)


--- branches/safari-605-branch/Source/WebCore/ChangeLog	2018-01-18 06:06:50 UTC (rev 227122)
+++ branches/safari-605-branch/Source/WebCore/ChangeLog	2018-01-18 06:17:39 UTC (rev 227123)
@@ -1,5 +1,22 @@
 2018-01-17  Jason Marcell  <[email protected]>
 
+        Cherry-pick r227093. rdar://problem/36598105
+
+    2018-01-17  Matt Lewis  <[email protected]>
+
+            Unreviewed, rolling out r227076.
+
+            This breaks internal builds
+
+            Reverted changeset:
+
+            "Resource Load Statistics: Block cookies for prevalent
+            resources without user interaction"
+            https://bugs.webkit.org/show_bug.cgi?id=177394
+            https://trac.webkit.org/changeset/227076
+
+2018-01-17  Jason Marcell  <[email protected]>
+
         Cherry-pick r227087. rdar://problem/36597993
 
     2018-01-17  Zalan Bujtas  <[email protected]>

Modified: branches/safari-605-branch/Source/WebCore/PAL/ChangeLog (227122 => 227123)


--- branches/safari-605-branch/Source/WebCore/PAL/ChangeLog	2018-01-18 06:06:50 UTC (rev 227122)
+++ branches/safari-605-branch/Source/WebCore/PAL/ChangeLog	2018-01-18 06:17:39 UTC (rev 227123)
@@ -1,5 +1,22 @@
 2018-01-17  Jason Marcell  <[email protected]>
 
+        Cherry-pick r227093. rdar://problem/36598105
+
+    2018-01-17  Matt Lewis  <[email protected]>
+
+            Unreviewed, rolling out r227076.
+
+            This breaks internal builds
+
+            Reverted changeset:
+
+            "Resource Load Statistics: Block cookies for prevalent
+            resources without user interaction"
+            https://bugs.webkit.org/show_bug.cgi?id=177394
+            https://trac.webkit.org/changeset/227076
+
+2018-01-17  Jason Marcell  <[email protected]>
+
         Cherry-pick r227076. rdar://problem/36598105
 
     2018-01-17  John Wilander  <[email protected]>

Modified: branches/safari-605-branch/Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h (227122 => 227123)


--- branches/safari-605-branch/Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h	2018-01-18 06:06:50 UTC (rev 227122)
+++ branches/safari-605-branch/Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h	2018-01-18 06:17:39 UTC (rev 227123)
@@ -179,7 +179,6 @@
 
 @interface NSHTTPCookieStorage ()
 - (void)_getCookiesForURL:(NSURL *)url mainDocumentURL:(NSURL *)mainDocumentURL partition:(NSString *)partition completionHandler:(void (^)(NSArray *))completionHandler;
-- (id)_initWithIdentifier:(NSString *)identifier private:(bool)isPrivate;
 @end
 
 @interface NSURLSessionTask ()

Modified: branches/safari-605-branch/Source/WebCore/platform/network/NetworkStorageSession.h (227122 => 227123)


--- branches/safari-605-branch/Source/WebCore/platform/network/NetworkStorageSession.h	2018-01-18 06:06:50 UTC (rev 227122)
+++ branches/safari-605-branch/Source/WebCore/platform/network/NetworkStorageSession.h	2018-01-18 06:17:39 UTC (rev 227123)
@@ -74,7 +74,7 @@
     CredentialStorage& credentialStorage() { return m_credentialStorage; }
 
 #ifdef __OBJC__
-    WEBCORE_EXPORT NSHTTPCookieStorage *nsCookieStorage() const;
+    NSHTTPCookieStorage *nsCookieStorage() const;
 #endif
 
     const String& cacheStorageDirectory() const { return m_cacheStorageDirectory; }

Modified: branches/safari-605-branch/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp (227122 => 227123)


--- branches/safari-605-branch/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp	2018-01-18 06:06:50 UTC (rev 227122)
+++ branches/safari-605-branch/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp	2018-01-18 06:17:39 UTC (rev 227123)
@@ -260,9 +260,11 @@
     }
 
     for (auto& domain : domainsToBlock) {
-        m_topPrivatelyControlledDomainsToBlock.add(domain);
-        if (!clearFirst)
-            m_topPrivatelyControlledDomainsToPartition.remove(domain);
+        // FIXME: https://bugs.webkit.org/show_bug.cgi?id=177394
+        // m_topPrivatelyControlledDomainsToBlock.add(domain);
+        // if (!clearFirst)
+        //     m_topPrivatelyControlledDomainsToPartition.remove(domain);
+        m_topPrivatelyControlledDomainsToPartition.add(domain);
     }
     
     if (!clearFirst) {

Modified: branches/safari-605-branch/Source/WebKit/ChangeLog (227122 => 227123)


--- branches/safari-605-branch/Source/WebKit/ChangeLog	2018-01-18 06:06:50 UTC (rev 227122)
+++ branches/safari-605-branch/Source/WebKit/ChangeLog	2018-01-18 06:17:39 UTC (rev 227123)
@@ -1,5 +1,22 @@
 2018-01-17  Jason Marcell  <[email protected]>
 
+        Cherry-pick r227093. rdar://problem/36598105
+
+    2018-01-17  Matt Lewis  <[email protected]>
+
+            Unreviewed, rolling out r227076.
+
+            This breaks internal builds
+
+            Reverted changeset:
+
+            "Resource Load Statistics: Block cookies for prevalent
+            resources without user interaction"
+            https://bugs.webkit.org/show_bug.cgi?id=177394
+            https://trac.webkit.org/changeset/227076
+
+2018-01-17  Jason Marcell  <[email protected]>
+
         Cherry-pick r227076. rdar://problem/36598105
 
     2018-01-17  John Wilander  <[email protected]>

Modified: branches/safari-605-branch/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.h (227122 => 227123)


--- branches/safari-605-branch/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.h	2018-01-18 06:06:50 UTC (rev 227122)
+++ branches/safari-605-branch/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.h	2018-01-18 06:17:39 UTC (rev 227123)
@@ -32,7 +32,6 @@
 #include <WebCore/NetworkLoadMetrics.h>
 #include <wtf/RetainPtr.h>
 
-OBJC_CLASS NSHTTPCookieStorage;
 OBJC_CLASS NSURLSessionDataTask;
 
 namespace WebKit {
@@ -79,21 +78,11 @@
     bool tryPasswordBasedAuthentication(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler&);
     void applySniffingPoliciesAndBindRequestToInferfaceIfNeeded(NSURLRequest*&, bool shouldContentSniff, bool shouldContentEncodingSniff);
 
-#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
-    static NSHTTPCookieStorage *statelessCookieStorage();
-    void applyCookieBlockingPolicy(bool shouldBlock);
-    void applyCookiePartitioningPolicy(const String& requiredStoragePartition, const String& currentStoragePartition);
-#endif
-
     RefPtr<SandboxExtension> m_sandboxExtension;
     RetainPtr<NSURLSessionDataTask> m_task;
     WebCore::NetworkLoadMetrics m_networkLoadMetrics;
     uint64_t m_frameID;
     uint64_t m_pageID;
-
-#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
-    bool m_hasBeenSetToUseStatelessCookieStorage { false };
-#endif
 };
 
 WebCore::Credential serverTrustCredential(const WebCore::AuthenticationChallenge&);

Modified: branches/safari-605-branch/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm (227122 => 227123)


--- branches/safari-605-branch/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm	2018-01-18 06:06:50 UTC (rev 227122)
+++ branches/safari-605-branch/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm	2018-01-18 06:17:39 UTC (rev 227123)
@@ -101,41 +101,6 @@
     nsRequest = mutableRequest.autorelease();
 }
 
-#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
-NSHTTPCookieStorage *NetworkDataTaskCocoa::statelessCookieStorage()
-{
-    static NeverDestroyed<RetainPtr<NSHTTPCookieStorage>> statelessCookieStorage;
-    if (!statelessCookieStorage.get()) {
-        statelessCookieStorage.get() = adoptNS([[NSHTTPCookieStorage alloc] _initWithIdentifier:nil private:YES]);
-        statelessCookieStorage.get().get().cookieAcceptPolicy = NSHTTPCookieAcceptPolicyNever;
-    }
-    ASSERT(statelessCookieStorage.get().get().cookies.count == 0);
-    return statelessCookieStorage.get().get();
-}
-
-void NetworkDataTaskCocoa::applyCookieBlockingPolicy(bool shouldBlock)
-{
-    if (shouldBlock == m_hasBeenSetToUseStatelessCookieStorage)
-        return;
-
-    NSHTTPCookieStorage *storage = shouldBlock ? statelessCookieStorage(): m_session->networkStorageSession().nsCookieStorage();
-    [m_task performSelector:NSSelectorFromString(@"_setExplicitCookieStorage:") withObject:(NSObject*)storage._cookieStorage];
-    m_hasBeenSetToUseStatelessCookieStorage = shouldBlock;
-}
-
-void NetworkDataTaskCocoa::applyCookiePartitioningPolicy(const String& requiredStoragePartition, const String& currentStoragePartition)
-{
-    // The need for a partion change is according to the following:
-    //      currentStoragePartition:  null  ""    abc
-    // requiredStoragePartition: ""   false false true
-    //                           abc  true  true  false
-    //                           xyz  true  true  true
-    auto shouldChangePartition = !((requiredStoragePartition.isEmpty() && currentStoragePartition.isEmpty()) || currentStoragePartition == requiredStoragePartition);
-    if (shouldChangePartition)
-        m_task.get()._storagePartitionIdentifier = requiredStoragePartition;
-}
-#endif
-
 NetworkDataTaskCocoa::NetworkDataTaskCocoa(NetworkSession& session, NetworkDataTaskClient& client, const WebCore::ResourceRequest& requestWithCredentials, uint64_t frameID, uint64_t pageID, WebCore::StoredCredentialsPolicy storedCredentialsPolicy, WebCore::ContentSniffingPolicy shouldContentSniff, WebCore::ContentEncodingSniffingPolicy shouldContentEncodingSniff, bool shouldClearReferrerOnHTTPSToHTTPRedirect, PreconnectOnly shouldPreconnectOnly)
     : NetworkDataTask(session, client, requestWithCredentials, storedCredentialsPolicy, shouldClearReferrerOnHTTPSToHTTPRedirect)
     , m_frameID(frameID)
@@ -170,6 +135,11 @@
     NSURLRequest *nsRequest = request.nsURLRequest(WebCore::UpdateHTTPBody);
     applySniffingPoliciesAndBindRequestToInferfaceIfNeeded(nsRequest, shouldContentSniff == WebCore::SniffContent && !url.isLocalFile(), shouldContentEncodingSniff == WebCore::ContentEncodingSniffingPolicy::Sniff);
 
+    if (session.networkStorageSession().shouldBlockCookies(request)) {
+        storedCredentialsPolicy = WebCore::StoredCredentialsPolicy::DoNotUse;
+        m_storedCredentialsPolicy = WebCore::StoredCredentialsPolicy::DoNotUse;
+    }
+
     auto& cocoaSession = static_cast<NetworkSessionCocoa&>(m_session.get());
     if (storedCredentialsPolicy == WebCore::StoredCredentialsPolicy::Use) {
         m_task = [cocoaSession.m_sessionWithCredentialStorage dataTaskWithRequest:nsRequest];
@@ -192,14 +162,11 @@
     }
 
 #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
-    if (auto shouldBlockCookies = session.networkStorageSession().shouldBlockCookies(request)) {
-        LOG(NetworkSession, "%llu Blocking cookies for URL %s", [m_task taskIdentifier], nsRequest.URL.absoluteString.UTF8String);
-        applyCookieBlockingPolicy(shouldBlockCookies);
-    } else {
-        auto storagePartition = session.networkStorageSession().cookieStoragePartition(request, m_frameID, m_pageID);
+    if (storedCredentialsPolicy == WebCore::StoredCredentialsPolicy::Use) {
+        String storagePartition = session.networkStorageSession().cookieStoragePartition(request, m_frameID, m_pageID);
         if (!storagePartition.isEmpty()) {
             LOG(NetworkSession, "%llu Partitioning cookies for URL %s", [m_task taskIdentifier], nsRequest.URL.absoluteString.UTF8String);
-            applyCookiePartitioningPolicy(storagePartition, emptyString());
+            m_task.get()._storagePartitionIdentifier = storagePartition;
         }
     }
 #endif
@@ -254,6 +221,16 @@
         m_client->didReceiveData(WTFMove(data));
 }
 
+static bool shouldChangePartition(const String& requiredStoragePartition, const String& currentStoragePartition)
+{
+    // The need for a partion change is according to the following:
+    //      currentStoragePartition:  null  ""    abc
+    // requiredStoragePartition: ""   false false true
+    //                           abc  true  true  false
+    //                           xyz  true  true  true
+    return !((requiredStoragePartition.isEmpty() && currentStoragePartition.isEmpty()) || currentStoragePartition == requiredStoragePartition);
+}
+
 void NetworkDataTaskCocoa::willPerformHTTPRedirection(WebCore::ResourceResponse&& redirectResponse, WebCore::ResourceRequest&& request, RedirectCompletionHandler&& completionHandler)
 {
     if (redirectResponse.httpStatusCode() == 307 || redirectResponse.httpStatusCode() == 308) {
@@ -299,14 +276,12 @@
     }
     
 #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
-    auto shouldBlockCookies = m_session->networkStorageSession().shouldBlockCookies(request);
-    LOG(NetworkSession, "%llu %s cookies for redirect URL %s", [m_task taskIdentifier], (shouldBlockCookies ? "Blocking" : "Not blocking"), request.url().string().utf8().data());
-    applyCookieBlockingPolicy(shouldBlockCookies);
-
-    if (!shouldBlockCookies) {
-        auto requiredStoragePartition = m_session->networkStorageSession().cookieStoragePartition(request, m_frameID, m_pageID);
-        LOG(NetworkSession, "%llu %s cookies for redirect URL %s", [m_task taskIdentifier], (requiredStoragePartition.isEmpty() ? "Not partitioning" : "Partitioning"), request.url().string().utf8().data());
-        applyCookiePartitioningPolicy(requiredStoragePartition, m_task.get()._storagePartitionIdentifier);
+    if (m_storedCredentialsPolicy == WebCore::StoredCredentialsPolicy::Use) {
+        String requiredStoragePartition = m_session->networkStorageSession().cookieStoragePartition(request, m_frameID, m_pageID);
+        if (shouldChangePartition(requiredStoragePartition, m_task.get()._storagePartitionIdentifier)) {
+            LOG(NetworkSession, "%llu %s cookies for redirected URL %s", [m_task taskIdentifier], (requiredStoragePartition.isEmpty() ? "Not partitioning" : "Partitioning"), request.url().string().utf8().data());
+            m_task.get()._storagePartitionIdentifier = requiredStoragePartition;
+        }
     }
 #endif
 

Modified: branches/safari-605-branch/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (227122 => 227123)


--- branches/safari-605-branch/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2018-01-18 06:06:50 UTC (rev 227122)
+++ branches/safari-605-branch/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2018-01-18 06:17:39 UTC (rev 227123)
@@ -215,7 +215,7 @@
 
         bool shouldIgnoreHSTS = false;
 #if USE(CFNETWORK_IGNORE_HSTS)
-        shouldIgnoreHSTS = schemeWasUpgradedDueToDynamicHSTS(request) && WebCore::NetworkStorageSession::storageSession(_session->sessionID())->shouldBlockCookies(request);
+        shouldIgnoreHSTS = schemeWasUpgradedDueToDynamicHSTS(request) && !(WebCore::NetworkStorageSession::storageSession(_session->sessionID())->cookieStoragePartition(request, networkDataTask->frameID(), networkDataTask->pageID())).isEmpty();
         if (shouldIgnoreHSTS) {
             request = downgradeRequest(request);
             ASSERT([request.URL.scheme isEqualToString:@"http"]);
@@ -248,7 +248,7 @@
     if (auto* networkDataTask = [self existingTask:task]) {
         bool shouldIgnoreHSTS = false;
 #if USE(CFNETWORK_IGNORE_HSTS)
-        shouldIgnoreHSTS = schemeWasUpgradedDueToDynamicHSTS(request) && WebCore::NetworkStorageSession::storageSession(_session->sessionID())->shouldBlockCookies(request);
+        shouldIgnoreHSTS = schemeWasUpgradedDueToDynamicHSTS(request) && !(WebCore::NetworkStorageSession::storageSession(_session->sessionID())->cookieStoragePartition(request, networkDataTask->frameID(), networkDataTask->pageID())).isEmpty();
         if (shouldIgnoreHSTS) {
             request = downgradeRequest(request);
             ASSERT([request.URL.scheme isEqualToString:@"http"]);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to