Storage Access API: Maintain access through same-site navigations
authorwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 31 Aug 2018 21:09:36 +0000 (21:09 +0000)
committerwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 31 Aug 2018 21:09:36 +0000 (21:09 +0000)
https://bugs.webkit.org/show_bug.cgi?id=188564
<rdar://problem/43445160>

Reviewed by Alex Christensen.

Source/WebCore:

Tests: http/tests/storageAccess/request-and-grant-access-then-navigate-cross-site-should-not-have-access.html
       http/tests/storageAccess/request-and-grant-access-then-navigate-same-site-should-have-access.html

* dom/Document.h:
    Removed unused member variable m_hasFrameSpecificStorageAccess.
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::willSendRequest):
* loader/FrameLoaderClient.h:

Source/WebKit:

* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchWillChangeDocument):
    Now takes the current URL and the new URL as parameters
    and only clears out storage access if the navigation is
    cross-site, i.e. with differing eTLD+1s.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.h:

LayoutTests:

* http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame-expected.txt:
* http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame.html:
    Added both a same-site and a cross-site navigation to the sub frame to test maintained and cleared access.
* http/tests/storageAccess/request-and-grant-access-then-navigate-cross-site-should-not-have-access-expected.txt: Copied from LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access-expected.txt.
* http/tests/storageAccess/request-and-grant-access-then-navigate-cross-site-should-not-have-access.html: Copied from LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access.html.
* http/tests/storageAccess/request-and-grant-access-then-navigate-same-site-should-have-access-expected.txt: Renamed from LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access-expected.txt.
* http/tests/storageAccess/request-and-grant-access-then-navigate-same-site-should-have-access.html: Renamed from LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access.html.
* http/tests/storageAccess/resources/get-cookies.php:
    Support for the new test scenarios.
* http/tests/storageAccess/resources/self-navigating-frame-after-granted-access.html:
    Support for the new test scenarios.
* platform/mac-wk2/TestExpectations:
    Marked the new and the renamed tests as [ Pass ].

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

