Title: [251350] branches/safari-608-branch
Revision
251350
Author
bshaf...@apple.com
Date
2019-10-20 10:33:43 -0700 (Sun, 20 Oct 2019)

Log Message

Cherry-pick r250589. rdar://problem/55927251

    Storage Access API: document.hasStorageAccess() should return true when the cookie policy allows access
    https://bugs.webkit.org/show_bug.cgi?id=202435
    <rdar://problem/55718526>

    Reviewed by Brent Fulgham.

    Source/WebCore:

    WebKit's Storage Access API implementation has so far only looked at whether ITP is
    blocking cookie access or not. However, the default cookie policy is still in
    effect underneath ITP. document.hasStorageAccess() should return true if the
    third-party:
    a) is not classified by ITP, and
    b) has cookies which implies it can use cookies as third-party according to the
    default cookie policy.

    Tests: http/tests/storageAccess/has-storage-access-false-by-default-ephemeral.html
           http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral.html
           http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies.html

    * platform/network/NetworkStorageSession.h:
    * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
    (WebCore::NetworkStorageSession::hasCookies const):
    * platform/network/curl/NetworkStorageSessionCurl.cpp:
    (WebCore::NetworkStorageSession::hasCookies const):
        Not yet implemented. Always says false.
    * platform/network/soup/NetworkStorageSessionSoup.cpp:
    (WebCore::NetworkStorageSession::hasCookies const):
        Not yet implemented. Always says false.

    Source/WebKit:

    WebKit's Storage Access API implementation has so far only looked at whether ITP is
    blocking cookie access or not. However, the default cookie policy is still in
    effect underneath ITP. document.hasStorageAccess() should return true if the
    third-party:
    a) is not classified by ITP, and
    b) has cookies which implies it can use cookies as third-party according to the
    default cookie policy.

    * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
    (WebKit::ResourceLoadStatisticsMemoryStore::hasStorageAccess):
    * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
    (WebKit::WebResourceLoadStatisticsStore::hasCookies):
    * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
    * NetworkProcess/NetworkConnectionToWebProcess.cpp:
    (WebKit::NetworkConnectionToWebProcess::hasStorageAccess):
    * NetworkProcess/NetworkProcess.cpp:
    (WebKit::NetworkProcess::registrableDomainsWithWebsiteData):

    Tools:

    This change makes sure topPrivatelyControlledDomain() correctly handles domains
    with leading dots, as often used in cookie domains.

    * TestWebKitAPI/Tests/WebCore/PublicSuffix.cpp:
    (TestWebKitAPI::TEST_F):

    LayoutTests:

    WebKit's Storage Access API implementation has so far only looked at whether ITP is
    blocking cookie access or not. However, the default cookie policy is still in
    effect underneath ITP. document.hasStorageAccess() should return true if the
    third-party:
    a) is not classified by ITP, and
    b) has cookies which implies it can use cookies as third-party according to the
    default cookie policy.

    * http/tests/storageAccess/has-storage-access-false-by-default-ephemeral-expected.txt: Added.
    * http/tests/storageAccess/has-storage-access-false-by-default-ephemeral.html: Copied from LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html.
    * http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral-expected.txt: Added.
    * http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral.html: Copied from LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html.
    * http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-expected.txt: Added.
    * http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies.html: Renamed from LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html.
    * platform/ios/TestExpectations:
    * platform/mac-wk2/TestExpectations:

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

Modified Paths

Added Paths

Removed Paths

Diff

Modified: branches/safari-608-branch/LayoutTests/ChangeLog (251349 => 251350)


