Remove unused debug mode conditions
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Jun 2018 17:05:08 +0000 (17:05 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Jun 2018 17:05:08 +0000 (17:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=186358
<rdar://problem/39117121>

Reviewed by Zalan Bujtas.

Source/WebKit:

Remove some unused code paths related to ResourceLoadStatistics debug mode.

* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
(WebKit::WebResourceLoadStatisticsStore::shouldPartitionCookies const):

LayoutTests:

Rebase test expectations after behavior change.

* http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context-expected.txt:
* http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html:
* http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout-expected.txt:
* http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html:
* http/tests/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction-expected.txt:
* http/tests/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html:
* http/tests/resourceLoadStatistics/third-party-cookie-with-and-without-user-interaction-expected.txt:
* http/tests/resourceLoadStatistics/third-party-cookie-with-and-without-user-interaction.html:
* http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction-expected.txt
* http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction.html

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232585 268f45cc-cd09-0410-ab3c-d52691b4dbfc

13 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context-expected.txt
LayoutTests/http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html
LayoutTests/http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout-expected.txt
LayoutTests/http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html
LayoutTests/http/tests/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction-expected.txt
LayoutTests/http/tests/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html
LayoutTests/http/tests/resourceLoadStatistics/third-party-cookie-with-and-without-user-interaction-expected.txt
LayoutTests/http/tests/resourceLoadStatistics/third-party-cookie-with-and-without-user-interaction.html
LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction-expected.txt
LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction.html
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp

index 9e57066..f24c3d9 100644 (file)
@@ -1,5 +1,26 @@
 2018-06-07  Brent Fulgham  <bfulgham@apple.com>
 
+        Remove unused debug mode conditions
+        https://bugs.webkit.org/show_bug.cgi?id=186358
+        <rdar://problem/39117121>
+
+        Reviewed by Zalan Bujtas.
+
+        Rebase test expectations after behavior change.
+
+        * http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context-expected.txt:
+        * http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html:
+        * http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout-expected.txt:
+        * http/tests/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html:
+        * http/tests/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction-expected.txt:
+        * http/tests/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html:
+        * http/tests/resourceLoadStatistics/third-party-cookie-with-and-without-user-interaction-expected.txt:
+        * http/tests/resourceLoadStatistics/third-party-cookie-with-and-without-user-interaction.html:
+        * http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction-expected.txt
+        * http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction.html
+
+2018-06-07  Brent Fulgham  <bfulgham@apple.com>
+
         Handle Storage Access API calls in the absence of an attached frame
         https://bugs.webkit.org/show_bug.cgi?id=186373
         <rdar://problem/40028265>
index fc3c3d4..73f18d0 100644 (file)
@@ -28,7 +28,7 @@ Client-side document.cookie: partitionedCookie=value
 --------
 Frame: '<!--frame4-->'
 --------
-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
+After user interaction, should still only receive one partitioned, third party cookie.
+Did not receive cookie named 'firstPartyCookie'.
+Received cookie named 'partitionedCookie'.
+Client-side document.cookie: partitionedCookie=value
index b8df5ae..f2b4166 100644 (file)
@@ -76,7 +76,7 @@
                 break;
             case "#step6":
                 // 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);
+                openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=After user interaction, should still only receive one partitioned, third party cookie.", finishTest);
                 break;
         }
     }
index a533511..50e82c8 100644 (file)
@@ -28,10 +28,10 @@ Client-side document.cookie: thirdPartyCookie=value
 --------
 Frame: '<!--frame4-->'
 --------
-After first user interaction, should only receive un-partitioned cookie.
-Received cookie named 'firstPartyCookie'.
-Did not receive cookie named 'thirdPartyCookie'.
-Client-side document.cookie: firstPartyCookie=value
+After first user interaction, should still only receive a partitioned, third-party cookie.
+Did not receive cookie named 'firstPartyCookie'.
+Received cookie named 'thirdPartyCookie'.
+Client-side document.cookie: thirdPartyCookie=value
 
 --------
 Frame: '<!--frame5-->'
@@ -44,7 +44,7 @@ Client-side document.cookie: thirdPartyCookie=value
 --------
 Frame: '<!--frame6-->'
 --------
-After second user interaction, should only receive un-partitioned cookie.
-Received cookie named 'firstPartyCookie'.
-Did not receive cookie named 'thirdPartyCookie'.
-Client-side document.cookie: firstPartyCookie=value
+After second user interaction, should still only receive a partitioned, third-party cookie.
+Did not receive cookie named 'firstPartyCookie'.
+Received cookie named 'thirdPartyCookie'.
+Client-side document.cookie: thirdPartyCookie=value
index 0166c69..d722d73 100644 (file)
@@ -83,7 +83,7 @@
             case "#step5":
                 // http://localhost:8000 now has user interaction, check that un-partitioned cookie is sent for third-party
                 document.location.hash = "step6";
-                openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=After first user interaction, should only receive un-partitioned cookie.",
+                openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=After first user interaction, should still only receive a partitioned, third-party cookie.",
                     setShortCookiePartitioningTimeOutPlusFireShouldPartitionCookiesHandlerAndContinue);
                 break;
             case "#step6":
@@ -94,7 +94,7 @@
                 break;
             case "#step7":
                 // http://localhost:8000 now has fresh user interaction, check that un-partitioned cookie is sent for third-party
-                openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=After second user interaction, should only receive un-partitioned cookie.",
+                openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=After second user interaction, should still only receive a partitioned, third-party cookie.",
                     finishTest);
                 break;
         }
index ee90c6a..81b25e7 100644 (file)
@@ -28,7 +28,7 @@ Client-side document.cookie: thirdPartyCookie=value
 --------
 Frame: '<!--frame4-->'
 --------