17 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame-expected.txt
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame.html
LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-cross-site-should-not-have-access-expected.txt [moved from LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access-expected.txt with 82% similarity]
LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-cross-site-should-not-have-access.html [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-same-site-should-have-access-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-same-site-should-have-access.html [moved from LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access.html with 96% similarity]
LayoutTests/http/tests/storageAccess/resources/get-cookies.php
LayoutTests/http/tests/storageAccess/resources/self-navigating-frame-after-granted-access.html
LayoutTests/platform/mac-wk2/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.h
Source/WebCore/loader/DocumentLoader.cpp
Source/WebCore/loader/FrameLoaderClient.h
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h

index f1b32e7..3147864 100644 (file)
@@ -1,3 +1,25 @@
+2018-08-31  John Wilander  <wilander@apple.com>
+
+        Storage Access API: Maintain access through same-site navigations
+        https://bugs.webkit.org/show_bug.cgi?id=188564
+        <rdar://problem/43445160>
+
+        Reviewed by Alex Christensen.
+
+        * http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame-expected.txt:
+        * http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame.html:
+            Added both a same-site and a cross-site navigation to the sub frame to test maintained and cleared access.
+        * http/tests/storageAccess/request-and-grant-access-then-navigate-cross-site-should-not-have-access-expected.txt: Copied from LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access-expected.txt.
+        * http/tests/storageAccess/request-and-grant-access-then-navigate-cross-site-should-not-have-access.html: Copied from LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access.html.
+        * http/tests/storageAccess/request-and-grant-access-then-navigate-same-site-should-have-access-expected.txt: Renamed from LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access-expected.txt.
+        * http/tests/storageAccess/request-and-grant-access-then-navigate-same-site-should-have-access.html: Renamed from LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access.html.
+        * http/tests/storageAccess/resources/get-cookies.php:
+            Support for the new test scenarios.
+        * http/tests/storageAccess/resources/self-navigating-frame-after-granted-access.html:
+            Support for the new test scenarios.
+        * platform/mac-wk2/TestExpectations:
+            Marked the new and the renamed tests as [ Pass ].
+
 2018-08-30  Ryosuke Niwa  <rniwa@webkit.org>
 
         slotchange-event-bubbling.html fails in Chrome & Firefox
index d6bc777..0a84e7f 100644 (file)
@@ -4,6 +4,8 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 
 PASS Storage access was granted. document.cookie == firstPartyCookie=value, cookies seen server-side == {"firstPartyCookie":"value"}
+Did navigate iframe same-site and will now check that it still has storage access.
+PASS document.cookie == firstPartyCookie=value, cookies seen server-side == {"firstPartyCookie":"value"}
 PASS successfullyParsed is true
 
 TEST COMPLETE
@@ -42,7 +44,7 @@ Client-side document.cookie:
 --------
 Frame: '<!--frame5-->'
 --------
-After the top frame navigates the sub frame, the sub frame should no longer have access to cookies.
+After the top frame navigates the sub frame cross-site and back, the sub frame should no longer have access to cookies.
 Did not receive cookie named 'firstPartyCookie'.
 Did not receive cookie named 'partitionedCookie'.
 Client-side document.cookie:
index f160103..2b8e1e9 100644 (file)
                     break;
                 case "#step7":
                     document.location.hash = "step8";
-                    // Check that no cookie gets sent for localhost under 127.0.0.1 since we're opening in the frame that was granted access.
-                    let existingIframe = document.getElementById("TheIframeThatRequestsStorageAccess");
-                    existingIframe.onload = runTest;
-                    existingIframe.src = thirdPartyBaseUrl + subPathToGetCookies + "&message=After the top frame navigates the sub frame, the sub frame should no longer have access to cookies.";
+                    // Navigate the frame same-site.
+                    let existingIframe1 = document.getElementById("TheIframeThatRequestsStorageAccess");
+                    existingIframe1.onload = function () {
+                        debug("Did navigate iframe same-site and will now check that it still has storage access.");
+                        let iframe = document.getElementById("TheIframeThatRequestsStorageAccess");
+                        iframe.contentWindow.postMessage("reportBackCookies", "http://localhost:8000");
+                    };
+                    existingIframe1.src = thirdPartyBaseUrl + subPathToGetCookies;
                     break;
                 case "#step8":
+                    document.location.hash = "step9";
+                    // Navigate the frame cross-site. This should clear out storage access.
+                    let existingIframe2 = document.getElementById("TheIframeThatRequestsStorageAccess");
+                    existingIframe2.onload = runTest;
+                    existingIframe2.src = "http://" + partitionHost;
+                    break;
+                case "#step9":
+                    document.location.hash = "step10";
+                    // Again open localhost in the existing frame and check that no cookie gets sent for localhost under 127.0.0.1 since it has been navigated cross-site.
+                    let existingIframe3 = document.getElementById("TheIframeThatRequestsStorageAccess");
+                    existingIframe3.onload = runTest;
+                    existingIframe3.src = thirdPartyBaseUrl + subPathToGetCookies + "&message=After the top frame navigates the sub frame cross-site and back, the sub frame should no longer have access to cookies.";
+                    break;
+                case "#step10":
                     setEnableFeature(false, finishJSTest);
                     break;
             }