--- branches/safari-608-branch/LayoutTests/ChangeLog	2019-10-20 17:33:37 UTC (rev 251349)
+++ branches/safari-608-branch/LayoutTests/ChangeLog	2019-10-20 17:33:43 UTC (rev 251350)
@@ -1,3 +1,111 @@
+2019-10-17  Alan Coon  <alanc...@apple.com>
+
+        Cherry-pick r250589. rdar://problem/55927251
+
+    Storage Access API: document.hasStorageAccess() should return true when the cookie policy allows access
+    https://bugs.webkit.org/show_bug.cgi?id=202435
+    <rdar://problem/55718526>
+    
+    Reviewed by Brent Fulgham.
+    
+    Source/WebCore:
+    
+    WebKit's Storage Access API implementation has so far only looked at whether ITP is
+    blocking cookie access or not. However, the default cookie policy is still in
+    effect underneath ITP. document.hasStorageAccess() should return true if the
+    third-party:
+    a) is not classified by ITP, and
+    b) has cookies which implies it can use cookies as third-party according to the
+    default cookie policy.
+    
+    Tests: http/tests/storageAccess/has-storage-access-false-by-default-ephemeral.html
+           http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral.html
+           http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies.html
+    
+    * platform/network/NetworkStorageSession.h:
+    * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
+    (WebCore::NetworkStorageSession::hasCookies const):
+    * platform/network/curl/NetworkStorageSessionCurl.cpp:
+    (WebCore::NetworkStorageSession::hasCookies const):
+        Not yet implemented. Always says false.
+    * platform/network/soup/NetworkStorageSessionSoup.cpp:
+    (WebCore::NetworkStorageSession::hasCookies const):
+        Not yet implemented. Always says false.
+    
+    Source/WebKit:
+    
+    WebKit's Storage Access API implementation has so far only looked at whether ITP is
+    blocking cookie access or not. However, the default cookie policy is still in
+    effect underneath ITP. document.hasStorageAccess() should return true if the
+    third-party:
+    a) is not classified by ITP, and
+    b) has cookies which implies it can use cookies as third-party according to the
+    default cookie policy.
+    
+    * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
+    (WebKit::ResourceLoadStatisticsMemoryStore::hasStorageAccess):
+    * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
+    (WebKit::WebResourceLoadStatisticsStore::hasCookies):
+    * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
+    * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+    (WebKit::NetworkConnectionToWebProcess::hasStorageAccess):
+    * NetworkProcess/NetworkProcess.cpp:
+    (WebKit::NetworkProcess::registrableDomainsWithWebsiteData):
+    
+    Tools:
+    
+    This change makes sure topPrivatelyControlledDomain() correctly handles domains
+    with leading dots, as often used in cookie domains.
+    
+    * TestWebKitAPI/Tests/WebCore/PublicSuffix.cpp:
+    (TestWebKitAPI::TEST_F):
+    
+    LayoutTests:
+    
+    WebKit's Storage Access API implementation has so far only looked at whether ITP is
+    blocking cookie access or not. However, the default cookie policy is still in
+    effect underneath ITP. document.hasStorageAccess() should return true if the
+    third-party:
+    a) is not classified by ITP, and
+    b) has cookies which implies it can use cookies as third-party according to the
+    default cookie policy.
+    
+    * http/tests/storageAccess/has-storage-access-false-by-default-ephemeral-expected.txt: Added.
+    * http/tests/storageAccess/has-storage-access-false-by-default-ephemeral.html: Copied from LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html.
+    * http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral-expected.txt: Added.
+    * http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral.html: Copied from LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html.
+    * http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-expected.txt: Added.
+    * http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies.html: Renamed from LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html.
+    * platform/ios/TestExpectations:
+    * platform/mac-wk2/TestExpectations:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250589 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-10-01  John Wilander  <wilan...@apple.com>
+
+            Storage Access API: document.hasStorageAccess() should return true when the cookie policy allows access
+            https://bugs.webkit.org/show_bug.cgi?id=202435
+            <rdar://problem/55718526>
+
+            Reviewed by Brent Fulgham.
+
+            WebKit's Storage Access API implementation has so far only looked at whether ITP is
+            blocking cookie access or not. However, the default cookie policy is still in
+            effect underneath ITP. document.hasStorageAccess() should return true if the
+            third-party:
+            a) is not classified by ITP, and
+            b) has cookies which implies it can use cookies as third-party according to the
+            default cookie policy.
+
+            * http/tests/storageAccess/has-storage-access-false-by-default-ephemeral-expected.txt: Added.
+            * http/tests/storageAccess/has-storage-access-false-by-default-ephemeral.html: Copied from LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html.
+            * http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral-expected.txt: Added.
+            * http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral.html: Copied from LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html.
+            * http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-expected.txt: Added.
+            * http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies.html: Renamed from LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html.
+            * platform/ios/TestExpectations:
+            * platform/mac-wk2/TestExpectations:
+
 2019-10-15  Kocsen Chung  <kocsen_ch...@apple.com>
 
         Cherry-pick r251086. rdar://problem/56237429

Added: branches/safari-608-branch/LayoutTests/http/tests/storageAccess/has-storage-access-false-by-default-ephemeral-expected.txt (0 => 251350)


--- branches/safari-608-branch/LayoutTests/http/tests/storageAccess/has-storage-access-false-by-default-ephemeral-expected.txt	                        (rev 0)
+++ branches/safari-608-branch/LayoutTests/http/tests/storageAccess/has-storage-access-false-by-default-ephemeral-expected.txt	2019-10-20 17:33:43 UTC (rev 251350)
@@ -0,0 +1,10 @@
+Tests that document.hasStorageAccess() returns false for a 3rd-party iframe by default (ephemeral session).
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS No storage access. document.cookie == , cookies seen server-side == "No cookies"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Copied: branches/safari-608-branch/LayoutTests/http/tests/storageAccess/has-storage-access-false-by-default-ephemeral.html (from rev 251349, branches/safari-608-branch/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html) (0 => 251350)


--- branches/safari-608-branch/LayoutTests/http/tests/storageAccess/has-storage-access-false-by-default-ephemeral.html	                        (rev 0)
+++ branches/safari-608-branch/LayoutTests/http/tests/storageAccess/has-storage-access-false-by-default-ephemeral.html	2019-10-20 17:33:43 UTC (rev 251350)
@@ -0,0 +1,36 @@
+<!-- webkit-test-runner [ useEphemeralSession=true ] -->
+<!DOCTYPE html>
+<html>
+<head>
+    <script src=""
+    <script src=""
+    <script>
+        description("Tests that document.hasStorageAccess() returns false for a 3rd-party iframe by default (ephemeral session).");
+        jsTestIsAsync = true;
+
+        window.addEventListener("message", receiveMessage, false);
+
+        function receiveMessage(event) {
+            if (event.origin === "http://localhost:8000") {
+                if (event.data.indexOf("PASS") !== -1)
+                    testPassed(event.data.replace("PASS ", ""));
+                else
+                    testFailed(event.data.replace("FAIL ", ""));
+            } else
+                testFailed("Received a message from an unexpected origin: " + event.origin);
+            finishJSTest();
+        }
+
+        const hostUnderTest = "localhost:8000";
+        const statisticsUrl = "http://" + hostUnderTest + "/temp";
+        function runTest() {
+            let iframeElement = document.createElement("iframe");
+            iframeElement.id = "TheIframeThatRequestsStorageAccess";
+            iframeElement.src = ""
+            document.body.appendChild(iframeElement);
+        }
+    </script>
+</head>
+<body _onload_="runTest()">
+</body>
+</html>

Deleted: branches/safari-608-branch/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html (251349 => 251350)


