Changeset 235569 in webkit
- Timestamp:
- Aug 31, 2018, 2:09:36 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
- 2 copied
- 2 moved
-
LayoutTests/ChangeLog (modified) (1 diff)
-
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 (modified) (2 diffs)
-
LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame.html (modified) (1 diff)
-
LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-cross-site-should-not-have-access-expected.txt (moved) (moved from trunk/LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access-expected.txt ) (1 diff)
-
LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-cross-site-should-not-have-access.html (moved) (moved from trunk/LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access.html ) (3 diffs)
-
LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-same-site-should-have-access-expected.txt (copied) (copied from trunk/LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access-expected.txt ) (2 diffs)
-
LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-same-site-should-have-access.html (copied) (copied from trunk/LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access.html ) (3 diffs)
-
LayoutTests/http/tests/storageAccess/resources/get-cookies.php (modified) (1 diff)
-
LayoutTests/http/tests/storageAccess/resources/self-navigating-frame-after-granted-access.html (modified) (2 diffs)
-
LayoutTests/platform/mac-wk2/TestExpectations (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/dom/Document.h (modified) (1 diff)
-
Source/WebCore/loader/DocumentLoader.cpp (modified) (1 diff)
-
Source/WebCore/loader/FrameLoaderClient.h (modified) (1 diff)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (modified) (3 diffs)
-
Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r235568 r235569 1 2018-08-31 John Wilander <wilander@apple.com> 2 3 Storage Access API: Maintain access through same-site navigations 4 https://bugs.webkit.org/show_bug.cgi?id=188564 5 <rdar://problem/43445160> 6 7 Reviewed by Alex Christensen. 8 9 * http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame-expected.txt: 10 * http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame.html: 11 Added both a same-site and a cross-site navigation to the sub frame to test maintained and cleared access. 12 * 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. 13 * 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. 14 * 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. 15 * 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. 16 * http/tests/storageAccess/resources/get-cookies.php: 17 Support for the new test scenarios. 18 * http/tests/storageAccess/resources/self-navigating-frame-after-granted-access.html: 19 Support for the new test scenarios. 20 * platform/mac-wk2/TestExpectations: 21 Marked the new and the renamed tests as [ Pass ]. 22 1 23 2018-08-30 Ryosuke Niwa <rniwa@webkit.org> 2 24 -
trunk/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
r234440 r235569 5 5 6 6 PASS Storage access was granted. document.cookie == firstPartyCookie=value, cookies seen server-side == {"firstPartyCookie":"value"} 7 Did navigate iframe same-site and will now check that it still has storage access. 8 PASS document.cookie == firstPartyCookie=value, cookies seen server-side == {"firstPartyCookie":"value"} 7 9 PASS successfullyParsed is true 8 10 … … 43 45 Frame: '<!--frame5-->' 44 46 -------- 45 After the top frame navigates the sub frame , the sub frame should no longer have access to cookies.47 After the top frame navigates the sub frame cross-site and back, the sub frame should no longer have access to cookies. 46 48 Did not receive cookie named 'firstPartyCookie'. 47 49 Did not receive cookie named 'partitionedCookie'. -
trunk/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame.html
r234440 r235569 120 120 case "#step7": 121 121 document.location.hash = "step8"; 122 // Check that no cookie gets sent for localhost under 127.0.0.1 since we're opening in the frame that was granted access. 123 let existingIframe = document.getElementById("TheIframeThatRequestsStorageAccess"); 124 existingIframe.onload = runTest; 125 existingIframe.src = thirdPartyBaseUrl + subPathToGetCookies + "&message=After the top frame navigates the sub frame, the sub frame should no longer have access to cookies."; 122 // Navigate the frame same-site. 123 let existingIframe1 = document.getElementById("TheIframeThatRequestsStorageAccess"); 124 existingIframe1.onload = function () { 125 debug("Did navigate iframe same-site and will now check that it still has storage access."); 126 let iframe = document.getElementById("TheIframeThatRequestsStorageAccess"); 127 iframe.contentWindow.postMessage("reportBackCookies", "http://localhost:8000"); 128 }; 129 existingIframe1.src = thirdPartyBaseUrl + subPathToGetCookies; 126 130 break; 127 131 case "#step8": 132 document.location.hash = "step9"; 133 // Navigate the frame cross-site. This should clear out storage access. 134 let existingIframe2 = document.getElementById("TheIframeThatRequestsStorageAccess"); 135 existingIframe2.onload = runTest; 136 existingIframe2.src = "http://" + partitionHost; 137 break; 138 case "#step9": 139 document.location.hash = "step10"; 140 // 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. 141 let existingIframe3 = document.getElementById("TheIframeThatRequestsStorageAccess"); 142 existingIframe3.onload = runTest; 143 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."; 144 break; 145 case "#step10": 128 146 setEnableFeature(false, finishJSTest); 129 147 break; -
trunk/LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-cross-site-should-not-have-access-expected.txt
r235568 r235569 1 Tests that a cross-origin iframe from a prevalent domain that is granted storage access and then navigates itself does not have storage access.1 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. 2 2 3 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". -
trunk/LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-cross-site-should-not-have-access.html
r235568 r235569 6 6 <script src="/resourceLoadStatistics/resources/util.js"></script> 7 7 <script> 8 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.");8 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."); 9 9 jsTestIsAsync = true; 10 10 … … 64 64 if (document.location.hash !== "#firstPartyCookieSet") { 65 65 setEnableFeature(true, function() { 66 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";66 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"; 67 67 }); 68 68 } else { … … 78 78 iframeElement.onload = runTest; 79 79 iframeElement.id = "TheIframeThatRequestsStorageAccess"; 80 iframeElement.src = "http://localhost:8000/storageAccess/resources/self-navigating-frame-after-granted-access.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess ";80 iframeElement.src = "http://localhost:8000/storageAccess/resources/self-navigating-frame-after-granted-access.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess,crossSiteNavigation"; 81 81 document.body.appendChild(iframeElement); 82 82 }); -
trunk/LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-same-site-should-have-access-expected.txt
r235568 r235569 1 Tests that a cross-origin iframe from a prevalent domain that is granted storage access and then navigates itself does not havestorage access.1 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. 2 2 3 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". … … 7 7 PASS Storage access was granted. 8 8 PASS document.cookie == cookieSetClientSideAfterGrantedStorageAccess=value; firstPartyCookie=value 9 PASS No storage access. document.cookie == , cookies seen server-side == "No cookies"9 PASS Has storage access. document.cookie == cookieSetClientSideAfterGrantedStorageAccess=value; firstPartyCookie=value, cookies seen server-side == {"cookieSetClientSideAfterGrantedStorageAccess":"value","firstPartyCookie":"value"} 10 10 PASS successfullyParsed is true 11 11 -
trunk/LayoutTests/http/tests/storageAccess/request-and-grant-access-then-navigate-same-site-should-have-access.html
r235568 r235569 6 6 <script src="/resourceLoadStatistics/resources/util.js"></script> 7 7 <script> 8 description("Tests that a cross-origin iframe from a prevalent domain that is granted storage access and then navigates itself does not havestorage access.");8 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."); 9 9 jsTestIsAsync = true; 10 10 … … 64 64 if (document.location.hash !== "#firstPartyCookieSet") { 65 65 setEnableFeature(true, function() { 66 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-s hould-not-have-access.html#firstPartyCookieSet";66 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"; 67 67 }); 68 68 } else { … … 78 78 iframeElement.onload = runTest; 79 79 iframeElement.id = "TheIframeThatRequestsStorageAccess"; 80 iframeElement.src = "http://localhost:8000/storageAccess/resources/self-navigating-frame-after-granted-access.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess ";80 iframeElement.src = "http://localhost:8000/storageAccess/resources/self-navigating-frame-after-granted-access.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess,sameSiteNavigation"; 81 81 document.body.appendChild(iframeElement); 82 82 }); -
trunk/LayoutTests/http/tests/storageAccess/resources/get-cookies.php
r225006 r235569 22 22 <script> 23 23 document.getElementById("output").textContent = "Client-side document.cookie: " + document.cookie; 24 25 function messageToTop(messagePrefix, fetchData) { 26 top.postMessage(messagePrefix + " document.cookie == " + document.cookie + 27 (fetchData ? ", cookies seen server-side == " + JSON.stringify(fetchData) : ""), "http://127.0.0.1:8000"); 28 } 29 30 function receiveMessage(event) { 31 if (event.origin === "http://127.0.0.1:8000") { 32 if (event.data.indexOf("reportBackCookies") !== -1) { 33 fetch("echo-incoming-cookies-as-json.php", { credentials: "same-origin" }).then(function(response) { 34 return response.json(); 35 }).then(function(data) { 36 messageToTop("PASS", data); 37 }).catch(function(error) { 38 console.log(error.message); 39 }); 40 } else { 41 messageToTop("FAIL Unknown request."); 42 } 43 } else { 44 messageToTop("Fail Received a message from an unexpected origin: " + event.origin); 45 } 46 } 47 48 window.addEventListener("message", receiveMessage, false); 24 49 </script> -
trunk/LayoutTests/http/tests/storageAccess/resources/self-navigating-frame-after-granted-access.html
r226235 r235569 6 6 const userShouldBeConsulted = hashArguments[1] === "userShouldBeConsulted"; 7 7 const policyShouldGrantAccess = hashArguments[2] === "policyShouldGrantAccess"; 8 const sameSiteNavigation = hashArguments[3] === "sameSiteNavigation"; 8 9 9 10 if (internals && userShouldGrantAccess) … … 27 28 28 29 function navigate() { 29 document.location.href = "http://localhost:8000/storageAccess/resources/has-storage-access-iframe.html#policyShouldNotGrantAccess" 30 if (sameSiteNavigation) { 31 document.location.href = "http://localhost:8000/storageAccess/resources/has-storage-access-iframe.html#policyShouldGrantAccess"; 32 } else { 33 document.location.href = "http://127.0.0.1:8000/resourceLoadStatistics/resources/redirect.php?redirectTo=http://localhost:8000/storageAccess/resources/has-storage-access-iframe.html"; 34 } 30 35 } 31 36 -
trunk/LayoutTests/platform/mac-wk2/TestExpectations
r235488 r235569 696 696 [ HighSierra+ ] http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-user-interaction.html [ Pass ] 697 697 [ HighSierra+ ] http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access.html [ Pass ] 698 [ HighSierra+ ] http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access.html [ Pass ] 698 [ HighSierra+ ] http/tests/storageAccess/request-and-grant-access-then-navigate-cross-site-should-not-have-access.html [ Pass ] 699 [ HighSierra+ ] http/tests/storageAccess/request-and-grant-access-then-navigate-same-site-should-have-access.html [ Pass ] 699 700 [ HighSierra+ ] http/tests/storageAccess/deny-storage-access-under-opener.html [ Pass ] 700 701 [ HighSierra+ ] http/tests/storageAccess/grant-storage-access-under-opener.html [ Pass ] -
trunk/Source/WebCore/ChangeLog
r235563 r235569 1 2018-08-31 John Wilander <wilander@apple.com> 2 3 Storage Access API: Maintain access through same-site navigations 4 https://bugs.webkit.org/show_bug.cgi?id=188564 5 <rdar://problem/43445160> 6 7 Reviewed by Alex Christensen. 8 9 Tests: http/tests/storageAccess/request-and-grant-access-then-navigate-cross-site-should-not-have-access.html 10 http/tests/storageAccess/request-and-grant-access-then-navigate-same-site-should-have-access.html 11 12 * dom/Document.h: 13 Removed unused member variable m_hasFrameSpecificStorageAccess. 14 * loader/DocumentLoader.cpp: 15 (WebCore::DocumentLoader::willSendRequest): 16 * loader/FrameLoaderClient.h: 17 1 18 2018-08-31 Youenn Fablet <youenn@apple.com> 2 19 -
trunk/Source/WebCore/dom/Document.h
r235539 r235569 1996 1996 static bool hasEverCreatedAnAXObjectCache; 1997 1997 1998 bool m_hasFrameSpecificStorageAccess { false };1999 1998 bool m_grantStorageAccessOverride { false }; 2000 1999 -
trunk/Source/WebCore/loader/DocumentLoader.cpp
r234995 r235569 601 601 602 602 if (!didReceiveRedirectResponse) 603 frameLoader()->client().dispatchWillChangeDocument( );603 frameLoader()->client().dispatchWillChangeDocument(m_frame->document()->url(), newRequest.url()); 604 604 605 605 // If we're fielding a redirect in response to a POST, force a load from origin, since -
trunk/Source/WebCore/loader/FrameLoaderClient.h
r235562 r235569 167 167 virtual void dispatchWillPerformClientRedirect(const URL&, double interval, WallTime fireDate) = 0; 168 168 virtual void dispatchDidChangeMainDocument() { } 169 virtual void dispatchWillChangeDocument( ) { }169 virtual void dispatchWillChangeDocument(const URL&, const URL&) { } 170 170 virtual void dispatchDidNavigateWithinPage() { } 171 171 virtual void dispatchDidChangeLocationWithinPage() = 0; -
trunk/Source/WebKit/ChangeLog
r235562 r235569 1 2018-08-31 John Wilander <wilander@apple.com> 2 3 Storage Access API: Maintain access through same-site navigations 4 https://bugs.webkit.org/show_bug.cgi?id=188564 5 <rdar://problem/43445160> 6 7 Reviewed by Alex Christensen. 8 9 * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: 10 (WebKit::WebFrameLoaderClient::dispatchWillChangeDocument): 11 Now takes the current URL and the new URL as parameters 12 and only clears out storage access if the navigation is 13 cross-site, i.e. with differing eTLD+1s. 14 * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: 15 1 16 2018-08-31 Chris Dumez <cdumez@apple.com> 2 17 -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
r235562 r235569 84 84 #include <WebCore/ProgressTracker.h> 85 85 #include <WebCore/ResourceError.h> 86 #include <WebCore/ResourceRequest.h> 86 87 #include <WebCore/ScriptController.h> 87 88 #include <WebCore/SecurityOriginData.h> … … 384 385 } 385 386 386 void WebFrameLoaderClient::dispatchWillChangeDocument( )387 void WebFrameLoaderClient::dispatchWillChangeDocument(const URL& currentUrl, const URL& newUrl) 387 388 { 388 389 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) … … 394 395 return; 395 396 396 if (m_hasFrameSpecificStorageAccess ) {397 if (m_hasFrameSpecificStorageAccess && !WebCore::registrableDomainsAreEqual(currentUrl, newUrl)) { 397 398 WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::RemoveStorageAccessForFrame(sessionID(), frameID().value(), pageID().value()), 0); 398 399 m_hasFrameSpecificStorageAccess = false; -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
r235562 r235569 98 98 #endif 99 99 void dispatchDidChangeMainDocument() final; 100 void dispatchWillChangeDocument( ) final;100 void dispatchWillChangeDocument(const WebCore::URL& currentUrl, const WebCore::URL& newUrl) final; 101 101 102 102 void dispatchDidDispatchOnloadEvents() final;
Note:
See TracChangeset
for help on using the changeset viewer.