@@ -1,4 +1,4 @@
-Tests that a cross-origin iframe from a prevalent domain that is granted storage access and then navigates itself does not have storage access.
+Tests that a cross-origin iframe from a prevalent domain that is granted storage access and then navigates itself cross-site does not have storage access.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-cross-site-should-not-have-access.html b/LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-cross-site-should-not-have-access.html
new file mode 100644 (file)
index 0000000..25f1bf7
--- /dev/null
@@ -0,0 +1,90 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <script src="/js-test-resources/js-test.js"></script>
+    <script src="/js-test-resources/ui-helper.js"></script>
+    <script src="/resourceLoadStatistics/resources/util.js"></script>
+    <script>
+        description("Tests that a cross-origin iframe from a prevalent domain that is granted storage access and then navigates itself cross-site does not have storage access.");
+        jsTestIsAsync = true;
+
+        window.addEventListener("message", receiveMessage, false);
+
+        function finishTest() {
+            setEnableFeature(false, finishJSTest);
+        }
+
+        const expectedPassMessages = 2;
+        var passMessagesReceived = 0;
+        function receiveMessage(event) {
+            if (event.origin === "http://localhost:8000") {
+                if (event.data.indexOf("document.cookie") === 0) {
+                    testPassed(event.data);
+                } else if (event.data.indexOf("PASS") !== -1) {
+                    testPassed(event.data.replace("PASS ", ""));
+                    passMessagesReceived++;
+                    if (passMessagesReceived >= expectedPassMessages)
+                        finishTest();
+                } else {
+                    testFailed(event.data);
+                    finishTest();
+                }
+            } else {
+                testFailed("Received a message from an unexpected origin: " + event.origin);
+                finishTest();
+            }
+        }
+
+        function activateElement(elementId) {
+            var element = document.getElementById(elementId);
+            var centerX = element.offsetLeft + element.offsetWidth / 2;
+            var centerY = element.offsetTop + element.offsetHeight / 2;
+            UIHelper.activateAt(centerX, centerY).then(
+                function () {
+                    if (window.eventSender)
+                        eventSender.keyDown("escape");
+                    else {
+                        testFailed("No eventSender.");
+                        finishTest();
+                    }
+                },
+                function () {
+                    testFailed("Promise rejected.");
+                    finishTest();
+                }
+            );
+        }
+
+        function runTest() {
+            activateElement("TheIframeThatRequestsStorageAccess");
+        }
+
+        const hostUnderTest = "localhost:8000";
+        const statisticsUrl = "http://" + hostUnderTest;
+        if (document.location.hash !== "#firstPartyCookieSet") {
+            setEnableFeature(true, function() {
+                document.location.href = statisticsUrl + "/storageAccess/resources/set-cookie.php?name=firstPartyCookie&value=value#http://127.0.0.1:8000/storageAccess/request-and-grant-access-then-navigate-cross-site-should-not-have-access.html#firstPartyCookieSet";
+            });
+        } else {
+            testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() {
+                if (!testRunner.isStatisticsPrevalentResource(statisticsUrl))
+                    testFailed("Host did not get set as prevalent resource.");
+                testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, true, function() {
+                    if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl))
+                        testFailed("Host did not get logged for user interaction.");
+                    testRunner.statisticsUpdateCookieBlocking(function() {
+                        let iframeElement = document.createElement("iframe");
+                        iframeElement.setAttribute("sandbox", "allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals");
+                        iframeElement.onload = runTest;
+                        iframeElement.id = "TheIframeThatRequestsStorageAccess";
+                        iframeElement.src = "http://localhost:8000/storageAccess/resources/self-navigating-frame-after-granted-access.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess,crossSiteNavigation";
+                        document.body.appendChild(iframeElement);
+                    });
+                });
+            });
+        }
+    </script>
+</head>
+<body>
+</body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-same-site-should-have-access-expected.txt b/LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-same-site-should-have-access-expected.txt
new file mode 100644 (file)
index 0000000..2745db5
--- /dev/null
@@ -0,0 +1,13 @@
+Tests that a cross-origin iframe from a prevalent domain that is granted storage access and then navigates itself same-site still has storage access.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.cookie == 
+PASS Storage access was granted.
+PASS document.cookie == cookieSetClientSideAfterGrantedStorageAccess=value; firstPartyCookie=value
+PASS Has storage access. document.cookie == cookieSetClientSideAfterGrantedStorageAccess=value; firstPartyCookie=value, cookies seen server-side == {"cookieSetClientSideAfterGrantedStorageAccess":"value","firstPartyCookie":"value"}
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
@@ -5,7 +5,7 @@
     <script src="/js-test-resources/ui-helper.js"></script>
     <script src="/resourceLoadStatistics/resources/util.js"></script>
     <script>
-        description("Tests that a cross-origin iframe from a prevalent domain that is granted storage access and then navigates itself does not have storage access.");
+        description("Tests that a cross-origin iframe from a prevalent domain that is granted storage access and then navigates itself same-site still has storage access.");
         jsTestIsAsync = true;
 
         window.addEventListener("message", receiveMessage, false);
@@ -63,7 +63,7 @@
         const statisticsUrl = "http://" + hostUnderTest;
         if (document.location.hash !== "#firstPartyCookieSet") {
             setEnableFeature(true, function() {
-                document.location.href = statisticsUrl + "/storageAccess/resources/set-cookie.php?name=firstPartyCookie&value=value#http://127.0.0.1:8000/storageAccess/request-and-grant-access-then-navigate-should-not-have-access.html#firstPartyCookieSet";
+                document.location.href = statisticsUrl + "/storageAccess/resources/set-cookie.php?name=firstPartyCookie&value=value#http://127.0.0.1:8000/storageAccess/request-and-grant-access-then-navigate-same-site-should-have-access.html#firstPartyCookieSet";
             });
         } else {
             testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() {
@@ -77,7 +77,7 @@
                         iframeElement.setAttribute("sandbox", "allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals");
                         iframeElement.onload = runTest;
                         iframeElement.id = "TheIframeThatRequestsStorageAccess";
-                        iframeElement.src = "http://localhost:8000/storageAccess/resources/self-navigating-frame-after-granted-access.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess";
+                        iframeElement.src = "http://localhost:8000/storageAccess/resources/self-navigating-frame-after-granted-access.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess,sameSiteNavigation";
                         document.body.appendChild(iframeElement);
                     });
                 });