--- branches/safari-608-branch/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html	2019-10-20 17:33:37 UTC (rev 251349)
+++ branches/safari-608-branch/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html	2019-10-20 17:33:43 UTC (rev 251350)
@@ -1,41 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-    <script src=""
-    <script src=""
-    <script src=""
-    <script>
-        description("Tests that document.hasStorageAccess() returns true for a 3rd-party iframe if there is no way to request access (feature off).");
-        jsTestIsAsync = true;
-
-        if (window.testRunner)
-            testRunner.setPrivateBrowsingEnabled(true);
-
-        window.addEventListener("message", receiveMessage, false);
-
-        function receiveMessage(event) {
-            if (event.origin === "http://localhost:8000") {
-                if (event.data.indexOf("PASS") !== -1)
-                    testPassed(event.data.replace("PASS ", ""));
-                else
-                    testFailed(event.data.replace("FAIL ", ""));
-            } else
-                testFailed("Received a message from an unexpected origin: " + event.origin);
-            setEnableFeature(false, finishJSTest);
-        }
-
-        const hostUnderTest = "localhost:8000";
-        const statisticsUrl = "http://" + hostUnderTest + "/temp";
-        function runTest() {
-            setEnableFeature(false, function() {
-                let iframeElement = document.createElement("iframe");
-                iframeElement.id = "TheIframeThatRequestsStorageAccess";
-                iframeElement.src = ""
-                document.body.appendChild(iframeElement);
-            });
-        }
-    </script>
-</head>
-<body _onload_="runTest()">
-</body>
-</html>
\ No newline at end of file

Added: branches/safari-608-branch/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral-expected.txt (0 => 251350)


--- branches/safari-608-branch/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral-expected.txt	                        (rev 0)
+++ branches/safari-608-branch/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral-expected.txt	2019-10-20 17:33:43 UTC (rev 251350)
@@ -0,0 +1,10 @@
+Tests that document.hasStorageAccess() returns true for a 3rd-party iframe if the 3rd-party has cookies set.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Has storage access. document.cookie == firstPartyCookie=value, cookies seen server-side == {"firstPartyCookie":"value"}
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Copied: branches/safari-608-branch/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral.html (from rev 251349, branches/safari-608-branch/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html) (0 => 251350)


--- branches/safari-608-branch/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral.html	                        (rev 0)
+++ branches/safari-608-branch/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral.html	2019-10-20 17:33:43 UTC (rev 251350)
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <script src=""
+    <script src=""
+    <script>
+        description("Tests that document.hasStorageAccess() returns true for a 3rd-party iframe if the 3rd-party has cookies set (ephemeral session).");
+        jsTestIsAsync = true;
+
+        if (window.testRunner)
+            testRunner.setPrivateBrowsingEnabled(true);
+
+        window.addEventListener("message", receiveMessage, false);
+
+        function receiveMessage(event) {
+            if (event.origin === "http://localhost:8000") {
+                if (event.data.indexOf("PASS") !== -1)
+                    testPassed(event.data.replace("PASS ", ""));
+                else
+                    testFailed(event.data.replace("FAIL ", ""));
+            } else
+                testFailed("Received a message from an unexpected origin: " + event.origin);
+            finishJSTest();
+        }
+
+        const hostUnderTest = "localhost:8000";
+        const statisticsUrl = "http://" + hostUnderTest;
+        function runTest() {
+            if (document.location.hash !== "#firstPartyCookieSet") {
+                document.location.href = "" + "/storageAccess/resources/set-cookie.php?name=firstPartyCookie&value=value#http://127.0.0.1:8000/storageAccess/has-storage-access-true-if-third-party-has-cookies.html#firstPartyCookieSet";
+            } else {
+                let iframeElement = document.createElement("iframe");
+                iframeElement.id = "TheIframeThatRequestsStorageAccess";
+                iframeElement.src = ""
+                document.body.appendChild(iframeElement);
+            }
+        }
+    </script>
+</head>
+<body _onload_="runTest()">
+</body>
+</html>
\ No newline at end of file

Added: branches/safari-608-branch/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-expected.txt (0 => 251350)


--- branches/safari-608-branch/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-expected.txt	                        (rev 0)
+++ branches/safari-608-branch/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-expected.txt	2019-10-20 17:33:43 UTC (rev 251350)
@@ -0,0 +1,10 @@
+Tests that document.hasStorageAccess() returns true for a 3rd-party iframe if the 3rd-party has cookies set.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Has storage access. document.cookie == firstPartyCookie=value, cookies seen server-side == {"firstPartyCookie":"value"}
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Copied: branches/safari-608-branch/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies.html (from rev 251349, branches/safari-608-branch/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html) (0 => 251350)


--- branches/safari-608-branch/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies.html	                        (rev 0)
+++ branches/safari-608-branch/LayoutTests/http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies.html	2019-10-20 17:33:43 UTC (rev 251350)
@@ -0,0 +1,42 @@
+<!-- webkit-test-runner [ useEphemeralSession=true ] -->
+<!DOCTYPE html>
+<html>
+<head>
+    <script src=""
+    <script src=""
+    <script>
+        description("Tests that document.hasStorageAccess() returns true for a 3rd-party iframe if the 3rd-party has cookies set.");
+        jsTestIsAsync = true;
+
+        window.addEventListener("message", receiveMessage, false);
+
+        function receiveMessage(event) {
+            if (event.origin === "http://localhost:8000") {
+                if (event.data.indexOf("PASS") !== -1)
+                    testPassed(event.data.replace("PASS ", ""));
+                else
+                    testFailed(event.data.replace("FAIL ", ""));
+            } else
+                testFailed("Received a message from an unexpected origin: " + event.origin);
+            setEnableFeature(false, finishJSTest);
+        }
+
+        const hostUnderTest = "localhost:8000";
+        const statisticsUrl = "http://" + hostUnderTest;
+        function runTest() {
+            if (document.location.hash !== "#firstPartyCookieSet") {
+                setEnableFeature(false, function() {
+                    document.location.href = "" + "/storageAccess/resources/set-cookie.php?name=firstPartyCookie&value=value#http://127.0.0.1:8000/storageAccess/has-storage-access-true-if-third-party-has-cookies.html#firstPartyCookieSet";
+                });
+            } else {
+                let iframeElement = document.createElement("iframe");
+                iframeElement.id = "TheIframeThatRequestsStorageAccess";
+                iframeElement.src = ""
+                document.body.appendChild(iframeElement);
+            }
+        }
+    </script>
+</head>
+<body _onload_="runTest()">
+</body>
+</html>

