Changeset 226235 in webkit
- Timestamp:
- Dec 21, 2017 11:56:45 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 50 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r226234 r226235 1 2017-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 1 44 2017-12-21 Antoine Quint <graouts@apple.com> 2 45 -
trunk/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction-expected.txt
r226016 r226235 4 4 5 5 6 PASS No storage access. 6 PASS No storage access. document.cookie == , cookies seen server-side == "No cookies" 7 7 PASS successfullyParsed is true 8 8 -
trunk/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction-expected.txt
r226016 r226235 4 4 5 5 6 PASS Has storage access. 6 PASS Has storage access. document.cookie == , cookies seen server-side == "No cookies" 7 7 PASS successfullyParsed is true 8 8 -
trunk/LayoutTests/http/tests/storageAccess/request-and-deny-storage-access-cross-origin-iframe-expected.txt
r225583 r226235 4 4 5 5 6 PASS Storage access was denied. 6 PASS Storage access was denied. document.cookie == , cookies seen server-side == "No cookies" 7 7 PASS successfullyParsed is true 8 8 -
trunk/LayoutTests/http/tests/storageAccess/request-and-deny-storage-access-cross-origin-sandboxed-iframe-expected.txt
r225583 r226235 5 5 6 6 7 PASS Storage access was denied. 7 PASS Storage access was denied. document.cookie == , cookies seen server-side == "No cookies" 8 8 PASS successfullyParsed is true 9 9 -
trunk/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe-expected.txt
r225583 r226235 4 4 5 5 6 PASS Storage access was denied. 6 PASS Storage access was denied. document.cookie == , cookies seen server-side == "No cookies" 7 7 PASS successfullyParsed is true 8 8 -
trunk/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-expected.txt
r225583 r226235 5 5 6 6 7 PASS Storage access was granted. 7 PASS Storage access was granted. document.cookie == , cookies seen server-side == "No cookies" 8 8 PASS successfullyParsed is true 9 9 -
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 5 5 6 6 7 PASS Storage access was granted. 7 PASS Storage access was granted. document.cookie == firstPartyCookie=value, cookies seen server-side == {"firstPartyCookie":"value"} 8 8 PASS successfullyParsed is true 9 9 … … 14 14 Frame: 'TheIframeThatRequestsStorageAccess' 15 15 -------- 16 After access granted, should receive first-party cookie.17 Receivedcookie named 'firstPartyCookie'.18 Did not receivecookie named 'partitionedCookie'.19 Client-side document.cookie: firstPartyCookie=value16 After the top frame navigates the sub frame, the sub frame should no longer have access to first-party cookies. 17 Did not receive cookie named 'firstPartyCookie'. 18 Received cookie named 'partitionedCookie'. 19 Client-side document.cookie: partitionedCookie=value 20 20 21 21 -------- -
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 115 115 document.location.hash = "step8"; 116 116 // 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."; 118 118 break; 119 119 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 5 5 6 6 7 PASS Storage access was granted. 7 PASS Storage access was granted. document.cookie == firstPartyCookie=value, cookies seen server-side == {"firstPartyCookie":"value"} 8 8 PASS successfullyParsed is true 9 9 -
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 5 5 6 6 7 PASS Storage access was granted. 7 PASS Storage access was granted. document.cookie == , cookies seen server-side == "No cookies" 8 8 PASS successfullyParsed is true 9 9 -
trunk/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction-expected.txt
r225583 r226235 5 5 6 6 7 PASS Storage access was denied. 7 PASS Storage access was denied. document.cookie == , cookies seen server-side == "No cookies" 8 8 PASS successfullyParsed is true 9 9 -
trunk/LayoutTests/http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-nested-iframe-expected.txt
r225583 r226235 4 4 5 5 6 PASS Storage access was denied. 6 PASS Storage access was denied. document.cookie == , cookies seen server-side == "No cookies" 7 7 PASS successfullyParsed is true 8 8 -
trunk/LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin-expected.txt
r225583 r226235 4 4 5 5 6 PASS Storage access was denied .6 PASS Storage access was denied for origin null. 7 7 PASS successfullyParsed is true 8 8 -
trunk/LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin.html
r222941 r226235 47 47 </head> 48 48 <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> 50 50 </body> 51 51 </html> -
trunk/LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-allow-token-expected.txt
r225583 r226235 4 4 5 5 6 PASS Storage access was denied. 6 PASS Storage access was denied. document.cookie == , cookies seen server-side == "No cookies" 7 7 PASS successfullyParsed is true 8 8 -
trunk/LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-iframe-expected.txt
r225583 r226235 4 4 5 5 6 PASS Storage access was granted. 6 PASS Storage access was granted. document.cookie == , cookies seen server-side == "No cookies" 7 7 PASS successfullyParsed is true 8 8 -
trunk/LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe-expected.txt
r225583 r226235 4 4 5 5 6 PASS Storage access was granted. 6 PASS Storage access was granted. document.cookie == , cookies seen server-side == "No cookies" 7 7 PASS successfullyParsed is true 8 8 -
trunk/LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe-without-allow-token-expected.txt
r225583 r226235 4 4 5 5 6 PASS Storage access was granted. 6 PASS Storage access was granted. document.cookie == , cookies seen server-side == "No cookies" 7 7 PASS successfullyParsed is true 8 8 -
trunk/LayoutTests/http/tests/storageAccess/resources/has-storage-access-iframe.html
r226016 r226235 3 3 <script> 4 4 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 } 5 10 6 11 function checkHasStorageAccess() { … … 9 14 function (hasAccess) { 10 15 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 }); 12 23 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 }); 14 31 else 15 top.postMessage("FAIL " +32 messageToTop("FAIL " + 16 33 (hasAccess ? "Storage " : "No storage ") + 17 34 "access when there should " + 18 35 (policyShouldGrantAccess ? "" : "not ") + 19 "have been access." , "http://127.0.0.1:8000");36 "have been access."); 20 37 }, 21 38 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); 23 40 } 24 41 ); -
trunk/LayoutTests/http/tests/storageAccess/resources/request-storage-access-iframe.html
r225583 r226235 6 6 const userShouldBeConsulted = hashArguments[1] === "userShouldBeConsulted"; 7 7 const policyShouldGrantAccess = hashArguments[2] === "policyShouldGrantAccess"; 8 const isSameOriginIframe = hashArguments[3] === "isSameOriginIframe"; 9 const originIsNull = hashArguments[4] === "originIsNull"; 8 10 9 11 if (internals && userShouldGrantAccess) … … 11 13 12 14 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 } 13 44 14 45 function makeRequestWithUserGesture() { … … 33 64 && hasAccess 34 65 && (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 38 76 && !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 " + 43 91 (hasAccess ? "" : "not ") + 44 92 "granted and requestStorageAccessResolved was " + … … 46 94 "granted but should " + 47 95 (userShouldGrantAccess && policyShouldGrantAccess ? "" : "not ") + 48 "have been granted." , "http://127.0.0.1:8000");96 "have been granted."); 49 97 }, 50 98 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); 52 100 } 53 101 ); -
trunk/LayoutTests/http/tests/storageAccess/resources/self-navigating-frame-after-granted-access.html
r226234 r226235 8 8 9 9 if (internals && userShouldGrantAccess) 10 10 internals.setUserGrantsStorageAccess(true); 11 11 12 12 var requestStorageAccessResolved; … … 24 24 } 25 25 ); 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); 26 36 } 27 37 … … 47 57 (userShouldGrantAccess && policyShouldGrantAccess ? "" : "not ") + 48 58 "have been granted.", "http://127.0.0.1:8000"); 59 setTimeout("setCookieAndNavigate()", 200); 49 60 }, 50 61 function (reason) { … … 53 64 ); 54 65 } 66 67 top.postMessage("document.cookie == " + document.cookie, "http://127.0.0.1:8000"); 55 68 </script> 56 69 </head> -
trunk/LayoutTests/platform/mac-wk2/TestExpectations
r226233 r226235 767 767 [ HighSierra+ ] http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction.html [ Pass ] 768 768 [ 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 ] 769 771 770 772 webkit.org/b/173861 [ Release ] http/tests/webrtc/filtering-ice-candidate-same-origin-frame.html [ Pass Timeout ] -
trunk/LayoutTests/platform/wk2/TestExpectations
r226227 r226235 690 690 webkit.org/b/180703 http/tests/resourceLoadStatistics/telemetry-generation.html [ Pass Failure ] 691 691 http/tests/resourceLoadStatistics/prune-statistics.html [ Pass ] 692 http/tests/storageAccess/request-storage-access-top-frame.html [ Pass ]693 692 http/tests/resourceLoadStatistics [ Pass ] 694 693 # Cookie partitioning is only supported in macOS High Sierra and iOS 11. -
trunk/Source/WebCore/ChangeLog
r226234 r226235 1 2017-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 1 29 2017-12-21 Antoine Quint <graouts@apple.com> 2 30 -
trunk/Source/WebCore/dom/Document.cpp
r226190 r226235 7433 7433 ASSERT(settings().storageAccessAPIEnabled()); 7434 7434 7435 if (m_hasFrameSpecificStorageAccess) { 7435 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) 7436 if (hasFrameSpecificStorageAccess()) { 7436 7437 promise->resolve<IDLBoolean>(true); 7437 7438 return; … … 7455 7456 } 7456 7457 7457 ASSERT(m_frame);7458 7458 auto frameID = m_frame->loader().client().frameID(); 7459 7459 auto pageID = m_frame->loader().client().pageID(); … … 7475 7475 return; 7476 7476 } 7477 #endif 7477 7478 7478 7479 promise->reject(); … … 7483 7484 ASSERT(settings().storageAccessAPIEnabled()); 7484 7485 7485 if (m_hasFrameSpecificStorageAccess) 7486 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) 7487 if (hasFrameSpecificStorageAccess()) { 7486 7488 promise->resolve(); 7489 return; 7490 } 7487 7491 7488 7492 if (!m_frame || securityOrigin().isUnique()) { … … 7547 7551 7548 7552 if (wasGranted) { 7549 document-> m_hasFrameSpecificStorageAccess = true;7553 document->setHasFrameSpecificStorageAccess(true); 7550 7554 promise->resolve(); 7551 7555 } else … … 7554 7558 return; 7555 7559 } 7560 #endif 7561 7562 promise->reject(); 7563 } 7564 7565 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) 7566 bool Document::hasFrameSpecificStorageAccess() const 7567 { 7568 return m_frame->loader().client().hasFrameSpecificStorageAccess(); 7569 } 7556 7570 7557 promise->reject(); 7558 } 7571 void Document::setHasFrameSpecificStorageAccess(bool value) 7572 { 7573 m_frame->loader().client().setHasFrameSpecificStorageAccess(value); 7574 } 7575 #endif 7559 7576 7560 7577 void Document::setConsoleMessageListener(RefPtr<StringCallback>&& listener) -
trunk/Source/WebCore/dom/Document.h
r225990 r226235 1700 1700 void didLogMessage(const WTFLogChannel&, WTFLogLevel, Vector<JSONLogValue>&&) final; 1701 1701 1702 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) 1703 bool hasFrameSpecificStorageAccess() const; 1704 void setHasFrameSpecificStorageAccess(bool); 1705 #endif 1706 1702 1707 #if ENABLE(DEVICE_ORIENTATION) && PLATFORM(IOS) 1703 1708 std::unique_ptr<DeviceMotionClient> m_deviceMotionClient; -
trunk/Source/WebCore/loader/DocumentLoader.cpp
r226200 r226235 535 535 newRequest.setFirstPartyForCookies(newRequest.url()); 536 536 537 if (!didReceiveRedirectResponse) 538 frameLoader()->client().dispatchWillChangeDocument(); 539 537 540 // If we're fielding a redirect in response to a POST, force a load from origin, since 538 541 // 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 201 201 RefPtr<PreviewLoaderClient> createPreviewLoaderClient(const String&, const String&) final { return nullptr; } 202 202 #endif 203 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) 204 bool hasFrameSpecificStorageAccess() final { return false; } 205 void setHasFrameSpecificStorageAccess(bool) final { } 206 #endif 203 207 }; 204 208 -
trunk/Source/WebCore/loader/FrameLoaderClient.h
r225934 r226235 162 162 virtual void dispatchWillPerformClientRedirect(const URL&, double interval, double fireDate) = 0; 163 163 virtual void dispatchDidChangeMainDocument() { } 164 virtual void dispatchWillChangeDocument() { } 164 165 virtual void dispatchDidNavigateWithinPage() { } 165 166 virtual void dispatchDidChangeLocationWithinPage() = 0; … … 365 366 virtual void finishedLoadingApplicationManifest(uint64_t, const std::optional<ApplicationManifest>&) { } 366 367 #endif 368 369 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) 370 virtual bool hasFrameSpecificStorageAccess() { return false; } 371 virtual void setHasFrameSpecificStorageAccess(bool) { } 372 #endif 367 373 }; 368 374 -
trunk/Source/WebCore/platform/network/NetworkStorageSession.h
r225827 r226235 101 101 WEBCORE_EXPORT bool isStorageAccessGranted(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID) const; 102 102 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); 103 104 #endif 104 105 #elif USE(SOUP) -
trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp
r225827 r226235 334 334 } 335 335 336 void 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 336 345 #endif // HAVE(CFNETWORK_STORAGE_PARTITIONING) 337 346 -
trunk/Source/WebKit/ChangeLog
r226231 r226235 1 2017-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 1 38 2017-12-21 Jeremy Jones <jeremyj@apple.com> 2 39 -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp
r226226 r226235 361 361 } 362 362 363 void 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 363 371 void NetworkProcess::removePrevalentDomains(PAL::SessionID sessionID, const Vector<String>& domains) 364 372 { -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.h
r226226 r226235 141 141 void hasStorageAccessForPrevalentDomains(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, uint64_t contextId); 142 142 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); 143 144 void removePrevalentDomains(PAL::SessionID, const Vector<String>& domains); 144 145 #endif -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in
r226016 r226235 86 86 HasStorageAccessForPrevalentDomains(PAL::SessionID sessionID, String resourceDomain, String firstPartyDomain, uint64_t frameID, uint64_t pageID, uint64_t contextId) 87 87 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); 88 89 RemovePrevalentDomains(PAL::SessionID sessionID, Vector<String> domainsWithInteraction); 89 90 #endif -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
r226016 r226235 425 425 } 426 426 427 void NetworkProcessProxy::removeStorageAccess(PAL::SessionID sessionID, uint64_t frameID, uint64_t pageID) 428 { 429 send(Messages::NetworkProcess::RemoveStorageAccess(sessionID, frameID, pageID), 0); 430 } 431 427 432 void NetworkProcessProxy::storageAccessRequestResult(bool wasGranted, uint64_t contextId) 428 433 { -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
r226016 r226235 81 81 void hasStorageAccessForPrevalentDomains(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& callback); 82 82 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); 83 84 #endif 84 85 -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r226189 r226235 7183 7183 } 7184 7184 7185 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) 7185 7186 void WebPageProxy::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, uint64_t webProcessContextId) 7186 7187 { … … 7198 7199 } 7199 7200 7201 void WebPageProxy::removeStorageAccess(uint64_t frameID, uint64_t pageID) 7202 { 7203 ASSERT(pageID == m_pageID); 7204 m_websiteDataStore->removeStorageAccess(frameID, pageID); 7205 } 7206 #endif 7207 7200 7208 #if PLATFORM(COCOA) 7201 7209 void WebPageProxy::touchBarMenuDataChanged(const TouchBarMenuData& touchBarMenuData) -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp.orig
r226189 r226235 6929 6929 } 6930 6930 6931 void WebPageProxy::handleAlternativePresentationButtonClick(const UserData& userData)6932 {6933 m_uiClient->didClickAlternativePresentationButton(*this, m_process->transformHandlesToObjects(userData.object()).get());6934 }6935 6936 6931 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS) 6937 6932 void WebPageProxy::addPlaybackTargetPickerClient(uint64_t contextId) -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r226189 r226235 1247 1247 #endif 1248 1248 1249 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) 1249 1250 void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, uint64_t webProcessContextId); 1250 1251 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 1251 1254 1252 1255 #if ENABLE(ATTACHMENT_ELEMENT) -
trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in
r226189 r226235 506 506 StopURLSchemeTask(uint64_t handlerIdentifier, uint64_t taskIdentifier) 507 507 508 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) 508 509 HasStorageAccess(String subFrameHost, String topFrameHost, uint64_t frameID, uint64_t pageID, uint64_t contextID) 509 510 RequestStorageAccess(String subFrameHost, String topFrameHost, uint64_t frameID, uint64_t pageID, uint64_t contextID) 511 RemoveStorageAccess(uint64_t frameID, uint64_t pageID) 512 #endif 510 513 511 514 #if ENABLE(ATTACHMENT_ELEMENT) -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
r226088 r226235 1194 1194 processPool->sendToNetworkingProcess(Messages::NetworkProcess::RemovePrevalentDomains(m_sessionID, domains)); 1195 1195 } 1196 1197 void 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 1207 void 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 1217 void WebsiteDataStore::removeStorageAccess(uint64_t frameID, uint64_t pageID) 1218 { 1219 for (auto& processPool : processPools()) 1220 processPool->networkProcess()->removeStorageAccess(m_sessionID, frameID, pageID); 1221 } 1196 1222 #endif 1197 1223 … … 1445 1471 } 1446 1472 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 1467 1473 #if !PLATFORM(COCOA) 1468 1474 WebsiteDataStoreParameters WebsiteDataStore::parameters() -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
r226088 r226235 122 122 void updateStorageAccessForPrevalentDomainsHandler(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, bool value, WTF::CompletionHandler<void(bool wasGranted)>&& callback); 123 123 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); 124 127 #endif 125 128 void networkProcessDidCrash(); … … 148 151 void enableResourceLoadStatisticsAndSetTestingCallback(Function<void (const String&)>&& callback); 149 152 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 153 153 void setBoundInterfaceIdentifier(String&& identifier) { m_boundInterfaceIdentifier = WTFMove(identifier); } 154 154 const String& boundInterfaceIdentifier() { return m_boundInterfaceIdentifier; } -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
r226217 r226235 1254 1254 } 1255 1255 1256 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) 1256 1257 void WebChromeClient::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback) 1257 1258 { … … 1263 1264 m_page.requestStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, WTFMove(callback)); 1264 1265 } 1266 #endif 1265 1267 1266 1268 } // namespace WebKit -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
r226217 r226235 349 349 void didInvalidateDocumentMarkerRects() final; 350 350 351 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) 351 352 void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&&) final; 352 353 void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&&) final; 354 #endif 353 355 354 356 String m_cachedToolTip; -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
r226008 r226235 167 167 return; 168 168 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 169 176 RefPtr<API::Object> userData; 170 177 … … 371 378 372 379 webPage->send(Messages::WebPageProxy::DidChangeMainDocument(m_frame->frameID())); 380 } 381 382 void 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 373 397 } 374 398 -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
r225954 r226235 56 56 PAL::SessionID sessionID() const final; 57 57 58 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) 59 bool hasFrameSpecificStorageAccess() { return m_hasFrameSpecificStorageAccess; } 60 void setHasFrameSpecificStorageAccess(bool value) { m_hasFrameSpecificStorageAccess = value; }; 61 #endif 62 58 63 private: 59 64 void frameLoaderDestroyed() final; … … 93 98 #endif 94 99 void dispatchDidChangeMainDocument() final; 100 void dispatchWillChangeDocument() final; 95 101 96 102 void dispatchDidDispatchOnloadEvents() final; … … 274 280 bool m_frameCameFromPageCache; 275 281 bool m_useIconLoadingClient { false }; 282 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) 283 bool m_hasFrameSpecificStorageAccess { false }; 284 #endif 276 285 }; 277 286 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r226123 r226235 5799 5799 } 5800 5800 5801 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) 5801 5802 static uint64_t nextRequestStorageAccessContextId() 5802 5803 { … … 5833 5834 callback(wasGranted); 5834 5835 } 5836 #endif 5835 5837 5836 5838 void WebPage::invokeSharedBufferCallback(RefPtr<SharedBuffer>&& buffer, CallbackID callbackID) -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r226067 r226235 1033 1033 void flushPendingEditorStateUpdate(); 1034 1034 1035 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) 1035 1036 void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback); 1036 1037 void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback); 1037 1038 void storageAccessResponse(bool wasGranted, uint64_t contextId); 1039 #endif 1038 1040 1039 1041 #if ENABLE(ATTACHMENT_ELEMENT) -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in
r226067 r226235 489 489 URLSchemeTaskDidComplete(uint64_t handlerIdentifier, uint64_t taskIdentifier, WebCore::ResourceError error) 490 490 491 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) 491 492 StorageAccessResponse(bool wasGranted, uint64_t contextId) 493 #endif 492 494 493 495 #if ENABLE(ATTACHMENT_ELEMENT)
Note: See TracChangeset
for help on using the changeset viewer.