-After user interaction, should only receive non-partitioned, first party cookie.
-Received cookie named 'firstPartyCookie'.
-Did not receive cookie named 'thirdPartyCookie'.
-Client-side document.cookie: firstPartyCookie=value
+After user interaction, should still only receive a partitioned, third-party cookie.
+Did not receive cookie named 'firstPartyCookie'.
+Received cookie named 'thirdPartyCookie'.
+Client-side document.cookie: thirdPartyCookie=value
index ce7fe4c..a3b0dce 100644 (file)
@@ -65,7 +65,7 @@
                 openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should only receive partitioned, third party cookie.", setUserInteractionAndContinue);
                 break;
             case "#step5":
-                openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=After user interaction, should only receive non-partitioned, first party cookie.", finishTest);
+                openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=After user interaction, should still only receive a partitioned, third-party cookie.", finishTest);
                 break;
         }
     }
index 1b384a8..405627c 100644 (file)
@@ -36,8 +36,8 @@ Client-side document.cookie: partitionedThirdPartyCookie=value
 --------
 Frame: '<!--frame5-->'
 --------
-After user interaction, should receive non-partitioned cookies set in a first-party context and in a third-party context.
-Received cookie named 'firstPartyCookie'.
-Received cookie named 'thirdPartyCookie'.
-Did not receive cookie named 'partitionedThirdPartyCookie'.
-Client-side document.cookie: firstPartyCookie=value,thirdPartyCookie=value
+After user interaction, should should still only receive a partitioned, third-party cookie.
+Did not receive cookie named 'firstPartyCookie'.
+Did not receive cookie named 'thirdPartyCookie'.
+Received cookie named 'partitionedThirdPartyCookie'.
+Client-side document.cookie: partitionedThirdPartyCookie=value
index 84fdc97..47284b6 100644 (file)
@@ -81,7 +81,7 @@
                 openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should only receive partitioned, third party cookie.", setUserInteractionAndContinue);
                 break;
             case "#step7":
-                openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=After user interaction, should receive non-partitioned cookies set in a first-party context and in a third-party context.", finishTest);
+                openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=After user interaction, should should still only receive a partitioned, third-party cookie.", finishTest);
                 break;
         }
     }
index 32a391c..d80b5aa 100644 (file)
@@ -3,7 +3,7 @@ Tests that a cross-origin iframe from a prevalent domain with recent user intera
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS Has storage access. document.cookie == , cookies seen server-side == "No cookies"
+PASS No storage access. document.cookie == , cookies seen server-side == "No cookies"
 PASS successfullyParsed is true
 
 TEST COMPLETE
index 510215a..e532d7b 100644 (file)
@@ -31,6 +31,6 @@
     </script>
 </head>
 <body>
-<iframe sandbox="allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals" id="theIframe" src="http://localhost:8000/storageAccess/resources/has-storage-access-iframe.html#policyShouldGrantAccess"></iframe>
+<iframe sandbox="allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals" id="theIframe" src="http://localhost:8000/storageAccess/resources/has-storage-access-iframe.html#policyShouldNotGrantAccess"></iframe>
 </body>
 </html>
\ No newline at end of file
index 409d36a..bc353f0 100644 (file)
@@ -1,3 +1,17 @@
+2018-06-07  Brent Fulgham  <bfulgham@apple.com>
+
+        Remove unused debug mode conditions
+        https://bugs.webkit.org/show_bug.cgi?id=186358
+        <rdar://problem/39117121>
+
+        Reviewed by Zalan Bujtas.
+
+        Remove some unused code paths related to ResourceLoadStatistics debug mode.
+
+        * UIProcess/WebResourceLoadStatisticsStore.cpp:
+        (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
+        (WebKit::WebResourceLoadStatisticsStore::shouldPartitionCookies const):
+
 2018-06-07  Dan Bernstein  <mitz@apple.com>
 
         REGRESSION (r232520): Crash under IPC::ArgumentCoder<WebCore::Credential>::encodePlatformData
index 3e78315..5382a55 100644 (file)
@@ -556,12 +556,8 @@ void WebResourceLoadStatisticsStore::logUserInteraction(const URL& url)
         statistics.hadUserInteraction = true;
         statistics.mostRecentUserInteractionTime = WallTime::now();
 
-        if (m_debugModeEnabled) {
-            if (statistics.isMarkedForCookieBlocking)
-                updateCookiePartitioningForDomains({ primaryDomain }, { }, { }, ShouldClearFirst::No, []() { });
-        } else
-            if (statistics.isMarkedForCookiePartitioning || statistics.isMarkedForCookieBlocking)
-                updateCookiePartitioningForDomains({ }, { }, { primaryDomain }, ShouldClearFirst::No, []() { });
+        if (statistics.isMarkedForCookieBlocking)
+            updateCookiePartitioningForDomains({ primaryDomain }, { }, { }, ShouldClearFirst::No, []() { });
     });
 }
 
@@ -1057,10 +1053,7 @@ void WebResourceLoadStatisticsStore::mergeStatistics(Vector<ResourceLoadStatisti
 
 bool WebResourceLoadStatisticsStore::shouldPartitionCookies(const ResourceLoadStatistics& statistic) const
 {
-    if (m_debugModeEnabled)
-        return statistic.isPrevalentResource && statistic.hadUserInteraction;
-
-    return statistic.isPrevalentResource && statistic.hadUserInteraction && WallTime::now() > statistic.mostRecentUserInteractionTime + m_parameters.timeToLiveCookiePartitionFree;
+    return statistic.isPrevalentResource && statistic.hadUserInteraction;
 }
 
 bool WebResourceLoadStatisticsStore::shouldBlockCookies(const ResourceLoadStatistics& statistic) const