Modified: branches/safari-608-branch/LayoutTests/platform/ios/TestExpectations (251349 => 251350)


--- branches/safari-608-branch/LayoutTests/platform/ios/TestExpectations	2019-10-20 17:33:37 UTC (rev 251349)
+++ branches/safari-608-branch/LayoutTests/platform/ios/TestExpectations	2019-10-20 17:33:43 UTC (rev 251350)
@@ -2795,8 +2795,10 @@
 http/tests/storageAccess/deny-storage-access-under-opener-if-auto-dismiss.html [ Pass ]
 http/tests/resourceLoadStatistics/cap-cache-max-age-for-prevalent-resource.html [ Pass ]
 http/tests/storageAccess/has-storage-access-false-by-default.html [ Pass ]
+http/tests/storageAccess/has-storage-access-false-by-default-ephemeral.html [ Pass ]
+http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral.html [ Pass ]
+http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies.html [ Pass ]
 
-
 # Skipped in general expectations since they only work on iOS and Mac, WK2.
 http/tests/security/strip-referrer-to-origin-for-third-party-redirects-in-private-mode.html [ Pass ]
 http/tests/security/strip-referrer-to-origin-for-third-party-requests-in-private-mode.html [ Pass ]

Modified: branches/safari-608-branch/LayoutTests/platform/mac-wk2/TestExpectations (251349 => 251350)


--- branches/safari-608-branch/LayoutTests/platform/mac-wk2/TestExpectations	2019-10-20 17:33:37 UTC (rev 251349)
+++ branches/safari-608-branch/LayoutTests/platform/mac-wk2/TestExpectations	2019-10-20 17:33:43 UTC (rev 251350)
@@ -732,8 +732,10 @@
 [ HighSierra+ ] http/tests/storageAccess/grant-with-prompt-preserves-gesture.html [ Pass ]
 [ HighSierra+ ] http/tests/storageAccess/deny-with-prompt-does-not-preserve-gesture.html [ Skip ]
 [ HighSierra+ ] http/tests/storageAccess/deny-without-prompt-preserves-gesture.html [ Pass ]
-[ HighSierra+ ] http/tests/storageAccess/has-storage-access-true-if-feature-off.html [ Pass ]
 [ HighSierra+ ] http/tests/storageAccess/has-storage-access-false-by-default.html [ Pass ]
+[ HighSierra+ ] http/tests/storageAccess/has-storage-access-false-by-default-ephemeral.html [ Pass ]
+[ HighSierra+ ] http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral.html [ Pass ]
+[ HighSierra+ ] http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies.html [ Pass ]
 
 # As of https://trac.webkit.org/changeset/227762 the timestampResolution is just 5 seconds which makes this test flaky
 http/tests/resourceLoadStatistics/user-interaction-only-reported-once-within-short-period-of-time.html [ Skip ]

Modified: branches/safari-608-branch/Source/WebCore/ChangeLog (251349 => 251350)