index dad8b5a..a4fb6a8 100644 (file)
@@ -21,4 +21,29 @@ if(!empty($_GET["name3"])) {
 <p id="output"></p>
 <script>
     document.getElementById("output").textContent = "Client-side document.cookie: " + document.cookie;
+
+    function messageToTop(messagePrefix, fetchData) {
+        top.postMessage(messagePrefix + " document.cookie == " + document.cookie +
+            (fetchData ? ", cookies seen server-side == " + JSON.stringify(fetchData) : ""), "http://127.0.0.1:8000");
+    }
+
+    function receiveMessage(event) {
+        if (event.origin === "http://127.0.0.1:8000") {
+            if (event.data.indexOf("reportBackCookies") !== -1) {
+                fetch("echo-incoming-cookies-as-json.php", { credentials: "same-origin" }).then(function(response) {
+                    return response.json();
+                }).then(function(data) {
+                    messageToTop("PASS", data);
+                }).catch(function(error) {
+                    console.log(error.message);
+                });
+            } else {
+                messageToTop("FAIL Unknown request.");
+            }
+        } else {
+            messageToTop("Fail Received a message from an unexpected origin: " + event.origin);
+        }
+    }
+
+    window.addEventListener("message", receiveMessage, false);
 </script>
\ No newline at end of file
index 6481d59..dbda7ea 100644 (file)
@@ -5,6 +5,7 @@
         const userShouldGrantAccess = hashArguments[0] === "userShouldGrantAccess";
         const userShouldBeConsulted = hashArguments[1] === "userShouldBeConsulted";
         const policyShouldGrantAccess = hashArguments[2] === "policyShouldGrantAccess";
+        const sameSiteNavigation = hashArguments[3] === "sameSiteNavigation";
 
         if (internals && userShouldGrantAccess)
             internals.setUserGrantsStorageAccess(true);
         }
 
         function navigate() {
-            document.location.href = "http://localhost:8000/storageAccess/resources/has-storage-access-iframe.html#policyShouldNotGrantAccess"
+            if (sameSiteNavigation) {
+                document.location.href = "http://localhost:8000/storageAccess/resources/has-storage-access-iframe.html#policyShouldGrantAccess";
+            } else {
+                document.location.href = "http://127.0.0.1:8000/resourceLoadStatistics/resources/redirect.php?redirectTo=http://localhost:8000/storageAccess/resources/has-storage-access-iframe.html";
+            }
         }
 
         function setCookieAndNavigate() {
index 8eebfdf..0b24e8f 100644 (file)
@@ -695,7 +695,8 @@ http/tests/resourceLoadStatistics/user-interaction-reported-after-website-data-r
 [ HighSierra+ ] http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-user-gesture.html [ Pass ]
 [ HighSierra+ ] http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-user-interaction.html [ Pass ]
 [ HighSierra+ ] http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access.html [ Pass ]
-[ HighSierra+ ] http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access.html [ Pass ]
+[ HighSierra+ ] http/tests/storageAccess/request-and-grant-access-then-navigate-cross-site-should-not-have-access.html [ Pass ]
+[ HighSierra+ ] http/tests/storageAccess/request-and-grant-access-then-navigate-same-site-should-have-access.html [ Pass ]
 [ HighSierra+ ] http/tests/storageAccess/deny-storage-access-under-opener.html [ Pass ]
 [ HighSierra+ ] http/tests/storageAccess/grant-storage-access-under-opener.html [ Pass ]
 
index 38be1ef..98f8147 100644 (file)
@@ -1,3 +1,20 @@
+2018-08-31  John Wilander  <wilander@apple.com>
+
+        Storage Access API: Maintain access through same-site navigations
+        https://bugs.webkit.org/show_bug.cgi?id=188564
+        <rdar://problem/43445160>
+
+        Reviewed by Alex Christensen.
+
+        Tests: http/tests/storageAccess/request-and-grant-access-then-navigate-cross-site-should-not-have-access.html
+               http/tests/storageAccess/request-and-grant-access-then-navigate-same-site-should-have-access.html
+
+        * dom/Document.h:
+            Removed unused member variable m_hasFrameSpecificStorageAccess.
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::willSendRequest):
+        * loader/FrameLoaderClient.h:
+
 2018-08-31  Youenn Fablet  <youenn@apple.com>
 
         WebAudioBufferList.cpp/.h is named as cocoa/WebAudioBufferList.cpp/.h
