Changeset 226235 in webkit


Ignore:
Timestamp:
Dec 21, 2017 11:56:45 AM (6 years ago)
Author:
wilander@apple.com
Message:

Storage Access API: Make DocumentLoader::willSendRequest() and WebFrameLoaderClient::detachedFromParent2() tell the network process to get rid of any sub frame access entries
https://bugs.webkit.org/show_bug.cgi?id=180728
<rdar://problem/36009288>

Reviewed by Youenn Fablet.

Source/WebCore:

Tests: http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access.html

http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access.html

This change calls the network process to clear any storage access
entries when a subframe navigates or is detached.

  • dom/Document.cpp:

(WebCore::Document::hasStorageAccess):
(WebCore::Document::requestStorageAccess):
(WebCore::Document::hasFrameSpecificStorageAccess):
(WebCore::Document::setHasFrameSpecificStorageAccess):

  • dom/Document.h:
  • loader/DocumentLoader.cpp:

(WebCore::DocumentLoader::willSendRequest):

  • loader/EmptyFrameLoaderClient.h:
  • loader/FrameLoaderClient.h:
  • platform/network/NetworkStorageSession.h:
  • platform/network/cf/NetworkStorageSessionCFNet.cpp:

(WebCore::NetworkStorageSession::removeStorageAccess):

Source/WebKit:

This change calls the network process to clear any storage access
entries when a subframe navigates or is detached.

  • NetworkProcess/NetworkProcess.cpp:

(WebKit::NetworkProcess::removeStorageAccess):

  • NetworkProcess/NetworkProcess.h:
  • NetworkProcess/NetworkProcess.messages.in:
  • UIProcess/Network/NetworkProcessProxy.cpp:

(WebKit::NetworkProcessProxy::removeStorageAccess):

  • UIProcess/Network/NetworkProcessProxy.h:
  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::removeStorageAccess):

  • UIProcess/WebPageProxy.h:
  • UIProcess/WebPageProxy.messages.in:
  • UIProcess/WebsiteData/WebsiteDataStore.cpp:

(WebKit::WebsiteDataStore::hasStorageAccess):
(WebKit::WebsiteDataStore::requestStorageAccess):
(WebKit::WebsiteDataStore::removeStorageAccess):

  • UIProcess/WebsiteData/WebsiteDataStore.h:
  • WebProcess/WebCoreSupport/WebChromeClient.cpp:
  • WebProcess/WebCoreSupport/WebChromeClient.h:
  • WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:

(WebKit::WebFrameLoaderClient::detachedFromParent2):
(WebKit::WebFrameLoaderClient::dispatchWillChangeDocument):

  • WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
  • WebProcess/WebPage/WebPage.cpp:
  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/WebPage.messages.in:

LayoutTests:

This change calls the network process to clear any storage access
entries when a subframe navigates or is detached.

  • http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction-expected.txt:
  • http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction-expected.txt:
  • http/tests/storageAccess/request-and-deny-storage-access-cross-origin-iframe-expected.txt:
  • http/tests/storageAccess/request-and-deny-storage-access-cross-origin-sandboxed-iframe-expected.txt:
  • http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access-expected.txt: Added.
  • http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access.html: Added.
  • http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access-expected.txt: Added.
  • http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access.html: Added.
  • http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe-expected.txt:
  • http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-expected.txt:
  • http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-and-try-access-from-right-frame-expected.txt:
  • http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-and-try-access-from-right-frame.html:
  • http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-but-try-access-from-wrong-frame-expected.txt:
  • http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-recent-user-interaction-expected.txt:
  • http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction-expected.txt:
  • http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-nested-iframe-expected.txt:
  • http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin-expected.txt:
  • http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin.html:
  • http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-allow-token-expected.txt:
  • http/tests/storageAccess/request-storage-access-same-origin-iframe-expected.txt:
  • http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe-expected.txt:
  • http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe-without-allow-token-expected.txt:
  • http/tests/storageAccess/resources/echo-incoming-cookies-as-json.php: Added.
  • http/tests/storageAccess/resources/has-storage-access-iframe.html:
  • http/tests/storageAccess/resources/request-storage-access-iframe.html:
  • http/tests/storageAccess/resources/self-navigating-frame-after-granted-access.html: Added.
  • platform/wk2/TestExpectations:

Removed http/tests/storageAccess/request-storage-access-top-frame.html
because it now only passes on High Sierra+.

  • platform/mac-wk2/TestExpectations:

Added the new tests as [ Pass ] on High Sierra+.