--- branches/safari-608-branch/Source/WebCore/ChangeLog	2019-10-20 17:33:37 UTC (rev 251349)
+++ branches/safari-608-branch/Source/WebCore/ChangeLog	2019-10-20 17:33:43 UTC (rev 251350)
@@ -1,3 +1,116 @@
+2019-10-17  Alan Coon  <alanc...@apple.com>
+
+        Cherry-pick r250589. rdar://problem/55927251
+
+    Storage Access API: document.hasStorageAccess() should return true when the cookie policy allows access
+    https://bugs.webkit.org/show_bug.cgi?id=202435
+    <rdar://problem/55718526>
+    
+    Reviewed by Brent Fulgham.
+    
+    Source/WebCore:
+    
+    WebKit's Storage Access API implementation has so far only looked at whether ITP is
+    blocking cookie access or not. However, the default cookie policy is still in
+    effect underneath ITP. document.hasStorageAccess() should return true if the
+    third-party:
+    a) is not classified by ITP, and
+    b) has cookies which implies it can use cookies as third-party according to the
+    default cookie policy.
+    
+    Tests: http/tests/storageAccess/has-storage-access-false-by-default-ephemeral.html
+           http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral.html
+           http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies.html
+    
+    * platform/network/NetworkStorageSession.h:
+    * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
+    (WebCore::NetworkStorageSession::hasCookies const):
+    * platform/network/curl/NetworkStorageSessionCurl.cpp:
+    (WebCore::NetworkStorageSession::hasCookies const):
+        Not yet implemented. Always says false.
+    * platform/network/soup/NetworkStorageSessionSoup.cpp:
+    (WebCore::NetworkStorageSession::hasCookies const):
+        Not yet implemented. Always says false.
+    
+    Source/WebKit:
+    
+    WebKit's Storage Access API implementation has so far only looked at whether ITP is
+    blocking cookie access or not. However, the default cookie policy is still in
+    effect underneath ITP. document.hasStorageAccess() should return true if the
+    third-party:
+    a) is not classified by ITP, and
+    b) has cookies which implies it can use cookies as third-party according to the
+    default cookie policy.
+    
+    * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
+    (WebKit::ResourceLoadStatisticsMemoryStore::hasStorageAccess):
+    * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
+    (WebKit::WebResourceLoadStatisticsStore::hasCookies):
+    * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
+    * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+    (WebKit::NetworkConnectionToWebProcess::hasStorageAccess):
+    * NetworkProcess/NetworkProcess.cpp:
+    (WebKit::NetworkProcess::registrableDomainsWithWebsiteData):
+    
+    Tools:
+    
+    This change makes sure topPrivatelyControlledDomain() correctly handles domains
+    with leading dots, as often used in cookie domains.
+    
+    * TestWebKitAPI/Tests/WebCore/PublicSuffix.cpp:
+    (TestWebKitAPI::TEST_F):
+    
+    LayoutTests:
+    
+    WebKit's Storage Access API implementation has so far only looked at whether ITP is
+    blocking cookie access or not. However, the default cookie policy is still in
+    effect underneath ITP. document.hasStorageAccess() should return true if the
+    third-party:
+    a) is not classified by ITP, and
+    b) has cookies which implies it can use cookies as third-party according to the
+    default cookie policy.
+    
+    * http/tests/storageAccess/has-storage-access-false-by-default-ephemeral-expected.txt: Added.
+    * http/tests/storageAccess/has-storage-access-false-by-default-ephemeral.html: Copied from LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html.
+    * http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral-expected.txt: Added.
+    * http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral.html: Copied from LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html.
+    * http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-expected.txt: Added.
+    * http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies.html: Renamed from LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html.
+    * platform/ios/TestExpectations:
+    * platform/mac-wk2/TestExpectations:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250589 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-10-01  John Wilander  <wilan...@apple.com>
+
+            Storage Access API: document.hasStorageAccess() should return true when the cookie policy allows access
+            https://bugs.webkit.org/show_bug.cgi?id=202435
+            <rdar://problem/55718526>
+
+            Reviewed by Brent Fulgham.
+
+            WebKit's Storage Access API implementation has so far only looked at whether ITP is
+            blocking cookie access or not. However, the default cookie policy is still in
+            effect underneath ITP. document.hasStorageAccess() should return true if the
+            third-party:
+            a) is not classified by ITP, and
+            b) has cookies which implies it can use cookies as third-party according to the
+            default cookie policy.
+
+            Tests: http/tests/storageAccess/has-storage-access-false-by-default-ephemeral.html
+                   http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral.html
+                   http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies.html
+
+            * platform/network/NetworkStorageSession.h:
+            * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
+            (WebCore::NetworkStorageSession::hasCookies const):
+            * platform/network/curl/NetworkStorageSessionCurl.cpp:
+            (WebCore::NetworkStorageSession::hasCookies const):
+                Not yet implemented. Always says false.
+            * platform/network/soup/NetworkStorageSessionSoup.cpp:
+            (WebCore::NetworkStorageSession::hasCookies const):
+                Not yet implemented. Always says false.
+
 2019-10-15  Kocsen Chung  <kocsen_ch...@apple.com>
 
         Cherry-pick r250887. rdar://problem/56061121

Modified: branches/safari-608-branch/Source/WebCore/platform/network/NetworkStorageSession.h (251349 => 251350)


--- branches/safari-608-branch/Source/WebCore/platform/network/NetworkStorageSession.h	2019-10-20 17:33:37 UTC (rev 251349)
+++ branches/safari-608-branch/Source/WebCore/platform/network/NetworkStorageSession.h	2019-10-20 17:33:43 UTC (rev 251350)
@@ -29,6 +29,7 @@
 #include "PageIdentifier.h"
 #include "RegistrableDomain.h"
 #include <pal/SessionID.h>
+#include <wtf/CompletionHandler.h>
 #include <wtf/Function.h>
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
@@ -135,6 +136,7 @@
     WEBCORE_EXPORT void deleteCookiesForHostnames(const Vector<String>& cookieHostNames, IncludeHttpOnlyCookies);
     WEBCORE_EXPORT Vector<Cookie> getAllCookies();
     WEBCORE_EXPORT Vector<Cookie> getCookies(const URL&);
+    WEBCORE_EXPORT void hasCookies(const RegistrableDomain&, CompletionHandler<void(bool)>&&) const;
     WEBCORE_EXPORT bool getRawCookies(const URL& firstParty, const SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<PageIdentifier>, Vector<Cookie>&) const;
     WEBCORE_EXPORT void flushCookieStore();
     WEBCORE_EXPORT void getHostnamesWithCookies(HashSet<String>& hostnames);

Modified: branches/safari-608-branch/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm (251349 => 251350)


--- branches/safari-608-branch/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm	2019-10-20 17:33:37 UTC (rev 251349)
+++ branches/safari-608-branch/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm	2019-10-20 17:33:43 UTC (rev 251350)
@@ -102,6 +102,20 @@
     return nsCookiesToCookieVector([nsCookieStorage() cookiesForURL:(NSURL *)url]);
 }
 
+void NetworkStorageSession::hasCookies(const RegistrableDomain& domain, CompletionHandler<void(bool)>&& completionHandler) const
+{
+    ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies));
+    
+    for (NSHTTPCookie *nsCookie in nsCookieStorage().cookies) {
+        if (RegistrableDomain::uncheckedCreateFromHost(nsCookie.domain) == domain) {
+            completionHandler(true);
+            return;
+        }
+    }
+
+    completionHandler(false);
+}
+
 void NetworkStorageSession::flushCookieStore()
 {
     ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies));

Modified: branches/safari-608-branch/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp (251349 => 251350)


--- branches/safari-608-branch/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp	2019-10-20 17:33:37 UTC (rev 251349)
+++ branches/safari-608-branch/Source/WebCore/platform/network/curl/NetworkStorageSessionCurl.cpp	2019-10-20 17:33:43 UTC (rev 251350)
@@ -154,6 +154,12 @@
     return { };
 }
 
