Diff
Modified: trunk/LayoutTests/ChangeLog (258671 => 258672)
--- trunk/LayoutTests/ChangeLog 2020-03-19 00:41:36 UTC (rev 258671)
+++ trunk/LayoutTests/ChangeLog 2020-03-19 01:26:16 UTC (rev 258672)
@@ -1,3 +1,39 @@
+2020-03-18 John Wilander <[email protected]>
+
+ WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener() should call its ephemeral counterpart when appropriate
+ https://bugs.webkit.org/show_bug.cgi?id=209245
+ <rdar://problem/60511121>
+
+ Reviewed by Chris Dumez.
+
+ There are new tests added for the code change. The rest of these change are to better
+ align test cases with asynchronous TestRunner functions that landed in
+ https://trac.webkit.org/changeset/258566 and https://trac.webkit.org/changeset/258598.
+
+ While working on the new tests, I found a crasher which Chris Dumez fixed in
+ https://trac.webkit.org/changeset/258562, so there's a dependency on that change.
+
+ * http/tests/resourceLoadStatistics/cookies-with-and-without-user-interaction-database.html:
+ * http/tests/resourceLoadStatistics/cookies-with-and-without-user-interaction.html:
+ * http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker-database.html:
+ * http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker.html:
+ * http/tests/resourceLoadStatistics/count-third-party-script-loads-database.html:
+ * http/tests/resourceLoadStatistics/count-third-party-script-loads.html:
+ * http/tests/resourceLoadStatistics/do-not-switch-session-on-navigation-to-prevalent-without-interaction-database.php:
+ * http/tests/resourceLoadStatistics/do-not-switch-session-on-navigation-to-prevalent-without-interaction.php:
+ * http/tests/resourceLoadStatistics/dont-count-third-party-image-as-third-party-script-database.html:
+ * http/tests/resourceLoadStatistics/dont-count-third-party-image-as-third-party-script.html:
+ * http/tests/resourceLoadStatistics/grandfathering-database.html:
+ * http/tests/resourceLoadStatistics/grandfathering.html:
+ * http/tests/resourceLoadStatistics/switch-session-on-navigation-to-prevalent-with-interaction-database.php:
+ * http/tests/resourceLoadStatistics/switch-session-on-navigation-to-prevalent-with-interaction.php:
+ * http/tests/storageAccess/deny-storage-access-under-opener-ephemeral-expected.txt: Added.
+ * http/tests/storageAccess/deny-storage-access-under-opener-ephemeral.html: Added.
+ * http/tests/storageAccess/deny-storage-access-under-opener-if-auto-dismiss-ephemeral-expected.txt: Added.
+ * http/tests/storageAccess/deny-storage-access-under-opener-if-auto-dismiss-ephemeral.html: Added.
+ * http/tests/storageAccess/grant-storage-access-under-opener-at-popup-user-gesture-ephemeral-expected.txt: Added.
+ * http/tests/storageAccess/grant-storage-access-under-opener-at-popup-user-gesture-ephemeral.html: Added.
+
2020-03-18 Ryan Haddad <[email protected]>
svg/as-object/object-box-sizing-no-width-height.html is a flaky failure
Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/cookies-with-and-without-user-interaction-database.html (258671 => 258672)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/cookies-with-and-without-user-interaction-database.html 2020-03-19 00:41:36 UTC (rev 258671)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/cookies-with-and-without-user-interaction-database.html 2020-03-19 01:26:16 UTC (rev 258672)
@@ -68,8 +68,8 @@
if (document.location.host === partitionHost && document.location.hash == "" && window.testRunner && window.internals) {
testRunner.setUseITPDatabase(true);
+ testRunner.waitUntilDone();
setEnableFeature(true, function() {
- testRunner.waitUntilDone();
testRunner.dumpChildFramesAsText();
document.location.hash = "step1";
if (testRunner.isStatisticsPrevalentResource(thirdPartyOrigin))
Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/cookies-with-and-without-user-interaction.html (258671 => 258672)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/cookies-with-and-without-user-interaction.html 2020-03-19 00:41:36 UTC (rev 258671)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/cookies-with-and-without-user-interaction.html 2020-03-19 01:26:16 UTC (rev 258672)
@@ -67,8 +67,8 @@
}
if (document.location.host === partitionHost && document.location.hash == "" && window.testRunner && window.internals) {
+ testRunner.waitUntilDone();
setEnableFeature(true, function() {
- testRunner.waitUntilDone();
testRunner.dumpChildFramesAsText();
document.location.hash = "step1";
if (testRunner.isStatisticsPrevalentResource(thirdPartyOrigin))
Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker-database.html (258671 => 258672)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker-database.html 2020-03-19 00:41:36 UTC (rev 258671)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker-database.html 2020-03-19 01:26:16 UTC (rev 258672)
@@ -26,9 +26,9 @@
switch (document.location.hash) {
case "":
if (window.testRunner && window.internals) {
+ testRunner.waitUntilDone();
setEnableFeature(true, function() {
testRunner.setUseITPDatabase(true);
- testRunner.waitUntilDone();
testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
testRunner.installStatisticsDidScanDataRecordsCallback(finishTest);
document.location.hash = "LoadWorker";
Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker.html (258671 => 258672)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker.html 2020-03-19 00:41:36 UTC (rev 258671)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker.html 2020-03-19 01:26:16 UTC (rev 258672)
@@ -26,8 +26,8 @@
switch (document.location.hash) {
case "":
if (window.testRunner && window.internals) {
+ testRunner.waitUntilDone();
setEnableFeature(true, function() {
- testRunner.waitUntilDone();
testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
testRunner.installStatisticsDidScanDataRecordsCallback(finishTest);
document.location.hash = "LoadWorker";
Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-loads-database.html (258671 => 258672)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-loads-database.html 2020-03-19 00:41:36 UTC (rev 258671)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-loads-database.html 2020-03-19 01:26:16 UTC (rev 258672)
@@ -22,9 +22,9 @@
switch (document.location.hash) {
case "":
if (window.testRunner && window.internals) {
+ testRunner.waitUntilDone();
setEnableFeature(true, function() {
testRunner.setUseITPDatabase(true);
- testRunner.waitUntilDone();
testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
testRunner.installStatisticsDidScanDataRecordsCallback(finishTest);
document.location.hash = "step1";
Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-loads.html (258671 => 258672)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-loads.html 2020-03-19 00:41:36 UTC (rev 258671)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-loads.html 2020-03-19 01:26:16 UTC (rev 258672)
@@ -22,8 +22,8 @@
switch (document.location.hash) {
case "":
if (window.testRunner && window.internals) {
+ testRunner.waitUntilDone();
setEnableFeature(true, function() {
- testRunner.waitUntilDone();
testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
testRunner.installStatisticsDidScanDataRecordsCallback(finishTest);
document.location.hash = "step1";
Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/do-not-switch-session-on-navigation-to-prevalent-without-interaction-database.php (258671 => 258672)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/do-not-switch-session-on-navigation-to-prevalent-without-interaction-database.php 2020-03-19 00:41:36 UTC (rev 258671)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/do-not-switch-session-on-navigation-to-prevalent-without-interaction-database.php 2020-03-19 01:26:16 UTC (rev 258672)
@@ -57,6 +57,17 @@
function runTest() {
switch (document.location.hash) {
+ case "":
+ if (document.location.origin !== prevalentOrigin)
+ testFailed("Test is not starting out on " + prevalentOrigin + ".");
+
+ testRunner.setUseITPDatabase(true);
+ setEnableFeature(true, function () {
+ if (testRunner.isStatisticsPrevalentResource(prevalentOrigin))
+ testFailed(prevalentOrigin + " was classified as prevalent resource before the test starts.");
+ document.location.hash = "step1";
+ runTest();
+ });
case "#step1":
setSessionCookie();
setPersistentCookie();
@@ -96,18 +107,6 @@
setEnableFeature(false, finishJSTest);
}
}
-
- if (document.location.hash === "") {
- if (document.location.origin !== prevalentOrigin)
- testFailed("Test is not starting out on " + prevalentOrigin + ".");
-
- testRunner.setUseITPDatabase(true);
- setEnableFeature(true, function () {
- if (testRunner.isStatisticsPrevalentResource(prevalentOrigin))
- testFailed(prevalentOrigin + " was classified as prevalent resource before the test starts.");
- document.location.hash = "step1";
- });
- }
</script>
</body>
</html>
Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/do-not-switch-session-on-navigation-to-prevalent-without-interaction.php (258671 => 258672)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/do-not-switch-session-on-navigation-to-prevalent-without-interaction.php 2020-03-19 00:41:36 UTC (rev 258671)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/do-not-switch-session-on-navigation-to-prevalent-without-interaction.php 2020-03-19 01:26:16 UTC (rev 258672)
@@ -57,6 +57,16 @@
function runTest() {
switch (document.location.hash) {
+ case "":
+ if (document.location.origin !== prevalentOrigin)
+ testFailed("Test is not starting out on " + prevalentOrigin + ".");
+
+ setEnableFeature(true, function () {
+ if (testRunner.isStatisticsPrevalentResource(prevalentOrigin))
+ testFailed(prevalentOrigin + " was classified as prevalent resource before the test starts.");
+ document.location.hash = "step1";
+ runTest();
+ });
case "#step1":
setSessionCookie();
setPersistentCookie();
@@ -96,16 +106,6 @@
setEnableFeature(false, finishJSTest);
}
}
-
- if (document.location.hash === "") {
- if (document.location.origin !== prevalentOrigin)
- testFailed("Test is not starting out on " + prevalentOrigin + ".");
- setEnableFeature(true, function () {
- if (testRunner.isStatisticsPrevalentResource(prevalentOrigin))
- testFailed(prevalentOrigin + " was classified as prevalent resource before the test starts.");
- document.location.hash = "step1";
- });
- }
</script>
</body>
</html>
Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/dont-count-third-party-image-as-third-party-script-database.html (258671 => 258672)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/dont-count-third-party-image-as-third-party-script-database.html 2020-03-19 00:41:36 UTC (rev 258671)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/dont-count-third-party-image-as-third-party-script-database.html 2020-03-19 01:26:16 UTC (rev 258672)
@@ -22,9 +22,9 @@
switch (document.location.hash) {
case "":
if (window.testRunner && window.internals) {
+ testRunner.waitUntilDone();
setEnableFeature(true, function() {
testRunner.setUseITPDatabase(true);
- testRunner.waitUntilDone();
testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
testRunner.installStatisticsDidScanDataRecordsCallback(finishTest);
document.location.hash = "step1";
Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/dont-count-third-party-image-as-third-party-script.html (258671 => 258672)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/dont-count-third-party-image-as-third-party-script.html 2020-03-19 00:41:36 UTC (rev 258671)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/dont-count-third-party-image-as-third-party-script.html 2020-03-19 01:26:16 UTC (rev 258672)
@@ -22,8 +22,8 @@
switch (document.location.hash) {
case "":
if (window.testRunner && window.internals) {
+ testRunner.waitUntilDone();
setEnableFeature(true, function() {
- testRunner.waitUntilDone();
testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
testRunner.installStatisticsDidScanDataRecordsCallback(finishTest);
document.location.hash = "step1";
Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/grandfathering-database.html (258671 => 258672)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/grandfathering-database.html 2020-03-19 00:41:36 UTC (rev 258671)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/grandfathering-database.html 2020-03-19 01:26:16 UTC (rev 258672)
@@ -100,11 +100,11 @@
if (document.location.hash === "" && window.testRunner && window.internals) {
testRunner.setUseITPDatabase(true);
+ testRunner.waitUntilDone();
setEnableFeature(true, function() {
testRunner.setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(false);
testRunner.setStatisticsMinimumTimeBetweenDataRecordsRemoval(0);
- testRunner.waitUntilDone();
testRunner.dumpChildFramesAsText();
document.location.hash = "step1";
runTest();
Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/grandfathering.html (258671 => 258672)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/grandfathering.html 2020-03-19 00:41:36 UTC (rev 258671)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/grandfathering.html 2020-03-19 01:26:16 UTC (rev 258672)
@@ -98,11 +98,11 @@
}
if (document.location.hash === "" && window.testRunner && window.internals) {
+ testRunner.waitUntilDone();
setEnableFeature(true, function() {
testRunner.setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(false);
testRunner.setStatisticsMinimumTimeBetweenDataRecordsRemoval(0);
- testRunner.waitUntilDone();
testRunner.dumpChildFramesAsText();
document.location.hash = "step1";
runTest();
Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/switch-session-on-navigation-to-prevalent-with-interaction-database.php (258671 => 258672)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/switch-session-on-navigation-to-prevalent-with-interaction-database.php 2020-03-19 00:41:36 UTC (rev 258671)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/switch-session-on-navigation-to-prevalent-with-interaction-database.php 2020-03-19 01:26:16 UTC (rev 258672)
@@ -57,6 +57,17 @@
function runTest() {
switch (document.location.hash) {
+ case "":
+ if (document.location.origin !== prevalentOrigin)
+ testFailed("Test is not starting out on " + prevalentOrigin + ".");
+ testRunner.setUseITPDatabase(true);
+ setEnableFeature(true, function () {
+ if (testRunner.isStatisticsPrevalentResource(prevalentOrigin))
+ testFailed(prevalentOrigin + " was classified as prevalent resource before the test starts.");
+ document.location.hash = "step1";
+ runTest();
+ });
+ break;
case "#step1":
testRunner.setStatisticsHasHadUserInteraction(prevalentOrigin, true, function() {
setSessionCookie();
@@ -98,17 +109,6 @@
setEnableFeature(false, finishJSTest);
}
}
-
- if (document.location.hash === "") {
- if (document.location.origin !== prevalentOrigin)
- testFailed("Test is not starting out on " + prevalentOrigin + ".");
- testRunner.setUseITPDatabase(true);
- setEnableFeature(true, function () {
- if (testRunner.isStatisticsPrevalentResource(prevalentOrigin))
- testFailed(prevalentOrigin + " was classified as prevalent resource before the test starts.");
- document.location.hash = "step1";
- });
- }
</script>
</body>
</html>
Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/switch-session-on-navigation-to-prevalent-with-interaction.php (258671 => 258672)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/switch-session-on-navigation-to-prevalent-with-interaction.php 2020-03-19 00:41:36 UTC (rev 258671)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/switch-session-on-navigation-to-prevalent-with-interaction.php 2020-03-19 01:26:16 UTC (rev 258672)
@@ -57,6 +57,16 @@
function runTest() {
switch (document.location.hash) {
+ case "":
+ if (document.location.origin !== prevalentOrigin)
+ testFailed("Test is not starting out on " + prevalentOrigin + ".");
+ setEnableFeature(true, function () {
+ if (testRunner.isStatisticsPrevalentResource(prevalentOrigin))
+ testFailed(prevalentOrigin + " was classified as prevalent resource before the test starts.");
+ document.location.hash = "step1";
+ runTest();
+ });
+ break;
case "#step1":
testRunner.setStatisticsHasHadUserInteraction(prevalentOrigin, true, function() {
setSessionCookie();
@@ -98,16 +108,6 @@
setEnableFeature(false, finishJSTest);
}
}
-
- if (document.location.hash === "") {
- if (document.location.origin !== prevalentOrigin)
- testFailed("Test is not starting out on " + prevalentOrigin + ".");
- setEnableFeature(true, function () {
- if (testRunner.isStatisticsPrevalentResource(prevalentOrigin))
- testFailed(prevalentOrigin + " was classified as prevalent resource before the test starts.");
- document.location.hash = "step1";
- });
- }
</script>
</body>
</html>
Added: trunk/LayoutTests/http/tests/storageAccess/deny-storage-access-under-opener-ephemeral-expected.txt (0 => 258672)
--- trunk/LayoutTests/http/tests/storageAccess/deny-storage-access-under-opener-ephemeral-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/storageAccess/deny-storage-access-under-opener-ephemeral-expected.txt 2020-03-19 01:26:16 UTC (rev 258672)
@@ -0,0 +1,17 @@
+Tests that a cross-origin window without user interaction is denied storage access under its opener (ephemeral).
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Cookie created.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
+--------
+Frame: '<!--frame1-->'
+--------
+Should not receive first-party cookie.
+Did not receive cookie named 'firstPartyCookie'.
+Client-side document.cookie:
Added: trunk/LayoutTests/http/tests/storageAccess/deny-storage-access-under-opener-ephemeral.html (0 => 258672)
--- trunk/LayoutTests/http/tests/storageAccess/deny-storage-access-under-opener-ephemeral.html (rev 0)
+++ trunk/LayoutTests/http/tests/storageAccess/deny-storage-access-under-opener-ephemeral.html 2020-03-19 01:26:16 UTC (rev 258672)
@@ -0,0 +1,66 @@
+<!-- webkit-test-runner [ useEphemeralSession=true ] -->
+<!DOCTYPE html>
+<html>
+<head>
+ <script src=""
+ <script src=""
+</head>
+<body _onload_="run()">
+<script>
+ description("Tests that a cross-origin window without user interaction is denied storage access under its opener (ephemeral).");
+ jsTestIsAsync = true;
+
+ window.addEventListener("message", receiveMessage, false);
+
+ function finishTest() {
+ testRunner.setStatisticsShouldBlockThirdPartyCookies(false, function() {
+ setEnableFeature(false, finishJSTest);
+ });
+ }
+
+ function openIframe(url, onLoadHandler) {
+ const element = document.createElement("iframe");
+ element.src = ""
+ if (onLoadHandler) {
+ element._onload_ = onLoadHandler;
+ }
+ document.body.appendChild(element);
+ }
+
+ function receiveMessage(event) {
+ if (event.origin === "http://localhost:8000") {
+ if (event.data.indexOf("PASS") !== -1)
+ testPassed(event.data.replace("PASS ", ""));
+ else
+ testFailed(event.data);
+ } else
+ testFailed("Received a message from an unexpected origin: " + event.origin);
+
+ newWin.close();
+ openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should not receive first-party cookie.", finishTest);
+ }
+
+ const thirdPartyOrigin = "http://localhost:8000";
+ const resourcePath = "/storageAccess/resources";
+ const thirdPartyBaseUrl = thirdPartyOrigin + resourcePath;
+ const firstPartyCookieName = "firstPartyCookie";
+ const subPathToGetCookies = "/get-cookies.php?name1=" + firstPartyCookieName;
+ let newWin;
+
+ function run() {
+ setEnableFeature(true, function () {
+ testRunner.setCanOpenWindows();
+
+ if (testRunner.isStatisticsHasHadUserInteraction(thirdPartyOrigin))
+ testFailed("Host logged for user interaction.");
+ testRunner.dumpChildFramesAsText();
+ testRunner.setCloseRemainingWindowsWhenComplete(true);
+
+ testRunner.setStatisticsShouldBlockThirdPartyCookies(true, function() {
+ newWin = window.open(thirdPartyOrigin + "/storageAccess/resources/set-cookie-and-report-back.html", "testWindow");
+ });
+ });
+ }
+</script>
+</body>
+</html>
\ No newline at end of file
Added: trunk/LayoutTests/http/tests/storageAccess/deny-storage-access-under-opener-if-auto-dismiss-ephemeral-expected.txt (0 => 258672)
--- trunk/LayoutTests/http/tests/storageAccess/deny-storage-access-under-opener-if-auto-dismiss-ephemeral-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/storageAccess/deny-storage-access-under-opener-if-auto-dismiss-ephemeral-expected.txt 2020-03-19 01:26:16 UTC (rev 258672)
@@ -0,0 +1,17 @@
+Tests that a cross-origin window with non-recent user interaction doesn't get storage access under its opener if it just loads and auto-dismisses (ephemeral).
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Cookie created.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
+--------
+Frame: '<!--frame1-->'
+--------
+Should not receive first-party cookie.
+Did not receive cookie named 'firstPartyCookie'.
+Client-side document.cookie:
Added: trunk/LayoutTests/http/tests/storageAccess/deny-storage-access-under-opener-if-auto-dismiss-ephemeral.html (0 => 258672)
--- trunk/LayoutTests/http/tests/storageAccess/deny-storage-access-under-opener-if-auto-dismiss-ephemeral.html (rev 0)
+++ trunk/LayoutTests/http/tests/storageAccess/deny-storage-access-under-opener-if-auto-dismiss-ephemeral.html 2020-03-19 01:26:16 UTC (rev 258672)
@@ -0,0 +1,68 @@
+<!-- webkit-test-runner [ useEphemeralSession=true ] -->
+<!DOCTYPE html>
+<html>
+<head>
+ <script src=""
+ <script src=""
+</head>
+<body _onload_="run()">
+<script>
+ description("Tests that a cross-origin window with non-recent user interaction doesn't get storage access under its opener if it just loads and auto-dismisses (ephemeral).");
+ jsTestIsAsync = true;
+
+ function finishTest() {
+ testRunner.setStatisticsShouldBlockThirdPartyCookies(false, function() {
+ setEnableFeature(false, finishJSTest);
+ });
+ }
+
+ function openIframe(url, onLoadHandler) {
+ const element = document.createElement("iframe");
+ element.src = ""
+ if (onLoadHandler) {
+ element._onload_ = onLoadHandler;
+ }
+ document.body.appendChild(element);
+ }
+
+ function receiveMessage(event) {
+ if (event.origin === "http://localhost:8000") {
+ if (event.data.indexOf("PASS") !== -1)
+ testPassed(event.data.replace("PASS ", ""));
+ else
+ testFailed(event.data);
+ } else
+ testFailed("Received a message from an unexpected origin: " + event.origin);
+
+ newWin.close();
+ openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should not receive first-party cookie.", finishTest);
+ }
+
+ const thirdPartyOrigin = "http://localhost:8000";
+ const resourcePath = "/storageAccess/resources";
+ const thirdPartyBaseUrl = thirdPartyOrigin + resourcePath;
+ const firstPartyCookieName = "firstPartyCookie";
+ const subPathToGetCookies = "/get-cookies.php?name1=" + firstPartyCookieName;
+ let newWin;
+
+ function run() {
+ setEnableFeature(true, function() {
+ window.addEventListener("message", receiveMessage, false);
+
+ testRunner.setCanOpenWindows();
+
+ testRunner.setStatisticsHasHadUserInteraction(thirdPartyOrigin, true, function() {
+ if (!testRunner.isStatisticsHasHadUserInteraction(thirdPartyOrigin))
+ testFailed("Host did not get logged for user interaction.");
+ testRunner.dumpChildFramesAsText();
+ testRunner.setCloseRemainingWindowsWhenComplete(true);
+
+ testRunner.setStatisticsShouldBlockThirdPartyCookies(true, function () {
+ newWin = window.open(thirdPartyOrigin + "/storageAccess/resources/set-cookie-and-report-back.html", "testWindow");
+ });
+ });
+ });
+ }
+</script>
+</body>
+</html>
\ No newline at end of file
Added: trunk/LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener-at-popup-user-gesture-ephemeral-expected.txt (0 => 258672)
--- trunk/LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener-at-popup-user-gesture-ephemeral-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener-at-popup-user-gesture-ephemeral-expected.txt 2020-03-19 01:26:16 UTC (rev 258672)
@@ -0,0 +1,17 @@
+Tests that a cross-origin window from a prevalent domain with previous user interaction gets storage access under its opener if it gets user interaction (ephemeral).
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Cookie created.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
+--------
+Frame: '<!--frame1-->'
+--------
+Should receive first-party cookie.
+Received cookie named 'firstPartyCookie'.
+Client-side document.cookie: firstPartyCookie=value
Added: trunk/LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener-at-popup-user-gesture-ephemeral.html (0 => 258672)
--- trunk/LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener-at-popup-user-gesture-ephemeral.html (rev 0)
+++ trunk/LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener-at-popup-user-gesture-ephemeral.html 2020-03-19 01:26:16 UTC (rev 258672)
@@ -0,0 +1,67 @@
+<!-- webkit-test-runner [ useEphemeralSession=true ] -->
+<!DOCTYPE html>
+<html>
+<head>
+ <script src=""
+ <script src=""
+</head>
+<body _onload_="run()">
+<script>
+ description("Tests that a cross-origin window from a prevalent domain with previous user interaction gets storage access under its opener if it gets user interaction (ephemeral).");
+ jsTestIsAsync = true;
+
+ function finishTest() {
+ testRunner.setStatisticsShouldBlockThirdPartyCookies(false, function () {
+ setEnableFeature(false, finishJSTest);
+ });
+ }
+
+ function openIframe(url, onLoadHandler) {
+ const element = document.createElement("iframe");
+ element.src = ""
+ if (onLoadHandler) {
+ element._onload_ = onLoadHandler;
+ }
+ document.body.appendChild(element);
+ }
+
+ function receiveMessage(event) {
+ if (event.origin === "http://localhost:8000") {
+ if (event.data.indexOf("PASS") !== -1)
+ testPassed(event.data.replace("PASS ", ""));
+ else
+ testFailed(event.data);
+ } else
+ testFailed("Received a message from an unexpected origin: " + event.origin);
+
+ newWin.close();
+ openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive first-party cookie.", finishTest);
+ }
+
+ const thirdPartyOrigin = "http://localhost:8000";
+ const resourcePath = "/storageAccess/resources";
+ const thirdPartyBaseUrl = thirdPartyOrigin + resourcePath;
+ const firstPartyCookieName = "firstPartyCookie";
+ const subPathToGetCookies = "/get-cookies.php?name1=" + firstPartyCookieName;
+ let newWin;
+
+ function run() {
+ setEnableFeature(true, function () {
+ window.addEventListener("message", receiveMessage, false);
+
+ testRunner.setCanOpenWindows();
+ testRunner.setStatisticsHasHadUserInteraction(thirdPartyOrigin, true, function() {
+ if (!testRunner.isStatisticsHasHadUserInteraction(thirdPartyOrigin))
+ testFailed("Host did not get logged for user interaction.");
+ testRunner.dumpChildFramesAsText();
+ testRunner.setCloseRemainingWindowsWhenComplete(true);
+
+ testRunner.setStatisticsShouldBlockThirdPartyCookies(true, function () {
+ newWin = window.open(thirdPartyOrigin + "/storageAccess/resources/produce-user-gesture-set-cookie-and-report-back.html", "testWindow");
+ });
+ });
+ });
+ }
+</script>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/Source/WebKit/ChangeLog (258671 => 258672)
--- trunk/Source/WebKit/ChangeLog 2020-03-19 00:41:36 UTC (rev 258671)
+++ trunk/Source/WebKit/ChangeLog 2020-03-19 01:26:16 UTC (rev 258672)
@@ -1,3 +1,22 @@
+2020-03-18 John Wilander <[email protected]>
+
+ WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener() should call its ephemeral counterpart when appropriate
+ https://bugs.webkit.org/show_bug.cgi?id=209245
+ <rdar://problem/60511121>
+
+ Reviewed by Chris Dumez.
+
+ This change makes sure that WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener()
+ calls WebResourceLoadStatisticsStore::requestStorageAccessUnderOpenerEphemeral() for ephemeral
+ sessions.
+
+ Tests: http/tests/storageAccess/deny-storage-access-under-opener-ephemeral.html
+ http/tests/storageAccess/deny-storage-access-under-opener-if-auto-dismiss-ephemeral.html
+ http/tests/storageAccess/grant-storage-access-under-opener-at-popup-user-gesture-ephemeral.html
+
+ * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
+ (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
+
2020-03-18 Brent Fulgham <[email protected]>
Avoid calling 'notifyThisWebProcessPoolWasCreated' inside the constructor
Modified: trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp (258671 => 258672)
--- trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp 2020-03-19 00:41:36 UTC (rev 258671)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp 2020-03-19 01:26:16 UTC (rev 258672)
@@ -484,6 +484,9 @@
{
ASSERT(RunLoop::isMain());
+ if (isEphemeral())
+ return requestStorageAccessUnderOpenerEphemeral(WTFMove(domainInNeedOfStorageAccess), openerPageID, WTFMove(openerDomain));
+
// It is safe to move the strings to the background queue without isolated copy here because they are r-value references
// coming from IPC. Strings which are safe to move to other threads as long as nobody on this thread holds a reference
// to those strings.
Modified: trunk/Tools/ChangeLog (258671 => 258672)
--- trunk/Tools/ChangeLog 2020-03-19 00:41:36 UTC (rev 258671)
+++ trunk/Tools/ChangeLog 2020-03-19 01:26:16 UTC (rev 258672)
@@ -1,3 +1,31 @@
+2020-03-18 John Wilander <[email protected]>
+
+ WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener() should call its ephemeral counterpart when appropriate
+ https://bugs.webkit.org/show_bug.cgi?id=209245
+ <rdar://problem/60511121>
+
+ Reviewed by Chris Dumez.
+
+ These changes to the TestRunner makes sure that
+ - statisticsClearInMemoryAndPersistentStore()
+ - statisticsClearInMemoryAndPersistentStoreModifiedSinceHours()
+ ... use their own StatisticsDidClearInMemoryAndPersistentStoreCallbackID
+ and adds the infrastructure for that.
+
+ * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+ (WTR::InjectedBundle::didReceiveMessageToPage):
+ * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+ (WTR::TestRunner::statisticsClearInMemoryAndPersistentStore):
+ (WTR::TestRunner::statisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
+ (WTR::TestRunner::statisticsCallClearInMemoryAndPersistentStoreCallback):
+ * WebKitTestRunner/InjectedBundle/TestRunner.h:
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::statisticsClearInMemoryAndPersistentStore):
+ (WTR::TestController::statisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
+ * WebKitTestRunner/TestInvocation.cpp:
+ (WTR::TestInvocation::didClearStatisticsInMemoryAndPersistentStore):
+ * WebKitTestRunner/TestInvocation.h:
+
2020-03-18 Wenson Hsieh <[email protected]>
REGRESSION (r257214): Targeted preview animates to the wrong place when dropping in editable content
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (258671 => 258672)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp 2020-03-19 00:41:36 UTC (rev 258671)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp 2020-03-19 01:26:16 UTC (rev 258672)
@@ -327,6 +327,11 @@
return;
}
+ if (WKStringIsEqualToUTF8CString(messageName, "CallDidClearStatisticsInMemoryAndPersistentStore")) {
+ m_testRunner->statisticsCallClearInMemoryAndPersistentStoreCallback();
+ return;
+ }
+
if (WKStringIsEqualToUTF8CString(messageName, "CallDidClearStatisticsThroughWebsiteDataRemoval")) {
m_testRunner->statisticsCallClearThroughWebsiteDataRemovalCallback();
return;
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (258671 => 258672)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2020-03-19 00:41:36 UTC (rev 258671)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2020-03-19 01:26:16 UTC (rev 258672)
@@ -748,6 +748,7 @@
StatisticsDidScanDataRecordsCallbackID,
StatisticsDidRunTelemetryCallbackID,
StatisticsDidClearThroughWebsiteDataRemovalCallbackID,
+ StatisticsDidClearInMemoryAndPersistentStoreCallbackID,
StatisticsDidResetToConsistentStateCallbackID,
StatisticsDidSetBlockCookiesForHostCallbackID,
StatisticsDidSetShouldDowngradeReferrerCallbackID,
@@ -2143,7 +2144,7 @@
void TestRunner::statisticsClearInMemoryAndPersistentStore(JSValueRef callback)
{
- cacheTestRunnerCallback(StatisticsDidClearThroughWebsiteDataRemovalCallbackID, callback);
+ cacheTestRunnerCallback(StatisticsDidClearInMemoryAndPersistentStoreCallbackID, callback);
WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("StatisticsClearInMemoryAndPersistentStore"));
WKBundlePostMessage(InjectedBundle::singleton().bundle(), messageName.get(), nullptr);
@@ -2151,7 +2152,7 @@
void TestRunner::statisticsClearInMemoryAndPersistentStoreModifiedSinceHours(unsigned hours, JSValueRef callback)
{
- cacheTestRunnerCallback(StatisticsDidClearThroughWebsiteDataRemovalCallbackID, callback);
+ cacheTestRunnerCallback(StatisticsDidClearInMemoryAndPersistentStoreCallbackID, callback);
WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("StatisticsClearInMemoryAndPersistentStoreModifiedSinceHours"));
WKRetainPtr<WKTypeRef> messageBody = adoptWK(WKUInt64Create(hours));
@@ -2275,6 +2276,11 @@
m_hasSetFirstPartyWebsiteDataRemovalModeCallback = false;
}
+void TestRunner::statisticsCallClearInMemoryAndPersistentStoreCallback()
+{
+ callTestRunnerCallback(StatisticsDidClearInMemoryAndPersistentStoreCallbackID);
+}
+
void TestRunner::statisticsCallClearThroughWebsiteDataRemovalCallback()
{
callTestRunnerCallback(StatisticsDidClearThroughWebsiteDataRemovalCallbackID);
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (258671 => 258672)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2020-03-19 00:41:36 UTC (rev 258671)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2020-03-19 01:26:16 UTC (rev 258672)
@@ -437,6 +437,7 @@
void statisticsClearInMemoryAndPersistentStoreModifiedSinceHours(unsigned hours, JSValueRef callback);
void statisticsClearThroughWebsiteDataRemoval(JSValueRef callback);
void statisticsDeleteCookiesForHost(JSStringRef hostName, bool includeHttpOnlyCookies);
+ void statisticsCallClearInMemoryAndPersistentStoreCallback();
void statisticsCallClearThroughWebsiteDataRemovalCallback();
bool isStatisticsHasLocalStorage(JSStringRef hostName);
void setStatisticsCacheMaxAgeCap(double seconds);
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (258671 => 258672)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2020-03-19 00:41:36 UTC (rev 258671)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2020-03-19 01:26:16 UTC (rev 258672)
@@ -3631,7 +3631,7 @@
ResourceStatisticsCallbackContext context(*this);
WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStore(websiteDataStore(), &context, resourceStatisticsVoidResultCallback);
runUntil(context.done, noTimeout);
- m_currentInvocation->didClearStatisticsThroughWebsiteDataRemoval();
+ m_currentInvocation->didClearStatisticsInMemoryAndPersistentStore();
}
void TestController::statisticsClearInMemoryAndPersistentStoreModifiedSinceHours(unsigned hours)
@@ -3639,7 +3639,7 @@
ResourceStatisticsCallbackContext context(*this);
WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours(websiteDataStore(), hours, &context, resourceStatisticsVoidResultCallback);
runUntil(context.done, noTimeout);
- m_currentInvocation->didClearStatisticsThroughWebsiteDataRemoval();
+ m_currentInvocation->didClearStatisticsInMemoryAndPersistentStore();
}
void TestController::statisticsClearThroughWebsiteDataRemoval()
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (258671 => 258672)
--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2020-03-19 00:41:36 UTC (rev 258671)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2020-03-19 01:26:16 UTC (rev 258672)
@@ -1880,6 +1880,12 @@
WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()->page(), messageName.get(), 0);
}
+void TestInvocation::didClearStatisticsInMemoryAndPersistentStore()
+{
+ WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("CallDidClearStatisticsInMemoryAndPersistentStore"));
+ WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()->page(), messageName.get(), 0);
+}
+
void TestInvocation::didClearStatisticsThroughWebsiteDataRemoval()
{
WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("CallDidClearStatisticsThroughWebsiteDataRemoval"));
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.h (258671 => 258672)
--- trunk/Tools/WebKitTestRunner/TestInvocation.h 2020-03-19 00:41:36 UTC (rev 258671)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.h 2020-03-19 01:26:16 UTC (rev 258672)
@@ -72,6 +72,7 @@
void notifyDownloadDone();
+ void didClearStatisticsInMemoryAndPersistentStore();
void didClearStatisticsThroughWebsiteDataRemoval();
void didSetShouldDowngradeReferrer();
void didSetShouldBlockThirdPartyCookies();