index 2276944..e42355a 100644 (file)
@@ -1995,7 +1995,6 @@ private:
 
     static bool hasEverCreatedAnAXObjectCache;
 
-    bool m_hasFrameSpecificStorageAccess { false };
     bool m_grantStorageAccessOverride { false };
 
 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
index 234749f..4306069 100644 (file)
@@ -600,7 +600,7 @@ void DocumentLoader::willSendRequest(ResourceRequest&& newRequest, const Resourc
     FrameLoader::addSameSiteInfoToRequestIfNeeded(newRequest, m_frame->document());
 
     if (!didReceiveRedirectResponse)
-        frameLoader()->client().dispatchWillChangeDocument();
+        frameLoader()->client().dispatchWillChangeDocument(m_frame->document()->url(), newRequest.url());
 
     // If we're fielding a redirect in response to a POST, force a load from origin, since
     // this is a common site technique to return to a page viewing some data that the POST
index 0c9103e..5c243c4 100644 (file)
@@ -166,7 +166,7 @@ public:
     virtual void dispatchDidCancelClientRedirect() = 0;
     virtual void dispatchWillPerformClientRedirect(const URL&, double interval, WallTime fireDate) = 0;
     virtual void dispatchDidChangeMainDocument() { }
-    virtual void dispatchWillChangeDocument() { }
+    virtual void dispatchWillChangeDocument(const URL&, const URL&) { }
     virtual void dispatchDidNavigateWithinPage() { }
     virtual void dispatchDidChangeLocationWithinPage() = 0;
     virtual void dispatchDidPushStateWithinPage() = 0;
index 5654e61..fc03a56 100644 (file)
@@ -1,3 +1,18 @@
+2018-08-31  John Wilander  <wilander@apple.com>
+
+        Storage Access API: Maintain access through same-site navigations
+        https://bugs.webkit.org/show_bug.cgi?id=188564
+        <rdar://problem/43445160>
+
+        Reviewed by Alex Christensen.
+
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::dispatchWillChangeDocument):
+            Now takes the current URL and the new URL as parameters
+            and only clears out storage access if the navigation is
+            cross-site, i.e. with differing eTLD+1s.
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
+
 2018-08-31  Chris Dumez  <cdumez@apple.com>
 
         Assertion hit in ~CompletionHandler() from ~WebFrame()
index f05e43f..3503072 100644 (file)
@@ -83,6 +83,7 @@
 #include <WebCore/PolicyChecker.h>
 #include <WebCore/ProgressTracker.h>
 #include <WebCore/ResourceError.h>
+#include <WebCore/ResourceRequest.h>
 #include <WebCore/ScriptController.h>
 #include <WebCore/SecurityOriginData.h>
 #include <WebCore/Settings.h>
@@ -383,7 +384,7 @@ void WebFrameLoaderClient::dispatchDidChangeMainDocument()
     webPage->send(Messages::WebPageProxy::DidChangeMainDocument(m_frame->frameID()));
 }
 
-void WebFrameLoaderClient::dispatchWillChangeDocument()
+void WebFrameLoaderClient::dispatchWillChangeDocument(const URL& currentUrl, const URL& newUrl)
 {
 #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
     if (m_frame->isMainFrame())
@@ -393,7 +394,7 @@ void WebFrameLoaderClient::dispatchWillChangeDocument()
     if (!webPage)
         return;
 
-    if (m_hasFrameSpecificStorageAccess) {
+    if (m_hasFrameSpecificStorageAccess && !WebCore::registrableDomainsAreEqual(currentUrl, newUrl)) {
         WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::RemoveStorageAccessForFrame(sessionID(), frameID().value(), pageID().value()), 0);
         m_hasFrameSpecificStorageAccess = false;
     }
index b2d0930..1c5ee6a 100644 (file)
@@ -97,7 +97,7 @@ private:
     void dispatchDidFinishDataDetection(NSArray *detectionResults) final;
 #endif
     void dispatchDidChangeMainDocument() final;
-    void dispatchWillChangeDocument() final;
+    void dispatchWillChangeDocument(const WebCore::URL& currentUrl, const WebCore::URL& newUrl) final;
 
     void dispatchDidDispatchOnloadEvents() final;
     void dispatchDidReceiveServerRedirectForProvisionalLoad() final;