+void NetworkStorageSession::hasCookies(const RegistrableDomain&, CompletionHandler<void(bool)>&& completionHandler) const
+{
+    // FIXME: Implement.
+    completionHandler(false);
+}
+
 bool NetworkStorageSession::getRawCookies(const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<PageIdentifier> pageID, Vector<Cookie>& rawCookies) const
 {
     return cookieStorage().getRawCookies(*this, firstParty, sameSiteInfo, url, frameID, pageID, rawCookies);

Modified: branches/safari-608-branch/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp (251349 => 251350)


--- branches/safari-608-branch/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp	2019-10-20 17:33:37 UTC (rev 251349)
+++ branches/safari-608-branch/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp	2019-10-20 17:33:43 UTC (rev 251350)
@@ -444,6 +444,12 @@
     return cookies;
 }
 
+void NetworkStorageSession::hasCookies(const RegistrableDomain&, CompletionHandler<void(bool)>&& completionHandler) const
+{
+    // FIXME: Implement.
+    completionHandler(false);
+}
+
 bool NetworkStorageSession::getRawCookies(const URL& firstParty, const SameSiteInfo&, const URL& url, Optional<uint64_t> frameID, Optional<PageIdentifier> pageID, Vector<Cookie>& rawCookies) const
 {
     UNUSED_PARAM(firstParty);

Modified: branches/safari-608-branch/Source/WebKit/ChangeLog (251349 => 251350)


--- branches/safari-608-branch/Source/WebKit/ChangeLog	2019-10-20 17:33:37 UTC (rev 251349)
+++ branches/safari-608-branch/Source/WebKit/ChangeLog	2019-10-20 17:33:43 UTC (rev 251350)
@@ -1,3 +1,112 @@
+2019-10-17  Alan Coon  <alanc...@apple.com>
+
+        Cherry-pick r250589. rdar://problem/55927251
+
+    Storage Access API: document.hasStorageAccess() should return true when the cookie policy allows access
+    https://bugs.webkit.org/show_bug.cgi?id=202435
+    <rdar://problem/55718526>
+    
+    Reviewed by Brent Fulgham.
+    
+    Source/WebCore:
+    
+    WebKit's Storage Access API implementation has so far only looked at whether ITP is
+    blocking cookie access or not. However, the default cookie policy is still in
+    effect underneath ITP. document.hasStorageAccess() should return true if the
+    third-party:
+    a) is not classified by ITP, and
+    b) has cookies which implies it can use cookies as third-party according to the
+    default cookie policy.
+    
+    Tests: http/tests/storageAccess/has-storage-access-false-by-default-ephemeral.html
+           http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral.html
+           http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies.html
+    
+    * platform/network/NetworkStorageSession.h:
+    * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
+    (WebCore::NetworkStorageSession::hasCookies const):
+    * platform/network/curl/NetworkStorageSessionCurl.cpp:
+    (WebCore::NetworkStorageSession::hasCookies const):
+        Not yet implemented. Always says false.
+    * platform/network/soup/NetworkStorageSessionSoup.cpp:
+    (WebCore::NetworkStorageSession::hasCookies const):
+        Not yet implemented. Always says false.
+    
+    Source/WebKit:
+    
+    WebKit's Storage Access API implementation has so far only looked at whether ITP is
+    blocking cookie access or not. However, the default cookie policy is still in
+    effect underneath ITP. document.hasStorageAccess() should return true if the
+    third-party:
+    a) is not classified by ITP, and
+    b) has cookies which implies it can use cookies as third-party according to the
+    default cookie policy.
+    
+    * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
+    (WebKit::ResourceLoadStatisticsMemoryStore::hasStorageAccess):
+    * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
+    (WebKit::WebResourceLoadStatisticsStore::hasCookies):
+    * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
+    * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+    (WebKit::NetworkConnectionToWebProcess::hasStorageAccess):
+    * NetworkProcess/NetworkProcess.cpp:
+    (WebKit::NetworkProcess::registrableDomainsWithWebsiteData):
+    
+    Tools:
+    
+    This change makes sure topPrivatelyControlledDomain() correctly handles domains
+    with leading dots, as often used in cookie domains.
+    
+    * TestWebKitAPI/Tests/WebCore/PublicSuffix.cpp:
+    (TestWebKitAPI::TEST_F):
+    
+    LayoutTests:
+    
+    WebKit's Storage Access API implementation has so far only looked at whether ITP is
+    blocking cookie access or not. However, the default cookie policy is still in
+    effect underneath ITP. document.hasStorageAccess() should return true if the
+    third-party:
+    a) is not classified by ITP, and
+    b) has cookies which implies it can use cookies as third-party according to the
+    default cookie policy.
+    
+    * http/tests/storageAccess/has-storage-access-false-by-default-ephemeral-expected.txt: Added.
+    * http/tests/storageAccess/has-storage-access-false-by-default-ephemeral.html: Copied from LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html.
+    * http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral-expected.txt: Added.
+    * http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral.html: Copied from LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html.
+    * http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-expected.txt: Added.
+    * http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies.html: Renamed from LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html.
+    * platform/ios/TestExpectations:
+    * platform/mac-wk2/TestExpectations:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250589 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-10-01  John Wilander  <wilan...@apple.com>
+
+            Storage Access API: document.hasStorageAccess() should return true when the cookie policy allows access
+            https://bugs.webkit.org/show_bug.cgi?id=202435
+            <rdar://problem/55718526>
+
+            Reviewed by Brent Fulgham.
+
+            WebKit's Storage Access API implementation has so far only looked at whether ITP is
+            blocking cookie access or not. However, the default cookie policy is still in
+            effect underneath ITP. document.hasStorageAccess() should return true if the
+            third-party:
+            a) is not classified by ITP, and
+            b) has cookies which implies it can use cookies as third-party according to the
+            default cookie policy.
+
+            * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
+            (WebKit::ResourceLoadStatisticsMemoryStore::hasStorageAccess):
+            * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
+            (WebKit::WebResourceLoadStatisticsStore::hasCookies):
+            * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
+            * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+            (WebKit::NetworkConnectionToWebProcess::hasStorageAccess):
+            * NetworkProcess/NetworkProcess.cpp:
+            (WebKit::NetworkProcess::registrableDomainsWithWebsiteData):
+
 2019-10-15  Kocsen Chung  <kocsen_ch...@apple.com>
 
         Cherry-pick r251086. rdar://problem/56237429