Location:
trunk
Files:
5 added
50 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r226234 r226235  
     12017-12-21  John Wilander  <wilander@apple.com>
     2
     3        Storage Access API: Make DocumentLoader::willSendRequest() and WebFrameLoaderClient::detachedFromParent2() tell the network process to get rid of any sub frame access entries
     4        https://bugs.webkit.org/show_bug.cgi?id=180728
     5        <rdar://problem/36009288>
     6
     7        Reviewed by Youenn Fablet.
     8
     9        This change calls the network process to clear any storage access
     10        entries when a subframe navigates or is detached.
     11
     12        * http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction-expected.txt:
     13        * http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction-expected.txt:
     14        * http/tests/storageAccess/request-and-deny-storage-access-cross-origin-iframe-expected.txt:
     15        * http/tests/storageAccess/request-and-deny-storage-access-cross-origin-sandboxed-iframe-expected.txt:
     16        * http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access-expected.txt: Added.
     17        * http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access.html: Added.
     18        * http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access-expected.txt: Added.
     19        * http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access.html: Added.
     20        * http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe-expected.txt:
     21        * http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-expected.txt:
     22        * http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-and-try-access-from-right-frame-expected.txt:
     23        * http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-and-try-access-from-right-frame.html:
     24        * http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-but-try-access-from-wrong-frame-expected.txt:
     25        * http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-recent-user-interaction-expected.txt:
     26        * http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction-expected.txt:
     27        * http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-nested-iframe-expected.txt:
     28        * http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin-expected.txt:
     29        * http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin.html:
     30        * http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-allow-token-expected.txt:
     31        * http/tests/storageAccess/request-storage-access-same-origin-iframe-expected.txt:
     32        * http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe-expected.txt:
     33        * http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe-without-allow-token-expected.txt:
     34        * http/tests/storageAccess/resources/echo-incoming-cookies-as-json.php: Added.
     35        * http/tests/storageAccess/resources/has-storage-access-iframe.html:
     36        * http/tests/storageAccess/resources/request-storage-access-iframe.html:
     37        * http/tests/storageAccess/resources/self-navigating-frame-after-granted-access.html: Added.
     38        * platform/wk2/TestExpectations:
     39            Removed http/tests/storageAccess/request-storage-access-top-frame.html
     40            because it now only passes on High Sierra+.
     41        * platform/mac-wk2/TestExpectations:
     42            Added the new tests as [ Pass ] on High Sierra+.
     43
    1442017-12-21  Antoine Quint  <graouts@apple.com>
    245
  • trunk/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction-expected.txt

    r226016 r226235  
    44
    55
    6 PASS No storage access.
     6PASS No storage access. document.cookie == , cookies seen server-side == "No cookies"
    77PASS successfullyParsed is true
    88
  • trunk/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction-expected.txt

    r226016 r226235  
    44
    55
    6 PASS Has storage access.
     6PASS Has storage access. document.cookie == , cookies seen server-side == "No cookies"
    77PASS successfullyParsed is true
    88
  • trunk/LayoutTests/http/tests/storageAccess/request-and-deny-storage-access-cross-origin-iframe-expected.txt

    r225583 r226235  
    44
    55
    6 PASS Storage access was denied.
     6PASS Storage access was denied. document.cookie == , cookies seen server-side == "No cookies"
    77PASS successfullyParsed is true
    88
  • trunk/LayoutTests/http/tests/storageAccess/request-and-deny-storage-access-cross-origin-sandboxed-iframe-expected.txt

    r225583 r226235  
    55
    66
    7 PASS Storage access was denied.
     7PASS Storage access was denied. document.cookie == , cookies seen server-side == "No cookies"
    88PASS successfullyParsed is true
    99
  • trunk/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe-expected.txt

    r225583 r226235  
    44
    55
    6 PASS Storage access was denied.
     6PASS Storage access was denied. document.cookie == , cookies seen server-side == "No cookies"
    77PASS successfullyParsed is true
    88
  • trunk/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-expected.txt

    r225583 r226235  
    55
    66
    7 PASS Storage access was granted.
     7PASS Storage access was granted. document.cookie == , cookies seen server-side == "No cookies"
    88PASS successfullyParsed is true
    99
  • trunk/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-and-try-access-from-right-frame-expected.txt

    r225934 r226235  
    55
    66
    7 PASS Storage access was granted.
     7PASS Storage access was granted. document.cookie == firstPartyCookie=value, cookies seen server-side == {"firstPartyCookie":"value"}
    88PASS successfullyParsed is true
    99
     
    1414Frame: 'TheIframeThatRequestsStorageAccess'
    1515--------
    16 After access granted, should receive first-party cookie.
    17 Received cookie named 'firstPartyCookie'.
    18 Did not receive cookie named 'partitionedCookie'.
    19 Client-side document.cookie: firstPartyCookie=value
     16After the top frame navigates the sub frame, the sub frame should no longer have access to first-party cookies.
     17Did not receive cookie named 'firstPartyCookie'.
     18Received cookie named 'partitionedCookie'.
     19Client-side document.cookie: partitionedCookie=value
    2020
    2121--------
  • trunk/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-and-try-access-from-right-frame.html

    r225827 r226235  
    115115                    document.location.hash = "step8";
    116116                    // Check that the first-party cookie gets sent for localhost under 127.0.0.1 since we're opening in the frame that was granted access.
    117                     document.getElementById("TheIframeThatRequestsStorageAccess").src = thirdPartyBaseUrl + subPathToGetCookies + "&message=After access granted, should receive first-party cookie.";
     117                    document.getElementById("TheIframeThatRequestsStorageAccess").src = thirdPartyBaseUrl + subPathToGetCookies + "&message=After the top frame navigates the sub frame, the sub frame should no longer have access to first-party cookies.";
    118118                    break;
    119119                case "#step8":
  • trunk/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-but-try-access-from-wrong-frame-expected.txt

    r225827 r226235  
    55
    66
    7 PASS Storage access was granted.
     7PASS Storage access was granted. document.cookie == firstPartyCookie=value, cookies seen server-side == {"firstPartyCookie":"value"}
    88PASS successfullyParsed is true
    99
  • trunk/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-recent-user-interaction-expected.txt

    r225583 r226235  
    55
    66
    7 PASS Storage access was granted.
     7PASS Storage access was granted. document.cookie == , cookies seen server-side == "No cookies"
    88PASS successfullyParsed is true
    99
  • trunk/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction-expected.txt

    r225583 r226235  
    55
    66
    7 PASS Storage access was denied.
     7PASS Storage access was denied. document.cookie == , cookies seen server-side == "No cookies"
    88PASS successfullyParsed is true
    99
  • trunk/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-nested-iframe-expected.txt

    r225583 r226235  
    44
    55
    6 PASS Storage access was denied.
     6PASS Storage access was denied. document.cookie == , cookies seen server-side == "No cookies"
    77PASS successfullyParsed is true
    88
  • trunk/LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin-expected.txt

    r225583 r226235  
    44
    55
    6 PASS Storage access was denied.
     6PASS Storage access was denied for origin null.
    77PASS successfullyParsed is true
    88
  • trunk/LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin.html

    r222941 r226235  
    4747</head>
    4848<body>
    49     <iframe sandbox="allow-storage-access-by-user-activation allow-scripts allow-modals" onload="runTest()" id="theIframe" src="http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldGrantAccess,userShouldNotBeConsulted,policyShouldDenyAccess,isNotSameOriginIframe"></iframe>
     49    <iframe sandbox="allow-storage-access-by-user-activation allow-scripts allow-modals" onload="runTest()" id="theIframe" src="http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldGrantAccess,userShouldNotBeConsulted,policyShouldDenyAccess,isNotSameOriginIframe,originIsNull"></iframe>
    5050</body>
    5151</html>
  • trunk/LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-allow-token-expected.txt

    r225583 r226235  
    44
    55
    6 PASS Storage access was denied.
     6PASS Storage access was denied. document.cookie == , cookies seen server-side == "No cookies"
    77PASS successfullyParsed is true
    88
  • trunk/LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-iframe-expected.txt

    r225583 r226235  
    44
    55
    6 PASS Storage access was granted.
     6PASS Storage access was granted. document.cookie == , cookies seen server-side == "No cookies"
    77PASS successfullyParsed is true
    88
  • trunk/LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe-expected.txt

    r225583 r226235  
    44
    55
    6 PASS Storage access was granted.
     6PASS Storage access was granted. document.cookie == , cookies seen server-side == "No cookies"
    77PASS successfullyParsed is true
    88
  • trunk/LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe-without-allow-token-expected.txt

    r225583 r226235  
    44
    55
    6 PASS Storage access was granted.
     6PASS Storage access was granted. document.cookie == , cookies seen server-side == "No cookies"
    77PASS successfullyParsed is true
    88
  • trunk/LayoutTests/http/tests/storageAccess/resources/has-storage-access-iframe.html

    r226016 r226235  
    33    <script>
    44        const policyShouldGrantAccess = document.location.hash === "#policyShouldGrantAccess";
     5
     6        function messageToTop(messagePrefix, fetchData) {
     7            top.postMessage(messagePrefix + " document.cookie == " + document.cookie +
     8                (fetchData ? ", cookies seen server-side == " + JSON.stringify(fetchData) : ""), "http://127.0.0.1:8000");
     9        }
    510
    611        function checkHasStorageAccess() {
     
    914                function (hasAccess) {
    1015                    if (hasAccess && policyShouldGrantAccess)
    11                         top.postMessage("PASS Has storage access.", "http://127.0.0.1:8000");
     16                        fetch("echo-incoming-cookies-as-json.php", { credentials: "same-origin" }).then(function(response) {
     17                            return response.json();
     18                        }).then(function(data) {
     19                            messageToTop("PASS Has storage access.", data);
     20                        }).catch(function(error) {
     21                            console.log(error.message);
     22                        });
    1223                    else if (!hasAccess && !policyShouldGrantAccess)
    13                         top.postMessage("PASS No storage access.", "http://127.0.0.1:8000");
     24                        fetch("echo-incoming-cookies-as-json.php", { credentials: "same-origin" }).then(function(response) {
     25                            return response.json();
     26                        }).then(function(data) {
     27                            messageToTop("PASS No storage access.", data);
     28                        }).catch(function(error) {
     29                            console.log(error.message);
     30                        });
    1431                    else
    15                         top.postMessage("FAIL " +
     32                        messageToTop("FAIL " +
    1633                            (hasAccess ? "Storage " : "No storage ") +
    1734                            "access when there should " +
    1835                            (policyShouldGrantAccess ? "" : "not ") +
    19                             "have been access.", "http://127.0.0.1:8000");
     36                            "have been access.");
    2037                },
    2138                function (reason) {
    22                     top.postMessage("FAIL document.hasStorageAccess() was rejected. Reason: " + reason, "http://127.0.0.1:8000");
     39                    messageToTop("FAIL document.hasStorageAccess() was rejected. Reason: " + reason);
    2340                }
    2441            );
  • trunk/LayoutTests/http/tests/storageAccess/resources/request-storage-access-iframe.html

    r225583 r226235  
    66        const userShouldBeConsulted = hashArguments[1] === "userShouldBeConsulted";
    77        const policyShouldGrantAccess = hashArguments[2] === "policyShouldGrantAccess";
     8        const isSameOriginIframe = hashArguments[3] === "isSameOriginIframe";
     9        const originIsNull = hashArguments[4] === "originIsNull";
    810
    911        if (internals && userShouldGrantAccess)
     
    1113
    1214        var requestStorageAccessResolved;
     15
     16        function messageToTop(messagePrefix, fetchData) {
     17            if (originIsNull) {
     18                top.postMessage(messagePrefix, "http://127.0.0.1:8000");
     19            } else {
     20                top.postMessage(messagePrefix + " document.cookie == " + document.cookie +
     21                    (fetchData ? ", cookies seen server-side == " + JSON.stringify(fetchData) : ""), "http://127.0.0.1:8000");
     22            }
     23        }
     24
     25        window.addEventListener("message", receiveMessage, false);
     26
     27        function receiveMessage(event) {
     28            if (event.origin === "http://127.0.0.1:8000") {
     29                if (event.data.indexOf("reportBackCookies") !== -1) {
     30                    fetch("echo-incoming-cookies-as-json.php", { credentials: "same-origin" }).then(function(response) {
     31                        return response.json();
     32                    }).then(function(data) {
     33                        messageToTop("PASS.", data);
     34                    }).catch(function(error) {
     35                        console.log(error.message);
     36                    });
     37                } else {
     38                    messageToTop("FAIL Unknown request.");
     39                }
     40            } else {
     41                messageToTop("Fail Received a message from an unexpected origin: " + event.origin);
     42            }
     43        }
    1344
    1445        function makeRequestWithUserGesture() {
     
    3364                        && hasAccess
    3465                        && (userShouldGrantAccess || !userShouldBeConsulted)
    35                         && policyShouldGrantAccess)
    36                         top.postMessage("PASS Storage access was granted.", "http://127.0.0.1:8000");
    37                     else if (!hasAccess
     66                        && policyShouldGrantAccess) {
     67                        fetch("echo-incoming-cookies-as-json.php", { credentials: "same-origin" }).then(function(response) {
     68                            return response.json();
     69                        }).then(function(data) {
     70                            messageToTop("PASS Storage access was granted.", data);
     71                        }).catch(function(error) {
     72                            console.log(error.message);
     73                        });
     74
     75                    } else if (!hasAccess
    3876                        && !requestStorageAccessResolved
    39                         && ((!userShouldGrantAccess && userShouldBeConsulted) || !policyShouldGrantAccess))
    40                         top.postMessage("PASS Storage access was denied.", "http://127.0.0.1:8000");
    41                     else
    42                         top.postMessage("FAIL Storage access was " +
     77                        && ((!userShouldGrantAccess && userShouldBeConsulted) || !policyShouldGrantAccess)) {
     78                        if (originIsNull) {
     79                            messageToTop("PASS Storage access was denied for origin null.");
     80                        } else {
     81                            fetch("echo-incoming-cookies-as-json.php", { credentials: "same-origin" }).then(function(response) {
     82                                return response.json();
     83                            }).then(function(data) {
     84                                messageToTop("PASS Storage access was denied.", data);
     85                            }).catch(function(error) {
     86                                console.log(error.message);
     87                            });
     88                        }
     89                    } else
     90                        messageToTop("FAIL Storage access was " +
    4391                            (hasAccess ? "" : "not ") +
    4492                            "granted and requestStorageAccessResolved was " +
     
    4694                            "granted but should " +
    4795                            (userShouldGrantAccess && policyShouldGrantAccess ? "" : "not ") +
    48                             "have been granted.", "http://127.0.0.1:8000");
     96                            "have been granted.");
    4997                },
    5098                function (reason) {
    51                     top.postMessage("FAIL document.hasStorageAccess() was rejected. Reason: " + reason, "http://127.0.0.1:8000");
     99                    messageToTop("FAIL document.hasStorageAccess() was rejected. Reason: " + reason);
    52100                }
    53101            );
  • trunk/LayoutTests/http/tests/storageAccess/resources/self-navigating-frame-after-granted-access.html

    r226234 r226235  
    88
    99        if (internals && userShouldGrantAccess)
    10                 internals.setUserGrantsStorageAccess(true);
     10            internals.setUserGrantsStorageAccess(true);
    1111
    1212        var requestStorageAccessResolved;
     
    2424                }
    2525            );
     26        }
     27
     28        function navigate() {
     29            document.location.href = "http://localhost:8000/storageAccess/resources/has-storage-access-iframe.html#policyShouldNotGrantAccess"
     30        }
     31
     32        function setCookieAndNavigate() {
     33            document.cookie = "cookieSetClientSideAfterGrantedStorageAccess=value";
     34            top.postMessage("document.cookie == " + document.cookie, "http://127.0.0.1:8000");
     35            setTimeout("navigate()", 200);
    2636        }
    2737
     
    4757                            (userShouldGrantAccess && policyShouldGrantAccess ? "" : "not ") +
    4858                            "have been granted.", "http://127.0.0.1:8000");
     59                    setTimeout("setCookieAndNavigate()", 200);
    4960                },
    5061                function (reason) {
     
    5364            );
    5465        }
     66
     67        top.postMessage("document.cookie == " + document.cookie, "http://127.0.0.1:8000");
    5568    </script>
    5669</head>
  • trunk/LayoutTests/platform/mac-wk2/TestExpectations

    r226233 r226235  
    767767[ HighSierra+ ] http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction.html [ Pass ]
    768768[ HighSierra+ ] http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction.html [ Pass ]
     769[ HighSierra+ ] http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access.html [ Pass ]
     770[ HighSierra+ ] http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access.html [ Pass ]
    769771
    770772webkit.org/b/173861 [ Release ] http/tests/webrtc/filtering-ice-candidate-same-origin-frame.html [ Pass Timeout ]
  • trunk/LayoutTests/platform/wk2/TestExpectations

    r226227 r226235  
    690690webkit.org/b/180703 http/tests/resourceLoadStatistics/telemetry-generation.html [ Pass Failure ]
    691691http/tests/resourceLoadStatistics/prune-statistics.html [ Pass ]
    692 http/tests/storageAccess/request-storage-access-top-frame.html [ Pass ]
    693692http/tests/resourceLoadStatistics [ Pass ]
    694693# Cookie partitioning is only supported in macOS High Sierra and iOS 11.
  • trunk/Source/WebCore/ChangeLog

    r226234 r226235  
     12017-12-21  John Wilander  <wilander@apple.com>
     2
     3        Storage Access API: Make DocumentLoader::willSendRequest() and WebFrameLoaderClient::detachedFromParent2() tell the network process to get rid of any sub frame access entries
     4        https://bugs.webkit.org/show_bug.cgi?id=180728
     5        <rdar://problem/36009288>
     6
     7        Reviewed by Youenn Fablet.
     8
     9        Tests: http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access.html
     10               http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access.html
     11
     12        This change calls the network process to clear any storage access
     13        entries when a subframe navigates or is detached.
     14
     15        * dom/Document.cpp:
     16        (WebCore::Document::hasStorageAccess):
     17        (WebCore::Document::requestStorageAccess):
     18        (WebCore::Document::hasFrameSpecificStorageAccess):
     19        (WebCore::Document::setHasFrameSpecificStorageAccess):
     20        * dom/Document.h:
     21        * loader/DocumentLoader.cpp:
     22        (WebCore::DocumentLoader::willSendRequest):
     23        * loader/EmptyFrameLoaderClient.h:
     24        * loader/FrameLoaderClient.h:
     25        * platform/network/NetworkStorageSession.h:
     26        * platform/network/cf/NetworkStorageSessionCFNet.cpp:
     27        (WebCore::NetworkStorageSession::removeStorageAccess):
     28
    1292017-12-21  Antoine Quint  <graouts@apple.com>
    230
  • trunk/Source/WebCore/dom/Document.cpp

    r226190 r226235  
    74337433    ASSERT(settings().storageAccessAPIEnabled());
    74347434
    7435     if (m_hasFrameSpecificStorageAccess) {
     7435#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
     7436    if (hasFrameSpecificStorageAccess()) {
    74367437        promise->resolve<IDLBoolean>(true);
    74377438        return;
     
    74557456    }
    74567457
    7457     ASSERT(m_frame);
    74587458    auto frameID = m_frame->loader().client().frameID();
    74597459    auto pageID = m_frame->loader().client().pageID();
     
    74757475        return;
    74767476    }
     7477#endif
    74777478
    74787479    promise->reject();
     
    74837484    ASSERT(settings().storageAccessAPIEnabled());
    74847485   
    7485     if (m_hasFrameSpecificStorageAccess)
     7486#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
     7487    if (hasFrameSpecificStorageAccess()) {
    74867488        promise->resolve();
     7489        return;
     7490    }
    74877491   
    74887492    if (!m_frame || securityOrigin().isUnique()) {
     
    75477551
    75487552            if (wasGranted) {
    7549                 document->m_hasFrameSpecificStorageAccess = true;
     7553                document->setHasFrameSpecificStorageAccess(true);
    75507554                promise->resolve();
    75517555            } else
     
    75547558        return;
    75557559    }
     7560#endif
     7561
     7562    promise->reject();
     7563}
     7564
     7565#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
     7566bool Document::hasFrameSpecificStorageAccess() const
     7567{
     7568    return m_frame->loader().client().hasFrameSpecificStorageAccess();
     7569}
    75567570   
    7557     promise->reject();
    7558 }
     7571void Document::setHasFrameSpecificStorageAccess(bool value)
     7572{
     7573    m_frame->loader().client().setHasFrameSpecificStorageAccess(value);
     7574}
     7575#endif
    75597576
    75607577void Document::setConsoleMessageListener(RefPtr<StringCallback>&& listener)
  • trunk/Source/WebCore/dom/Document.h

    r225990 r226235  
    17001700    void didLogMessage(const WTFLogChannel&, WTFLogLevel, Vector<JSONLogValue>&&) final;
    17011701
     1702#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
     1703    bool hasFrameSpecificStorageAccess() const;
     1704    void setHasFrameSpecificStorageAccess(bool);
     1705#endif
     1706
    17021707#if ENABLE(DEVICE_ORIENTATION) && PLATFORM(IOS)
    17031708    std::unique_ptr<DeviceMotionClient> m_deviceMotionClient;
  • trunk/Source/WebCore/loader/DocumentLoader.cpp

    r226200 r226235  
    535535        newRequest.setFirstPartyForCookies(newRequest.url());
    536536
     537    if (!didReceiveRedirectResponse)
     538        frameLoader()->client().dispatchWillChangeDocument();
     539
    537540    // If we're fielding a redirect in response to a POST, force a load from origin, since
    538541    // this is a common site technique to return to a page viewing some data that the POST
  • trunk/Source/WebCore/loader/EmptyFrameLoaderClient.h

    r225934 r226235  
    201201    RefPtr<PreviewLoaderClient> createPreviewLoaderClient(const String&, const String&) final { return nullptr; }
    202202#endif
     203#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
     204    bool hasFrameSpecificStorageAccess() final { return false; }
     205    void setHasFrameSpecificStorageAccess(bool) final { }
     206#endif
    203207};
    204208
  • trunk/Source/WebCore/loader/FrameLoaderClient.h

    r225934 r226235  
    162162    virtual void dispatchWillPerformClientRedirect(const URL&, double interval, double fireDate) = 0;
    163163    virtual void dispatchDidChangeMainDocument() { }
     164    virtual void dispatchWillChangeDocument() { }
    164165    virtual void dispatchDidNavigateWithinPage() { }
    165166    virtual void dispatchDidChangeLocationWithinPage() = 0;
     
    365366    virtual void finishedLoadingApplicationManifest(uint64_t, const std::optional<ApplicationManifest>&) { }
    366367#endif
     368
     369#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
     370    virtual bool hasFrameSpecificStorageAccess() { return false; }
     371    virtual void setHasFrameSpecificStorageAccess(bool) { }
     372#endif
    367373};
    368374
  • trunk/Source/WebCore/platform/network/NetworkStorageSession.h

    r225827 r226235  
    101101    WEBCORE_EXPORT bool isStorageAccessGranted(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID) const;
    102102    WEBCORE_EXPORT void setStorageAccessGranted(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, bool value);
     103    WEBCORE_EXPORT void removeStorageAccess(uint64_t frameID, uint64_t pageID);
    103104#endif
    104105#elif USE(SOUP)
  • trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp

    r225827 r226235  
    334334}
    335335
     336void NetworkStorageSession::removeStorageAccess(uint64_t frameID, uint64_t pageID)
     337{
     338    auto iteration = m_framesGrantedStorageAccess.find(frameID);
     339    if (iteration == m_framesGrantedStorageAccess.end())
     340        return;
     341   
     342    iteration->value.remove(pageID);
     343}
     344   
    336345#endif // HAVE(CFNETWORK_STORAGE_PARTITIONING)
    337346
  • trunk/Source/WebKit/ChangeLog

    r226231 r226235  
     12017-12-21  John Wilander  <wilander@apple.com>
     2
     3        Storage Access API: Make DocumentLoader::willSendRequest() and WebFrameLoaderClient::detachedFromParent2() tell the network process to get rid of any sub frame access entries
     4        https://bugs.webkit.org/show_bug.cgi?id=180728
     5        <rdar://problem/36009288>
     6
     7        Reviewed by Youenn Fablet.
     8
     9        This change calls the network process to clear any storage access
     10        entries when a subframe navigates or is detached.
     11
     12        * NetworkProcess/NetworkProcess.cpp:
     13        (WebKit::NetworkProcess::removeStorageAccess):
     14        * NetworkProcess/NetworkProcess.h:
     15        * NetworkProcess/NetworkProcess.messages.in:
     16        * UIProcess/Network/NetworkProcessProxy.cpp:
     17        (WebKit::NetworkProcessProxy::removeStorageAccess):
     18        * UIProcess/Network/NetworkProcessProxy.h:
     19        * UIProcess/WebPageProxy.cpp:
     20        (WebKit::WebPageProxy::removeStorageAccess):
     21        * UIProcess/WebPageProxy.h:
     22        * UIProcess/WebPageProxy.messages.in:
     23        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
     24        (WebKit::WebsiteDataStore::hasStorageAccess):
     25        (WebKit::WebsiteDataStore::requestStorageAccess):
     26        (WebKit::WebsiteDataStore::removeStorageAccess):
     27        * UIProcess/WebsiteData/WebsiteDataStore.h:
     28        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
     29        * WebProcess/WebCoreSupport/WebChromeClient.h:
     30        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
     31        (WebKit::WebFrameLoaderClient::detachedFromParent2):
     32        (WebKit::WebFrameLoaderClient::dispatchWillChangeDocument):
     33        * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
     34        * WebProcess/WebPage/WebPage.cpp:
     35        * WebProcess/WebPage/WebPage.h:
     36        * WebProcess/WebPage/WebPage.messages.in:
     37
    1382017-12-21  Jeremy Jones  <jeremyj@apple.com>
    239
  • trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp

    r226226 r226235  
    361361}
    362362
     363void NetworkProcess::removeStorageAccess(PAL::SessionID sessionID, uint64_t frameID, uint64_t pageID)
     364{
     365    if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID))
     366        networkStorageSession->removeStorageAccess(frameID, pageID);
     367    else
     368        ASSERT_NOT_REACHED();
     369}
     370
    363371void NetworkProcess::removePrevalentDomains(PAL::SessionID sessionID, const Vector<String>& domains)
    364372{
  • trunk/Source/WebKit/NetworkProcess/NetworkProcess.h

    r226226 r226235  
    141141    void hasStorageAccessForPrevalentDomains(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, uint64_t contextId);
    142142    void updateStorageAccessForPrevalentDomains(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, bool value, uint64_t contextId);
     143    void removeStorageAccess(PAL::SessionID, uint64_t frameID, uint64_t pageID);
    143144    void removePrevalentDomains(PAL::SessionID, const Vector<String>& domains);
    144145#endif
  • trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in

    r226016 r226235  
    8686    HasStorageAccessForPrevalentDomains(PAL::SessionID sessionID, String resourceDomain, String firstPartyDomain, uint64_t frameID, uint64_t pageID, uint64_t contextId)
    8787    UpdateStorageAccessForPrevalentDomains(PAL::SessionID sessionID, String resourceDomain, String firstPartyDomain, uint64_t frameID, uint64_t pageID, bool shouldGrantAccess, uint64_t contextId)
     88    RemoveStorageAccess(PAL::SessionID sessionID, uint64_t frameID, uint64_t pageID);
    8889    RemovePrevalentDomains(PAL::SessionID sessionID, Vector<String> domainsWithInteraction);
    8990#endif
  • trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp

    r226016 r226235  
    425425}
    426426
     427void NetworkProcessProxy::removeStorageAccess(PAL::SessionID sessionID, uint64_t frameID, uint64_t pageID)
     428{
     429    send(Messages::NetworkProcess::RemoveStorageAccess(sessionID, frameID, pageID), 0);
     430}
     431
    427432void NetworkProcessProxy::storageAccessRequestResult(bool wasGranted, uint64_t contextId)
    428433{
  • trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h

    r226016 r226235  
    8181    void hasStorageAccessForPrevalentDomains(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& callback);
    8282    void updateStorageAccessForPrevalentDomains(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, bool value, CompletionHandler<void(bool)>&& callback);
     83    void removeStorageAccess(PAL::SessionID, uint64_t frameID, uint64_t pageID);
    8384#endif
    8485
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r226189 r226235  
    71837183}
    71847184
     7185#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
    71857186void WebPageProxy::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, uint64_t webProcessContextId)
    71867187{
     
    71987199}
    71997200
     7201void WebPageProxy::removeStorageAccess(uint64_t frameID, uint64_t pageID)
     7202{
     7203    ASSERT(pageID == m_pageID);
     7204    m_websiteDataStore->removeStorageAccess(frameID, pageID);
     7205}
     7206#endif
     7207
    72007208#if PLATFORM(COCOA)
    72017209void WebPageProxy::touchBarMenuDataChanged(const TouchBarMenuData& touchBarMenuData)
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp.orig

    r226189 r226235  
    69296929}
    69306930
    6931 void WebPageProxy::handleAlternativePresentationButtonClick(const UserData& userData)
    6932 {
    6933     m_uiClient->didClickAlternativePresentationButton(*this, m_process->transformHandlesToObjects(userData.object()).get());
    6934 }
    6935 
    69366931#if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
    69376932void WebPageProxy::addPlaybackTargetPickerClient(uint64_t contextId)
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r226189 r226235  
    12471247#endif
    12481248
     1249#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
    12491250    void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, uint64_t webProcessContextId);
    12501251    void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, uint64_t webProcessContextId);
     1252    void removeStorageAccess(uint64_t frameID, uint64_t pageID);
     1253#endif
    12511254
    12521255#if ENABLE(ATTACHMENT_ELEMENT)
  • trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in

    r226189 r226235  
    506506    StopURLSchemeTask(uint64_t handlerIdentifier, uint64_t taskIdentifier)
    507507
     508#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
    508509    HasStorageAccess(String subFrameHost, String topFrameHost, uint64_t frameID, uint64_t pageID, uint64_t contextID)
    509510    RequestStorageAccess(String subFrameHost, String topFrameHost, uint64_t frameID, uint64_t pageID, uint64_t contextID)
     511    RemoveStorageAccess(uint64_t frameID, uint64_t pageID)
     512#endif
    510513
    511514#if ENABLE(ATTACHMENT_ELEMENT)
  • trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp

    r226088 r226235  
    11941194        processPool->sendToNetworkingProcess(Messages::NetworkProcess::RemovePrevalentDomains(m_sessionID, domains));
    11951195}
     1196
     1197void WebsiteDataStore::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback)
     1198{
     1199    if (!resourceLoadStatisticsEnabled()) {
     1200        callback(false);
     1201        return;
     1202    }
     1203   
     1204    m_resourceLoadStatistics->hasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, WTFMove(callback));
     1205}
     1206
     1207void WebsiteDataStore::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback)
     1208{
     1209    if (!resourceLoadStatisticsEnabled()) {
     1210        callback(false);
     1211        return;
     1212    }
     1213   
     1214    m_resourceLoadStatistics->requestStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, WTFMove(callback));
     1215}
     1216
     1217void WebsiteDataStore::removeStorageAccess(uint64_t frameID, uint64_t pageID)
     1218{
     1219    for (auto& processPool : processPools())
     1220        processPool->networkProcess()->removeStorageAccess(m_sessionID, frameID, pageID);
     1221}
    11961222#endif
    11971223
     
    14451471}
    14461472
    1447 void WebsiteDataStore::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback)
    1448 {
    1449     if (!resourceLoadStatisticsEnabled()) {
    1450         callback(false);
    1451         return;
    1452     }
    1453    
    1454     m_resourceLoadStatistics->hasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, WTFMove(callback));
    1455 }
    1456    
    1457 void WebsiteDataStore::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback)
    1458 {
    1459     if (!resourceLoadStatisticsEnabled()) {
    1460         callback(false);
    1461         return;
    1462     }
    1463 
    1464     m_resourceLoadStatistics->requestStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, WTFMove(callback));
    1465 }
    1466 
    14671473#if !PLATFORM(COCOA)
    14681474WebsiteDataStoreParameters WebsiteDataStore::parameters()
  • trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h

    r226088 r226235  
    122122    void updateStorageAccessForPrevalentDomainsHandler(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, bool value, WTF::CompletionHandler<void(bool wasGranted)>&& callback);
    123123    void removePrevalentDomains(const Vector<String>& domains);
     124    void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback);
     125    void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback);
     126    void removeStorageAccess(uint64_t frameID, uint64_t pageID);
    124127#endif
    125128    void networkProcessDidCrash();
     
    148151    void enableResourceLoadStatisticsAndSetTestingCallback(Function<void (const String&)>&& callback);
    149152
    150     void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback);
    151     void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback);
    152    
    153153    void setBoundInterfaceIdentifier(String&& identifier) { m_boundInterfaceIdentifier = WTFMove(identifier); }
    154154    const String& boundInterfaceIdentifier() { return m_boundInterfaceIdentifier; }
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp

    r226217 r226235  
    12541254}
    12551255
     1256#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
    12561257void WebChromeClient::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback)
    12571258{
     
    12631264    m_page.requestStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, WTFMove(callback));
    12641265}
     1266#endif
    12651267
    12661268} // namespace WebKit
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h

    r226217 r226235  
    349349    void didInvalidateDocumentMarkerRects() final;
    350350
     351#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
    351352    void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&&) final;
    352353    void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&&) final;
     354#endif
    353355
    354356    String m_cachedToolTip;
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp

    r226008 r226235  
    167167        return;
    168168
     169#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
     170    if (m_hasFrameSpecificStorageAccess) {
     171        webPage->send(Messages::WebPageProxy::RemoveStorageAccess(frameID().value(), pageID().value()));
     172        m_hasFrameSpecificStorageAccess = false;
     173    }
     174#endif
     175
    169176    RefPtr<API::Object> userData;
    170177
     
    371378
    372379    webPage->send(Messages::WebPageProxy::DidChangeMainDocument(m_frame->frameID()));
     380}
     381
     382void WebFrameLoaderClient::dispatchWillChangeDocument()
     383{
     384#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
     385    if (m_frame->isMainFrame())
     386        return;
     387
     388    WebPage* webPage = m_frame->page();
     389    if (!webPage)
     390        return;
     391
     392    if (m_hasFrameSpecificStorageAccess) {
     393        webPage->send(Messages::WebPageProxy::RemoveStorageAccess(frameID().value(), pageID().value()));
     394        m_hasFrameSpecificStorageAccess = false;
     395    }
     396#endif
    373397}
    374398
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h

    r225954 r226235  
    5656    PAL::SessionID sessionID() const final;
    5757
     58#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
     59    bool hasFrameSpecificStorageAccess() { return m_hasFrameSpecificStorageAccess; }
     60    void setHasFrameSpecificStorageAccess(bool value) { m_hasFrameSpecificStorageAccess = value; };
     61#endif
     62   
    5863private:
    5964    void frameLoaderDestroyed() final;
     
    9398#endif
    9499    void dispatchDidChangeMainDocument() final;
     100    void dispatchWillChangeDocument() final;
    95101
    96102    void dispatchDidDispatchOnloadEvents() final;
     
    274280    bool m_frameCameFromPageCache;
    275281    bool m_useIconLoadingClient { false };
     282#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
     283    bool m_hasFrameSpecificStorageAccess { false };
     284#endif
    276285};
    277286
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r226123 r226235  
    57995799}
    58005800
     5801#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
    58015802static uint64_t nextRequestStorageAccessContextId()
    58025803{
     
    58335834    callback(wasGranted);
    58345835}
     5836#endif
    58355837
    58365838void WebPage::invokeSharedBufferCallback(RefPtr<SharedBuffer>&& buffer, CallbackID callbackID)
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.h

    r226067 r226235  
    10331033    void flushPendingEditorStateUpdate();
    10341034
     1035#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
    10351036    void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback);
    10361037    void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback);
    10371038    void storageAccessResponse(bool wasGranted, uint64_t contextId);
     1039#endif
    10381040
    10391041#if ENABLE(ATTACHMENT_ELEMENT)
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in

    r226067 r226235  
    489489    URLSchemeTaskDidComplete(uint64_t handlerIdentifier, uint64_t taskIdentifier, WebCore::ResourceError error)
    490490
     491#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
    491492    StorageAccessResponse(bool wasGranted, uint64_t contextId)
     493#endif
    492494
    493495#if ENABLE(ATTACHMENT_ELEMENT)
Note: See TracChangeset for help on using the changeset viewer.