Modified: branches/safari-608-branch/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp (251349 => 251350)


--- branches/safari-608-branch/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp	2019-10-20 17:33:37 UTC (rev 251349)
+++ branches/safari-608-branch/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp	2019-10-20 17:33:43 UTC (rev 251350)
@@ -205,11 +205,22 @@
 
     auto& subFrameStatistic = ensureResourceStatisticsForRegistrableDomain(subFrameDomain);
     // Return false if this domain cannot ask for storage access.
-    if (shouldBlockAndPurgeCookies(subFrameStatistic) || !shouldBlockAndKeepCookies(subFrameStatistic)) {
+    if (shouldBlockAndPurgeCookies(subFrameStatistic)) {
         completionHandler(false);
         return;
     }
 
+    if (!shouldBlockAndKeepCookies(subFrameStatistic)) {
+        RunLoop::main().dispatch([store = makeRef(store()), subFrameDomain = subFrameDomain.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable {
+            store->hasCookies(subFrameDomain, [store = store.copyRef(), completionHandler = WTFMove(completionHandler)](bool result) mutable {
+                store->statisticsQueue().dispatch([completionHandler = WTFMove(completionHandler), result] () mutable {
+                    completionHandler(result);
+                });
+            });
+        });
+        return;
+    }
+
     RunLoop::main().dispatch([store = makeRef(store()), subFrameDomain = subFrameDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), frameID, pageID, completionHandler = WTFMove(completionHandler)]() mutable {
         store->callHasStorageAccessForFrameHandler(subFrameDomain, topFrameDomain, frameID.value(), pageID, [store = store.copyRef(), completionHandler = WTFMove(completionHandler)](bool result) mutable {
             store->statisticsQueue().dispatch([completionHandler = WTFMove(completionHandler), result] () mutable {

Modified: branches/safari-608-branch/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp (251349 => 251350)


--- branches/safari-608-branch/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp	2019-10-20 17:33:37 UTC (rev 251349)
+++ branches/safari-608-branch/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp	2019-10-20 17:33:43 UTC (rev 251350)
@@ -430,6 +430,20 @@
     completionHandler(grantStorageAccess(subFrameDomain, topFrameDomain, frameID, pageID));
 }
 
+void WebResourceLoadStatisticsStore::hasCookies(const RegistrableDomain& domain, CompletionHandler<void(bool)>&& completionHandler)
+{
+    ASSERT(RunLoop::isMain());
+
+    if (m_networkSession) {
+        if (auto* storageSession = m_networkSession->networkStorageSession()) {
+            storageSession->hasCookies(domain, WTFMove(completionHandler));
+            return;
+        }
+    }
+    
+    completionHandler(false);
+}
+
 void WebResourceLoadStatisticsStore::didCreateNetworkProcess()
 {
     ASSERT(RunLoop::isMain());

Modified: branches/safari-608-branch/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h (251349 => 251350)


--- branches/safari-608-branch/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h	2019-10-20 17:33:37 UTC (rev 251349)
+++ branches/safari-608-branch/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h	2019-10-20 17:33:43 UTC (rev 251350)
@@ -172,6 +172,8 @@
     void callRemoveDomainsHandler(const Vector<RegistrableDomain>&);
     void callHasStorageAccessForFrameHandler(const SubFrameDomain&, const TopFrameDomain&, FrameID, WebCore::PageIdentifier, CompletionHandler<void(bool)>&&);
 
+    void hasCookies(const RegistrableDomain&, CompletionHandler<void(bool)>&&);
+
     void didCreateNetworkProcess();
 
     void notifyResourceLoadStatisticsProcessed();

Modified: branches/safari-608-branch/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp (251349 => 251350)


--- branches/safari-608-branch/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp	2019-10-20 17:33:37 UTC (rev 251349)
+++ branches/safari-608-branch/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp	2019-10-20 17:33:43 UTC (rev 251350)
@@ -710,10 +710,13 @@
         if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics()) {
             resourceLoadStatistics->hasStorageAccess(subFrameDomain, topFrameDomain, frameID, pageID, WTFMove(completionHandler));
             return;
+        } else {
+            storageSession()->hasCookies(subFrameDomain, WTFMove(completionHandler));
+            return;
         }
     }
 
-    completionHandler(true);
+    completionHandler(false);
 }
 
 void NetworkConnectionToWebProcess::requestStorageAccess(PAL::SessionID sessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, PageIdentifier pageID, CompletionHandler<void(WebCore::StorageAccessWasGranted wasGranted, WebCore::StorageAccessPromptWasShown promptWasShown)>&& completionHandler)

Modified: branches/safari-608-branch/Source/WebKit/NetworkProcess/NetworkProcess.cpp (251349 => 251350)


--- branches/safari-608-branch/Source/WebKit/NetworkProcess/NetworkProcess.cpp	2019-10-20 17:33:37 UTC (rev 251349)
+++ branches/safari-608-branch/Source/WebKit/NetworkProcess/NetworkProcess.cpp	2019-10-20 17:33:43 UTC (rev 251350)
@@ -1834,13 +1834,11 @@
     
     auto& websiteDataStore = callbackAggregator->m_websiteData;
     
-    Vector<String> hostnamesWithCookiesToDelete;
     if (websiteDataTypes.contains(WebsiteDataType::Cookies)) {
         if (auto* networkStorageSession = storageSession(sessionID))
             networkStorageSession->getHostnamesWithCookies(websiteDataStore.hostNamesWithCookies);
     }
     
-    Vector<String> hostnamesWithHSTSToDelete;
 #if PLATFORM(COCOA)
     if (websiteDataTypes.contains(WebsiteDataType::HSTSCache)) {
         if (auto* networkStorageSession = storageSession(sessionID))

Modified: branches/safari-608-branch/Tools/ChangeLog (251349 => 251350)


--- branches/safari-608-branch/Tools/ChangeLog	2019-10-20 17:33:37 UTC (rev 251349)
+++ branches/safari-608-branch/Tools/ChangeLog	2019-10-20 17:33:43 UTC (rev 251350)
@@ -1,3 +1,100 @@
+2019-10-17  Alan Coon  <alanc...@apple.com>
+
+        Cherry-pick r250589. rdar://problem/55927251
+
+    Storage Access API: document.hasStorageAccess() should return true when the cookie policy allows access
+    https://bugs.webkit.org/show_bug.cgi?id=202435
+    <rdar://problem/55718526>
+    
+    Reviewed by Brent Fulgham.
+    
+    Source/WebCore:
+    
+    WebKit's Storage Access API implementation has so far only looked at whether ITP is
+    blocking cookie access or not. However, the default cookie policy is still in
+    effect underneath ITP. document.hasStorageAccess() should return true if the
+    third-party:
+    a) is not classified by ITP, and
+    b) has cookies which implies it can use cookies as third-party according to the
+    default cookie policy.
+    
+    Tests: http/tests/storageAccess/has-storage-access-false-by-default-ephemeral.html
+           http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral.html
+           http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies.html
+    
+    * platform/network/NetworkStorageSession.h:
+    * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
+    (WebCore::NetworkStorageSession::hasCookies const):
+    * platform/network/curl/NetworkStorageSessionCurl.cpp:
+    (WebCore::NetworkStorageSession::hasCookies const):
+        Not yet implemented. Always says false.
+    * platform/network/soup/NetworkStorageSessionSoup.cpp:
+    (WebCore::NetworkStorageSession::hasCookies const):
+        Not yet implemented. Always says false.
+    
+    Source/WebKit:
+    
+    WebKit's Storage Access API implementation has so far only looked at whether ITP is
+    blocking cookie access or not. However, the default cookie policy is still in
+    effect underneath ITP. document.hasStorageAccess() should return true if the
+    third-party:
+    a) is not classified by ITP, and
+    b) has cookies which implies it can use cookies as third-party according to the
+    default cookie policy.
+    
+    * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
+    (WebKit::ResourceLoadStatisticsMemoryStore::hasStorageAccess):
+    * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
+    (WebKit::WebResourceLoadStatisticsStore::hasCookies):
+    * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
+    * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+    (WebKit::NetworkConnectionToWebProcess::hasStorageAccess):
+    * NetworkProcess/NetworkProcess.cpp:
+    (WebKit::NetworkProcess::registrableDomainsWithWebsiteData):
+    
+    Tools:
+    
+    This change makes sure topPrivatelyControlledDomain() correctly handles domains
+    with leading dots, as often used in cookie domains.
+    
+    * TestWebKitAPI/Tests/WebCore/PublicSuffix.cpp:
+    (TestWebKitAPI::TEST_F):
+    
+    LayoutTests:
+    
+    WebKit's Storage Access API implementation has so far only looked at whether ITP is
+    blocking cookie access or not. However, the default cookie policy is still in
+    effect underneath ITP. document.hasStorageAccess() should return true if the
+    third-party:
+    a) is not classified by ITP, and
+    b) has cookies which implies it can use cookies as third-party according to the
+    default cookie policy.
+    
+    * http/tests/storageAccess/has-storage-access-false-by-default-ephemeral-expected.txt: Added.
+    * http/tests/storageAccess/has-storage-access-false-by-default-ephemeral.html: Copied from LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html.
+    * http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral-expected.txt: Added.
+    * http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-ephemeral.html: Copied from LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html.
+    * http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies-expected.txt: Added.
+    * http/tests/storageAccess/has-storage-access-true-if-third-party-has-cookies.html: Renamed from LayoutTests/http/tests/storageAccess/has-storage-access-true-if-feature-off.html.
+    * platform/ios/TestExpectations:
+    * platform/mac-wk2/TestExpectations:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250589 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-10-01  John Wilander  <wilan...@apple.com>
+
+            Storage Access API: document.hasStorageAccess() should return true when the cookie policy allows access
+            https://bugs.webkit.org/show_bug.cgi?id=202435
+            <rdar://problem/55718526>
+
+            Reviewed by Brent Fulgham.
+
+            This change makes sure topPrivatelyControlledDomain() correctly handles domains
+            with leading dots, as often used in cookie domains.
+
+            * TestWebKitAPI/Tests/WebCore/PublicSuffix.cpp:
+            (TestWebKitAPI::TEST_F):
+
 2019-10-15  Kocsen Chung  <kocsen_ch...@apple.com>
 
         Cherry-pick r250887. rdar://problem/56061121

Modified: branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebCore/PublicSuffix.cpp (251349 => 251350)


--- branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebCore/PublicSuffix.cpp	2019-10-20 17:33:37 UTC (rev 251349)
+++ branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebCore/PublicSuffix.cpp	2019-10-20 17:33:43 UTC (rev 251350)
@@ -179,6 +179,7 @@
     EXPECT_EQ(String("localhost"), topPrivatelyControlledDomain("LocalHost"));
     EXPECT_EQ(String("åäö"), topPrivatelyControlledDomain("åäö"));
     EXPECT_EQ(String("ÅÄÖ"), topPrivatelyControlledDomain("ÅÄÖ"));
+    EXPECT_EQ(String("test.com"), topPrivatelyControlledDomain(".test.com"));
 }
 
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to