Diff
Modified: branches/safari-608-branch/LayoutTests/ChangeLog (250492 => 250493)
--- branches/safari-608-branch/LayoutTests/ChangeLog 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/LayoutTests/ChangeLog 2019-09-29 23:50:52 UTC (rev 250493)
@@ -1,3 +1,59 @@
+2019-09-29 Babak Shafiei <bshaf...@apple.com>
+
+ Apply patch. rdar://problem/55801087
+
+ 2019-09-29 John Wilander <wilan...@apple.com>
+
+ Cherry-pick r250413.
+
+ Patch by Kate Cheney <katherine_che...@apple.com> on 2019-09-26.
+
+ Resource Load Statistics: Downgrade all third-party referrer headers
+ https://bugs.webkit.org/show_bug.cgi?id=201353
+ <rdar://problem/54895650>
+
+ Majority of this patch was written by John Wilander <wilan...@apple.com>
+
+ Reviewed by Brent Fulgham.
+
+ The changes in the two http/tests/resourceLoadStatistics/strip-referrer-to-origin*
+ tests and the http/tests/navigation/ping-attribute/* tests are for the functional
+ change. The other changes are to make use of the new
+ testRunner.setStatisticsShouldDowngradeReferrer() to maintain earlier functionality.
+
+ TestRunner::setStatisticsShouldDowngradeReferrer() function is not
+ supported for mac-wk1, win or wincairo.
+
+ * http/tests/blink/sendbeacon/beacon-cross-origin-expected.txt:
+ * http/tests/navigation/ping-attribute/anchor-cross-origin.html:
+ * http/tests/navigation/ping-attribute/area-cross-origin.html:
+ * http/tests/referrer-policy/no-referrer-when-downgrade/cross-origin-http-http.html:
+ * http/tests/referrer-policy/no-referrer-when-downgrade/cross-origin-http.https.html:
+ * http/tests/referrer-policy/no-referrer-when-downgrade/same-origin.html:
+ * http/tests/referrer-policy/unsafe-url/cross-origin-http-http.html:
+ * http/tests/referrer-policy/unsafe-url/cross-origin-http.https.html:
+ * http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects-expected.txt:
+ * http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects.html:
+ * http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-requests-expected.txt:
+ * http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-requests.html:
+ * http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-redirects-expected.txt: Copied from LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects-expected.txt.
+ * http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-redirects.html: Copied from LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects.html.
+ * http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-requests-expected.txt: Copied from LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-requests-expected.txt.
+ * http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-requests.html: Copied from LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects.html.
+ * http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies-when-private-browsing-enabled.php:
+ * http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies.php:
+ * http/tests/security/referrer-policy-header.html:
+ * platform/ios-wk2/TestExpectations:
+ * platform/ios/TestExpectations:
+ * platform/mac-wk1/TestExpectations:
+ * platform/mac-wk2/TestExpectations:
+ * platform/win/TestExpectations:
+ * platform/wincairo/TestExpectations:
+ * platform/wk2/TestExpectations:
+ * resources/js-test.js:
+ (downgradeReferrerCallback):
+ * resources/testharnessreport.js:
+
2019-09-27 Alan Coon <alanc...@apple.com>
Cherry-pick r250432. rdar://problem/55801091
Modified: branches/safari-608-branch/LayoutTests/http/tests/blink/sendbeacon/beacon-cross-origin-expected.txt (250492 => 250493)
--- branches/safari-608-branch/LayoutTests/http/tests/blink/sendbeacon/beacon-cross-origin-expected.txt 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/LayoutTests/http/tests/blink/sendbeacon/beacon-cross-origin-expected.txt 2019-09-29 23:50:52 UTC (rev 250493)
@@ -7,7 +7,7 @@
PASS Beacon sent successfully
PASS Content-Type: text/plain;charset=UTF-8
PASS Origin: http://127.0.0.1:8000
-PASS Referer: http://127.0.0.1:8000/blink/sendbeacon/beacon-cross-origin.html
+PASS Referer: http://127.0.0.1:8000/
PASS Request-Method: POST
PASS Length: 11
PASS Body: CrossOrigin
Modified: branches/safari-608-branch/LayoutTests/http/tests/navigation/ping-attribute/anchor-cross-origin.html (250492 => 250493)
--- branches/safari-608-branch/LayoutTests/http/tests/navigation/ping-attribute/anchor-cross-origin.html 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/LayoutTests/http/tests/navigation/ping-attribute/anchor-cross-origin.html 2019-09-29 23:50:52 UTC (rev 250493)
@@ -10,6 +10,7 @@
function test() {
if (!testCalled) {
if (window.testRunner && window.internals) {
+ testRunner.setStatisticsShouldDowngradeReferrer(false, function () { });
testRunner.dumpAsText();
internals.settings.setHyperlinkAuditingEnabled(true);
testRunner.waitUntilDone();
Modified: branches/safari-608-branch/LayoutTests/http/tests/navigation/ping-attribute/area-cross-origin.html (250492 => 250493)
--- branches/safari-608-branch/LayoutTests/http/tests/navigation/ping-attribute/area-cross-origin.html 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/LayoutTests/http/tests/navigation/ping-attribute/area-cross-origin.html 2019-09-29 23:50:52 UTC (rev 250493)
@@ -5,6 +5,7 @@
<script>
if (window.testRunner && window.internals) {
testRunner.dumpAsText();
+ testRunner.setStatisticsShouldDowngradeReferrer(false, function () { });
internals.settings.setHyperlinkAuditingEnabled(true);
testRunner.waitUntilDone();
}
Modified: branches/safari-608-branch/LayoutTests/http/tests/referrer-policy/no-referrer-when-downgrade/cross-origin-http-http.html (250492 => 250493)
--- branches/safari-608-branch/LayoutTests/http/tests/referrer-policy/no-referrer-when-downgrade/cross-origin-http-http.html 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/LayoutTests/http/tests/referrer-policy/no-referrer-when-downgrade/cross-origin-http-http.html 2019-09-29 23:50:52 UTC (rev 250493)
@@ -15,7 +15,14 @@
shouldBeEqualToString("referrer", "http://127.0.0.1:8000/referrer-policy/no-referrer-when-downgrade/cross-origin-http-http.html");
finishJSTest();
}
+
+if (window.testRunner) {
+ testRunner.setStatisticsShouldDowngradeReferrer(false, function () {
+ let iframeElement = document.createElement("iframe");
+ iframeElement.src = ""
+ document.body.appendChild(iframeElement);
+ });
+}
</script>
-<iframe src=""
</body>
</html>
Modified: branches/safari-608-branch/LayoutTests/http/tests/referrer-policy/no-referrer-when-downgrade/cross-origin-http.https.html (250492 => 250493)
--- branches/safari-608-branch/LayoutTests/http/tests/referrer-policy/no-referrer-when-downgrade/cross-origin-http.https.html 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/LayoutTests/http/tests/referrer-policy/no-referrer-when-downgrade/cross-origin-http.https.html 2019-09-29 23:50:52 UTC (rev 250493)
@@ -18,7 +18,14 @@
shouldBeEqualToString("referrer", "");
finishJSTest();
}
+
+if (window.testRunner) {
+ testRunner.setStatisticsShouldDowngradeReferrer(false, function () {
+ let iframeElement = document.createElement("iframe");
+ iframeElement.src = ""
+ document.body.appendChild(iframeElement);
+ });
+}
</script>
-<iframe src=""
</body>
</html>
Modified: branches/safari-608-branch/LayoutTests/http/tests/referrer-policy/no-referrer-when-downgrade/same-origin.html (250492 => 250493)
--- branches/safari-608-branch/LayoutTests/http/tests/referrer-policy/no-referrer-when-downgrade/same-origin.html 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/LayoutTests/http/tests/referrer-policy/no-referrer-when-downgrade/same-origin.html 2019-09-29 23:50:52 UTC (rev 250493)
@@ -15,7 +15,14 @@
shouldBeEqualToString("referrer", "http://127.0.0.1:8000/referrer-policy/no-referrer-when-downgrade/same-origin.html");
finishJSTest();
}
+
+if (window.testRunner) {
+ testRunner.setStatisticsShouldDowngradeReferrer(false, function () {
+ let iframeElement = document.createElement("iframe");
+ iframeElement.src = ""
+ document.body.appendChild(iframeElement);
+ });
+}
</script>
-<iframe src=""
</body>
</html>
Modified: branches/safari-608-branch/LayoutTests/http/tests/referrer-policy/unsafe-url/cross-origin-http-http.html (250492 => 250493)
--- branches/safari-608-branch/LayoutTests/http/tests/referrer-policy/unsafe-url/cross-origin-http-http.html 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/LayoutTests/http/tests/referrer-policy/unsafe-url/cross-origin-http-http.html 2019-09-29 23:50:52 UTC (rev 250493)
@@ -15,7 +15,14 @@
shouldBeEqualToString("referrer", "http://127.0.0.1:8000/referrer-policy/unsafe-url/cross-origin-http-http.html");
finishJSTest();
}
+
+if (window.testRunner) {
+ testRunner.setStatisticsShouldDowngradeReferrer(false, function () {
+ let iframeElement = document.createElement("iframe");
+ iframeElement.src = ""
+ document.body.appendChild(iframeElement);
+ });
+}
</script>
-<iframe src=""
</body>
</html>
Modified: branches/safari-608-branch/LayoutTests/http/tests/referrer-policy/unsafe-url/cross-origin-http.https.html (250492 => 250493)
--- branches/safari-608-branch/LayoutTests/http/tests/referrer-policy/unsafe-url/cross-origin-http.https.html 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/LayoutTests/http/tests/referrer-policy/unsafe-url/cross-origin-http.https.html 2019-09-29 23:50:52 UTC (rev 250493)
@@ -18,7 +18,14 @@
shouldBeEqualToString("referrer", "https://127.0.0.1:8443/referrer-policy/unsafe-url/cross-origin-http.https.html");
finishJSTest();
}
+
+if (window.testRunner) {
+ testRunner.setStatisticsShouldDowngradeReferrer(false, function () {
+ let iframeElement = document.createElement("iframe");
+ iframeElement.src = ""
+ document.body.appendChild(iframeElement);
+ });
+}
</script>
-<iframe src=""
</body>
</html>
Deleted: branches/safari-608-branch/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects-expected.txt (250492 => 250493)
--- branches/safari-608-branch/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects-expected.txt 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects-expected.txt 2019-09-29 23:50:52 UTC (rev 250493)
@@ -1,15 +0,0 @@
-Tests that only the origin is sent as referrer in redirects to prevalent resources without user interaction.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS referrer is "http://127.0.0.1:8000/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects.html"
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
-
---------
-Frame: '<!--frame1-->'
---------
-http://127.0.0.1:8000/
Deleted: branches/safari-608-branch/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects.html (250492 => 250493)
--- branches/safari-608-branch/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects.html 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects.html 2019-09-29 23:50:52 UTC (rev 250493)
@@ -1,50 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <script src=""
- <script src=""
-</head>
-<body>
-<script>
- description("Tests that only the origin is sent as referrer in redirects to prevalent resources without user interaction.");
- jsTestIsAsync = true;
- testRunner.dumpChildFramesAsText();
-
- function openIframe(url, onLoadHandler) {
- const element = document.createElement("iframe");
- element.src = ""
- if (onLoadHandler) {
- element._onload_ = onLoadHandler;
- }
- document.body.appendChild(element);
- }
-
- var referrer;
- setEnableFeature(true, function() {
- if (testRunner.isStatisticsPrevalentResource("http://localhost"))
- testFailed("Localhost was classified as prevalent resource before the test started.");
-
- fetch("resources/echo-referrer.php").then(function(response) {
- return response.text();
- }).then(function(data) {
- referrer = data;
- shouldBeEqualToString("referrer", "http://127.0.0.1:8000/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects.html");
-
- testRunner.setStatisticsPrevalentResource("http://localhost", true, function() {
- if (!testRunner.isStatisticsPrevalentResource("http://localhost"))
- testFailed("Host did not get set as prevalent resource.");
-
- testRunner.statisticsUpdateCookieBlocking(function() {
- openIframe("resources/redirect.php?redirectTo=http://localhost:8000/resourceLoadStatistics/resources/echo-referrer.php", function() {
- setEnableFeature(false, finishJSTest);
- });
- });
- });
- }).catch(function(error) {
- console.log(error.message);
- setEnableFeature(false, finishJSTest);
- });
- });
-</script>
-</body>
-</html>
Deleted: branches/safari-608-branch/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-requests-expected.txt (250492 => 250493)
--- branches/safari-608-branch/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-requests-expected.txt 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-requests-expected.txt 2019-09-29 23:50:52 UTC (rev 250493)
@@ -1,16 +0,0 @@
-Tests that only the origin is sent as referrer for prevalent resources without user interaction.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS referrer is "http://127.0.0.1:8000/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-requests.html"
-PASS referrer is "http://127.0.0.1:8000/"
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
-
---------
-Frame: '<!--frame1-->'
---------
-http://127.0.0.1:8000/
Deleted: branches/safari-608-branch/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-requests.html (250492 => 250493)
--- branches/safari-608-branch/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-requests.html 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-requests.html 2019-09-29 23:50:52 UTC (rev 250493)
@@ -1,61 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <script src=""
- <script src=""
-</head>
-<body>
-<script>
- description("Tests that only the origin is sent as referrer for prevalent resources without user interaction.");
- jsTestIsAsync = true;
- testRunner.dumpChildFramesAsText();
-
- function openIframe(url, onLoadHandler) {
- const element = document.createElement("iframe");
- element.src = ""
- if (onLoadHandler) {
- element._onload_ = onLoadHandler;
- }
- document.body.appendChild(element);
- }
-
- var referrer;
- setEnableFeature(true, function() {
- if (testRunner.isStatisticsPrevalentResource("http://localhost"))
- testFailed("Localhost was classified as prevalent resource before the test started.");
-
- fetch("resources/echo-referrer.php").then(function(response) {
- return response.text();
- }).then(function(data) {
- referrer = data;
- shouldBeEqualToString("referrer", "http://127.0.0.1:8000/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-requests.html");
-
- testRunner.setStatisticsPrevalentResource("http://localhost", true, function() {
- if (!testRunner.isStatisticsPrevalentResource("http://localhost"))
- testFailed("Host did not get set as prevalent resource.");
-
- testRunner.statisticsUpdateCookieBlocking(function() {
- fetch("http://localhost:8000/resourceLoadStatistics/resources/echo-referrer.php").then(function(response) {
- return response.text();
- }).then(function(data) {
- referrer = data;
- shouldBeEqualToString("referrer", "http://127.0.0.1:8000/");
-
- openIframe("resources/redirect.php?redirectTo=http://localhost:8000/resourceLoadStatistics/resources/echo-referrer.php", function() {
- setEnableFeature(false, finishJSTest);
- });
-
- }).catch(function(error) {
- console.log(error.message);
- setEnableFeature(false, finishJSTest);
- });
- });
- });
- }).catch(function(error) {
- console.log(error.message);
- setEnableFeature(false, finishJSTest);
- });
- });
-</script>
-</body>
-</html>
Copied: branches/safari-608-branch/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-redirects-expected.txt (from rev 250478, branches/safari-608-branch/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects-expected.txt) (0 => 250493)
--- branches/safari-608-branch/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-redirects-expected.txt (rev 0)
+++ branches/safari-608-branch/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-redirects-expected.txt 2019-09-29 23:50:52 UTC (rev 250493)
@@ -0,0 +1,15 @@
+Tests that only the origin is sent as referrer in redirects to third-parties.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS referrer is "http://127.0.0.1:8000/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-redirects.html"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
+--------
+Frame: '<!--frame1-->'
+--------
+http://127.0.0.1:8000/
Copied: branches/safari-608-branch/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-redirects.html (from rev 250478, branches/safari-608-branch/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects.html) (0 => 250493)
--- branches/safari-608-branch/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-redirects.html (rev 0)
+++ branches/safari-608-branch/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-redirects.html 2019-09-29 23:50:52 UTC (rev 250493)
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script src=""
+ <script src=""
+</head>
+<body>
+<script>
+ description("Tests that only the origin is sent as referrer in redirects to third-parties.");
+ jsTestIsAsync = true;
+ testRunner.dumpChildFramesAsText();
+
+ function openIframe(url, onLoadHandler) {
+ const element = document.createElement("iframe");
+ element.src = ""
+ if (onLoadHandler) {
+ element._onload_ = onLoadHandler;
+ }
+ document.body.appendChild(element);
+ }
+
+ let referrer;
+ setEnableFeature(true, function() {
+ fetch("resources/echo-referrer.php").then(function(response) {
+ return response.text();
+ }).then(function(data) {
+ referrer = data;
+ shouldBeEqualToString("referrer", "http://127.0.0.1:8000/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-redirects.html");
+
+ openIframe("resources/redirect.php?redirectTo=http://localhost:8000/resourceLoadStatistics/resources/echo-referrer.php", function () {
+ setEnableFeature(false, finishJSTest);
+ });
+ }).catch(function(error) {
+ console.log(error.message);
+ setEnableFeature(false, finishJSTest);
+ });
+ });
+</script>
+</body>
+</html>
Copied: branches/safari-608-branch/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-requests-expected.txt (from rev 250478, branches/safari-608-branch/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-requests-expected.txt) (0 => 250493)
--- branches/safari-608-branch/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-requests-expected.txt (rev 0)
+++ branches/safari-608-branch/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-requests-expected.txt 2019-09-29 23:50:52 UTC (rev 250493)
@@ -0,0 +1,16 @@
+Tests that only the origin is sent as referrer for third-party requests.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS referrer is "http://127.0.0.1:8000/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-requests.html"
+PASS referrer is "http://127.0.0.1:8000/"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
+--------
+Frame: '<!--frame1-->'
+--------
+http://127.0.0.1:8000/
Copied: branches/safari-608-branch/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-requests.html (from rev 250478, branches/safari-608-branch/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects.html) (0 => 250493)
--- branches/safari-608-branch/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-requests.html (rev 0)
+++ branches/safari-608-branch/LayoutTests/http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-requests.html 2019-09-29 23:50:52 UTC (rev 250493)
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script src=""
+ <script src=""
+</head>
+<body>
+<script>
+ description("Tests that only the origin is sent as referrer for third-party requests.");
+ jsTestIsAsync = true;
+ testRunner.dumpChildFramesAsText();
+
+ function openIframe(url, onLoadHandler) {
+ const element = document.createElement("iframe");
+ element.src = ""
+ if (onLoadHandler) {
+ element._onload_ = onLoadHandler;
+ }
+ document.body.appendChild(element);
+ }
+
+ let referrer;
+ setEnableFeature(true, function() {
+ fetch("resources/echo-referrer.php").then(function(response) {
+ return response.text();
+ }).then(function(data) {
+ referrer = data;
+ shouldBeEqualToString("referrer", "http://127.0.0.1:8000/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-requests.html");
+
+ fetch("http://localhost:8000/resourceLoadStatistics/resources/echo-referrer.php").then(function(response) {
+ return response.text();
+ }).then(function(data) {
+ referrer = data;
+ shouldBeEqualToString("referrer", "http://127.0.0.1:8000/");
+
+ openIframe("resources/redirect.php?redirectTo=http://localhost:8000/resourceLoadStatistics/resources/echo-referrer.php", function() {
+ setEnableFeature(false, finishJSTest);
+ });
+
+ }).catch(function(error) {
+ console.log(error.message);
+ setEnableFeature(false, finishJSTest);
+ });
+ }).catch(function(error) {
+ console.log(error.message);
+ setEnableFeature(false, finishJSTest);
+ });
+ });
+</script>
+</body>
+</html>
Modified: branches/safari-608-branch/LayoutTests/http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies-when-private-browsing-enabled.php (250492 => 250493)
--- branches/safari-608-branch/LayoutTests/http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies-when-private-browsing-enabled.php 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/LayoutTests/http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies-when-private-browsing-enabled.php 2019-09-29 23:50:52 UTC (rev 250493)
@@ -5,18 +5,26 @@
<html>
<body>
<script>
- if (window.testRunner)
+ if (window.testRunner) {
testRunner.setPrivateBrowsingEnabled(true);
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+ }
- var xhr = new XMLHttpRequest();
- xhr.open("GET", "http://localhost:8080/cookies/resources/setCookies.cgi", false);
- xhr.setRequestHeader("SET-COOKIE", "hello=world;path=/");
- xhr.send(null);
+ testRunner.setStatisticsShouldDowngradeReferrer(false, function () {
+ var xhr = new XMLHttpRequest();
+ xhr.open("GET", "http://localhost:8080/cookies/resources/setCookies.cgi", false);
+ xhr.setRequestHeader("SET-COOKIE", "hello=world;path=/");
+ xhr.send(null);
+
+ // This image will generate a CSP violation report.
+ let imgElement = document.createElement("img");
+ imgElement._onload_ = imgElement._onerror_ = function () {
+ window.location = "/security/contentSecurityPolicy/resources/echo-report.php";
+ };
+ imgElement.src = ""
+ document.body.appendChild(imgElement);
+ });
</script>
-
-<!-- This image will generate a CSP violation report. -->
-<img src=""
-
-<script src=""
</body>
</html>
Modified: branches/safari-608-branch/LayoutTests/http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies.php (250492 => 250493)
--- branches/safari-608-branch/LayoutTests/http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies.php 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/LayoutTests/http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies.php 2019-09-29 23:50:52 UTC (rev 250493)
@@ -5,15 +5,25 @@
<html>
<body>
<script>
- var xhr = new XMLHttpRequest();
- xhr.open("GET", "http://localhost:8080/cookies/resources/setCookies.cgi", false);
- xhr.setRequestHeader("SET-COOKIE", "hello=world;path=/");
- xhr.send(null);
-</script>
+if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
-<!-- This image will generate a CSP violation report. -->
-<img src=""
+ testRunner.setStatisticsShouldDowngradeReferrer(false, function () {
+ var xhr = new XMLHttpRequest();
+ xhr.open("GET", "http://localhost:8080/cookies/resources/setCookies.cgi", false);
+ xhr.setRequestHeader("SET-COOKIE", "hello=world;path=/");
+ xhr.send(null);
-<script src=""
+ // This image will generate a CSP violation report.
+ let imgElement = document.createElement("img");
+ imgElement._onload_ = imgElement._onerror_ = function () {
+ window.location = "/security/contentSecurityPolicy/resources/echo-report.php";
+ };
+ imgElement.src = ""
+ document.body.appendChild(imgElement);
+ });
+}
+</script>
</body>
</html>
Modified: branches/safari-608-branch/LayoutTests/http/tests/security/referrer-policy-header.html (250492 => 250493)
--- branches/safari-608-branch/LayoutTests/http/tests/security/referrer-policy-header.html 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/LayoutTests/http/tests/security/referrer-policy-header.html 2019-09-29 23:50:52 UTC (rev 250493)
@@ -82,7 +82,11 @@
document.body.appendChild(frame);
}
-runNextTest();
+if (window.testRunner) {
+ testRunner.setStatisticsShouldDowngradeReferrer(false, function () {
+ runNextTest();
+ });
+}
</script>
</body>
</html>
Modified: branches/safari-608-branch/LayoutTests/platform/ios/TestExpectations (250492 => 250493)
--- branches/safari-608-branch/LayoutTests/platform/ios/TestExpectations 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/LayoutTests/platform/ios/TestExpectations 2019-09-29 23:50:52 UTC (rev 250493)
@@ -2789,6 +2789,8 @@
http/tests/resourceLoadStatistics/clear-in-memory-and-persistent-store-one-hour.html [ Pass ]
http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects.html [ Pass ]
http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-requests.html [ Pass ]
+http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-redirects.html [ Pass ]
+http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-requests.html [ Pass ]
http/tests/storageAccess/deny-storage-access-under-opener.html [ Pass ]
http/tests/storageAccess/deny-storage-access-under-opener-if-auto-dismiss.html [ Pass ]
http/tests/resourceLoadStatistics/cap-cache-max-age-for-prevalent-resource.html [ Pass ]
Modified: branches/safari-608-branch/LayoutTests/platform/ios-wk2/TestExpectations (250492 => 250493)
--- branches/safari-608-branch/LayoutTests/platform/ios-wk2/TestExpectations 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/LayoutTests/platform/ios-wk2/TestExpectations 2019-09-29 23:50:52 UTC (rev 250493)
@@ -66,6 +66,10 @@
scrollingcoordinator/non-fast-scrollable-region-scaled-iframe.html [ Skip ]
scrollingcoordinator/non-fast-scrollable-region-transformed-iframe.html [ Skip ]
+# Cocoa-specific
+http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-redirects.html [ Pass ]
+http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-requests.html [ Pass ]
+
#//////////////////////////////////////////////////////////////////////////////////////////
# End platform-specific directories.
#//////////////////////////////////////////////////////////////////////////////////////////
Modified: branches/safari-608-branch/LayoutTests/platform/mac-wk1/TestExpectations (250492 => 250493)
--- branches/safari-608-branch/LayoutTests/platform/mac-wk1/TestExpectations 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/LayoutTests/platform/mac-wk1/TestExpectations 2019-09-29 23:50:52 UTC (rev 250493)
@@ -125,6 +125,17 @@
http/tests/security/contentSecurityPolicy/connect-src-beacon-blocked.html [ Skip ]
http/tests/security/contentSecurityPolicy/report-only-connect-src-beacon-redirect-blocked.php [ Skip ]
+# testRunner.setStatisticsShouldDowngradeReferrer() is not supported on WK1
+http/tests/referrer-policy-script/ [ Skip ]
+http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies.php [ Skip ]
+http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies-when-private-browsing-enabled.php [ Skip ]
+http/tests/security/referrer-policy-header.html [ Skip ]
+http/tests/navigation/ping-attribute/area-cross-origin.html [ Skip ]
+http/tests/navigation/ping-attribute/anchor-cross-origin.html [ Skip ]
+http/tests/referrer-policy/no-referrer-when-downgrade/ [ Skip ]
+http/tests/referrer-policy/unsafe-url/cross-origin-http-http.html [ Skip ]
+http/tests/referrer-policy/unsafe-url/cross-origin-http.https.html [ Skip ]
+
# Not supported on WK1
http/tests/intersection-observer [ Skip ]
imported/w3c/web-platform-tests/intersection-observer [ Skip ]
Modified: branches/safari-608-branch/LayoutTests/platform/mac-wk2/TestExpectations (250492 => 250493)
--- branches/safari-608-branch/LayoutTests/platform/mac-wk2/TestExpectations 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/LayoutTests/platform/mac-wk2/TestExpectations 2019-09-29 23:50:52 UTC (rev 250493)
@@ -795,13 +795,11 @@
[ HighSierra+ ] http/tests/resourceLoadStatistics/clear-in-memory-and-persistent-store.html [ Pass ]
[ HighSierra+ ] http/tests/resourceLoadStatistics/clear-in-memory-and-persistent-store-one-hour.html [ Pass ]
[ HighSierra+ ] http/tests/resourceLoadStatistics/grandfathering.html [ Pass ]
-[ HighSierra+ ] http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects.html [ Pass ]
-[ HighSierra+ ] http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-requests.html [ Pass ]
+[ HighSierra+ ] http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-redirects.html [ Pass ]
+[ HighSierra+ ] http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-requests.html [ Pass ]
[ HighSierra+ ] http/tests/resourceLoadStatistics/cap-cache-max-age-for-prevalent-resource.html [ Pass ]
# Skipped in general expectations since they only work on iOS and Mac, WK2.
-http/tests/security/strip-referrer-to-origin-for-third-party-redirects-in-private-mode.html [ Pass ]
-http/tests/security/strip-referrer-to-origin-for-third-party-requests-in-private-mode.html [ Pass ]
media/deactivate-audio-session.html [ Pass ]
# Link preconnect is disabled on pre-High Sierra because the CFNetwork SPI is missing.
Modified: branches/safari-608-branch/LayoutTests/platform/win/TestExpectations (250492 => 250493)
--- branches/safari-608-branch/LayoutTests/platform/win/TestExpectations 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/LayoutTests/platform/win/TestExpectations 2019-09-29 23:50:52 UTC (rev 250493)
@@ -142,6 +142,15 @@
# testRunner.setAlwaysAcceptCookies() is not implemented on Windows.
http/tests/xmlhttprequest/cross-origin-cookie-storage.html [ Skip ]
+# testRunner.setStatisticsShouldDowngradeReferrer() is not supported on Windows
+http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies.php [ Skip ]
+http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies-when-private-browsing-enabled.php [ Skip ]
+http/tests/navigation/ping-attribute/area-cross-origin.html [ Skip ]
+http/tests/navigation/ping-attribute/anchor-cross-origin.html [ Skip ]
+http/tests/referrer-policy/no-referrer-when-downgrade/ [ Skip ]
+http/tests/referrer-policy/unsafe-url/cross-origin-http-http.html [ Skip ]
+http/tests/referrer-policy/unsafe-url/cross-origin-http.https.html [ Skip ]
+
# Dark mode not supported on Windows
css-dark-mode [ Skip ]
Modified: branches/safari-608-branch/LayoutTests/platform/wincairo/TestExpectations (250492 => 250493)
--- branches/safari-608-branch/LayoutTests/platform/wincairo/TestExpectations 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/LayoutTests/platform/wincairo/TestExpectations 2019-09-29 23:50:52 UTC (rev 250493)
@@ -938,6 +938,16 @@
http/tests/quicklook [ Skip ]
http/tests/referrer-policy-iframe [ Skip ]
+# testRunner.setStatisticsShouldDowngradeReferrer() is not supported
+http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies.php [ Skip ]
+http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies-when-private-browsing-enabled.php [ Skip ]
+http/tests/security/referrer-policy-header.html [ Skip ]
+http/tests/navigation/ping-attribute/area-cross-origin.html [ Skip ]
+http/tests/navigation/ping-attribute/anchor-cross-origin.html [ Skip ]
+http/tests/referrer-policy/no-referrer-when-downgrade/ [ Skip ]
+http/tests/referrer-policy/unsafe-url/cross-origin-http-http.html [ Skip ]
+http/tests/referrer-policy/unsafe-url/cross-origin-http.https.html [ Skip ]
+
# All timing out
http/tests/resourceLoadStatistics [ Skip ]
Modified: branches/safari-608-branch/LayoutTests/platform/wk2/TestExpectations (250492 => 250493)
--- branches/safari-608-branch/LayoutTests/platform/wk2/TestExpectations 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/LayoutTests/platform/wk2/TestExpectations 2019-09-29 23:50:52 UTC (rev 250493)
@@ -732,8 +732,8 @@
# These are only supported behind a compile time flag in macOS High Sierra + iOS 11, and above.
http/tests/resourceLoadStatistics/cookie-deletion.html [ Skip ]
http/tests/resourceLoadStatistics/cookies-with-and-without-user-interaction.html [ Skip ]
-http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-redirects.html [ Skip ]
-http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-prevalent-subresource-requests.html [ Skip ]
+http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-redirects.html [ Skip ]
+http/tests/resourceLoadStatistics/strip-referrer-to-origin-for-third-party-requests.html [ Skip ]
http/tests/resourceLoadStatistics/add-blocking-to-redirect.html [ Skip ]
http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html [ Skip ]
http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html [ Skip ]
Modified: branches/safari-608-branch/LayoutTests/resources/js-test.js (250492 => 250493)
--- branches/safari-608-branch/LayoutTests/resources/js-test.js 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/LayoutTests/resources/js-test.js 2019-09-29 23:50:52 UTC (rev 250493)
@@ -899,3 +899,10 @@
workerPort.postMessage(msg);
};
}
+
+function downgradeReferrerCallback(policy, host) {
+ let scriptElement = document.createElement("script");
+ scriptElement.src = "" ":8000/referrer-policy/resources/script.php");
+ scriptElement.referrerPolicy = policy;
+ document.body.appendChild(scriptElement);
+}
Modified: branches/safari-608-branch/LayoutTests/resources/testharnessreport.js (250492 => 250493)
--- branches/safari-608-branch/LayoutTests/resources/testharnessreport.js 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/LayoutTests/resources/testharnessreport.js 2019-09-29 23:50:52 UTC (rev 250493)
@@ -27,6 +27,9 @@
self.AudioContext = self.webkitAudioContext;
self.OfflineAudioContext = self.webkitOfflineAudioContext;
}
+
+ if (testRunner.setStatisticsShouldDowngradeReferrer)
+ testRunner.setStatisticsShouldDowngradeReferrer(false, function() { });
}
if (self.internals && internals.setDisableGetDisplayMediaUserGestureConstraint)
Modified: branches/safari-608-branch/Source/WebKit/ChangeLog (250492 => 250493)
--- branches/safari-608-branch/Source/WebKit/ChangeLog 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/Source/WebKit/ChangeLog 2019-09-29 23:50:52 UTC (rev 250493)
@@ -1,3 +1,59 @@
+2019-09-29 Babak Shafiei <bshaf...@apple.com>
+
+ Apply patch. rdar://problem/55801087
+
+ 2019-09-29 John Wilander <wilan...@apple.com>
+
+ Cherry-pick r250413.
+
+ Patch by Kate Cheney <katherine_che...@apple.com> on 2019-09-26.
+
+ Resource Load Statistics: Downgrade all third-party referrer headers
+ https://bugs.webkit.org/show_bug.cgi?id=201353
+ <rdar://problem/54895650>
+
+ Majority of this patch was written by John Wilander <wilan...@apple.com>.
+
+ Reviewed by Brent Fulgham.
+
+ When tracking protections are enabled, we should downgrade all third-party
+ referrers to their origins. Note that this downgrade will be specific to
+ Cocoa so other ports will have to adopt as they see fit.
+
+ Cocoa already does this downgrade in ephemeral sessions (shipping).
+
+ The majority of these changes are test infrastructure. The functional
+ change is in WebKit::NetworkDataTaskCocoa and WebKit::NetworkSession.
+
+ * NetworkProcess/NetworkProcess.cpp:
+ (WebKit::NetworkProcess::setShouldDowngradeReferrerForTesting):
+ * NetworkProcess/NetworkProcess.h:
+ * NetworkProcess/NetworkProcess.messages.in:
+ * NetworkProcess/NetworkSession.cpp:
+ (WebKit::NetworkSession::isResourceLoadStatisticsEnabled const):
+ (WebKit::NetworkSession::setShouldDowngradeReferrerForTesting):
+ (WebKit::NetworkSession::shouldDowngradeReferrer const):
+ * NetworkProcess/NetworkSession.h:
+ * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
+ * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
+ (WebKit::NetworkDataTaskCocoa::isThirdPartyRequest const):
+ (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
+ (WebKit::NetworkDataTaskCocoa::restrictRequestReferrerToOriginIfNeeded):
+ (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
+ (WebKit::NetworkDataTaskCocoa::isThirdPartyRequest): Deleted.
+ * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
+ (WKWebsiteDataStoreSetResourceLoadStatisticsShouldDowngradeReferrerForTesting):
+ (WKWebsiteDataStoreStatisticsResetToConsistentState):
+ * UIProcess/API/C/WKWebsiteDataStoreRef.h:
+ * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
+ Added missing property configureJSCForTesting to fix the build.
+ * UIProcess/Network/NetworkProcessProxy.cpp:
+ (WebKit::NetworkProcessProxy::setShouldDowngradeReferrerForTesting):
+ * UIProcess/Network/NetworkProcessProxy.h:
+ * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+ (WebKit::WebsiteDataStore::setResourceLoadStatisticsShouldDowngradeReferrerForTesting):
+ * UIProcess/WebsiteData/WebsiteDataStore.h:
+
2019-09-27 Alan Coon <alanc...@apple.com>
Cherry-pick r250432. rdar://problem/55801091
Modified: branches/safari-608-branch/Source/WebKit/NetworkProcess/NetworkProcess.cpp (250492 => 250493)
--- branches/safari-608-branch/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2019-09-29 23:50:52 UTC (rev 250493)
@@ -1217,6 +1217,13 @@
ASSERT_NOT_REACHED();
completionHandler();
}
+
+void NetworkProcess::setShouldDowngradeReferrerForTesting(bool enabled, CompletionHandler<void()>&& completionHandler)
+{
+ for (auto& networkSession : m_networkSessions.values())
+ networkSession.get().setShouldDowngradeReferrerForTesting(enabled);
+ completionHandler();
+}
#endif // ENABLE(RESOURCE_LOAD_STATISTICS)
bool NetworkProcess::sessionIsControlledByAutomation(PAL::SessionID sessionID) const
Modified: branches/safari-608-branch/Source/WebKit/NetworkProcess/NetworkProcess.h (250492 => 250493)
--- branches/safari-608-branch/Source/WebKit/NetworkProcess/NetworkProcess.h 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/Source/WebKit/NetworkProcess/NetworkProcess.h 2019-09-29 23:50:52 UTC (rev 250493)
@@ -261,6 +261,7 @@
void didCommitCrossSiteLoadWithDataTransfer(PAL::SessionID, const RegistrableDomain& fromDomain, const RegistrableDomain& toDomain, OptionSet<WebCore::CrossSiteNavigationDataTransfer::Flag>, WebCore::PageIdentifier);
void setCrossSiteLoadWithLinkDecorationForTesting(PAL::SessionID, const RegistrableDomain& fromDomain, const RegistrableDomain& toDomain, CompletionHandler<void()>&&);
void resetCrossSiteLoadsWithLinkDecorationForTesting(PAL::SessionID, CompletionHandler<void()>&&);
+ void setShouldDowngradeReferrerForTesting(bool, CompletionHandler<void()>&&);
#endif
using CacheStorageRootPathCallback = CompletionHandler<void(String&&)>;
Modified: branches/safari-608-branch/Source/WebKit/NetworkProcess/NetworkProcess.messages.in (250492 => 250493)
--- branches/safari-608-branch/Source/WebKit/NetworkProcess/NetworkProcess.messages.in 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/Source/WebKit/NetworkProcess/NetworkProcess.messages.in 2019-09-29 23:50:52 UTC (rev 250493)
@@ -136,6 +136,7 @@
SetCrossSiteLoadWithLinkDecorationForTesting(PAL::SessionID sessionID, WebCore::RegistrableDomain fromDomain, WebCore::RegistrableDomain toDomain) -> () Async
ResetCrossSiteLoadsWithLinkDecorationForTesting(PAL::SessionID sessionID) -> () Async
DeleteCookiesForTesting(PAL::SessionID sessionID, WebCore::RegistrableDomain domain, bool includeHttpOnlyCookies) -> () Async
+ SetShouldDowngradeReferrerForTesting(bool enabled) -> () Async
#endif
SetSessionIsControlledByAutomation(PAL::SessionID sessionID, bool controlled);
Modified: branches/safari-608-branch/Source/WebKit/NetworkProcess/NetworkSession.cpp (250492 => 250493)
--- branches/safari-608-branch/Source/WebKit/NetworkProcess/NetworkSession.cpp 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/Source/WebKit/NetworkProcess/NetworkSession.cpp 2019-09-29 23:50:52 UTC (rev 250493)
@@ -151,6 +151,11 @@
m_resourceLoadStatistics->setPrevalentResourceForDebugMode(m_resourceLoadStatisticsManualPrevalentResource, [] { });
}
+bool NetworkSession::isResourceLoadStatisticsEnabled() const
+{
+ return !!m_resourceLoadStatistics;
+}
+
void NetworkSession::notifyResourceLoadStatisticsProcessed()
{
m_networkProcess->parentProcessConnection()->send(Messages::NetworkProcessProxy::NotifyResourceLoadStatisticsProcessed(), 0);
@@ -175,6 +180,16 @@
{
m_networkProcess->registrableDomainsWithWebsiteData(m_sessionID, dataTypes, shouldNotifyPage, WTFMove(completionHandler));
}
+
+void NetworkSession::setShouldDowngradeReferrerForTesting(bool enabled)
+{
+ m_downgradeReferrer = enabled;
+}
+
+bool NetworkSession::shouldDowngradeReferrer() const
+{
+ return m_downgradeReferrer;
+}
#endif // ENABLE(RESOURCE_LOAD_STATISTICS)
void NetworkSession::storeAdClickAttribution(WebCore::AdClickAttribution&& adClickAttribution)
Modified: branches/safari-608-branch/Source/WebKit/NetworkProcess/NetworkSession.h (250492 => 250493)
--- branches/safari-608-branch/Source/WebKit/NetworkProcess/NetworkSession.h 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/Source/WebKit/NetworkProcess/NetworkSession.h 2019-09-29 23:50:52 UTC (rev 250493)
@@ -82,11 +82,14 @@
#if ENABLE(RESOURCE_LOAD_STATISTICS)
WebResourceLoadStatisticsStore* resourceLoadStatistics() const { return m_resourceLoadStatistics.get(); }
void setResourceLoadStatisticsEnabled(bool);
+ bool isResourceLoadStatisticsEnabled() const;
void notifyResourceLoadStatisticsProcessed();
void deleteWebsiteDataForRegistrableDomains(OptionSet<WebsiteDataType>, HashMap<WebCore::RegistrableDomain, WebsiteDataToRemove>&&, bool shouldNotifyPage, CompletionHandler<void(const HashSet<WebCore::RegistrableDomain>&)>&&);
void registrableDomainsWithWebsiteData(OptionSet<WebsiteDataType>, bool shouldNotifyPage, CompletionHandler<void(HashSet<WebCore::RegistrableDomain>&&)>&&);
void logDiagnosticMessageWithValue(const String& message, const String& description, unsigned value, unsigned significantFigures, WebCore::ShouldSample);
void notifyPageStatisticsTelemetryFinished(unsigned totalPrevalentResources, unsigned totalPrevalentResourcesWithUserInteraction, unsigned top3SubframeUnderTopFrameOrigins);
+ void setShouldDowngradeReferrerForTesting(bool);
+ bool shouldDowngradeReferrer() const;
#endif
void storeAdClickAttribution(WebCore::AdClickAttribution&&);
void handleAdClickAttributionConversion(WebCore::AdClickAttribution::Conversion&&, const URL& requestURL, const WebCore::ResourceRequest& redirectRequest);
@@ -123,6 +126,7 @@
ShouldIncludeLocalhost m_shouldIncludeLocalhostInResourceLoadStatistics { ShouldIncludeLocalhost::Yes };
EnableResourceLoadStatisticsDebugMode m_enableResourceLoadStatisticsDebugMode { EnableResourceLoadStatisticsDebugMode::No };
WebCore::RegistrableDomain m_resourceLoadStatisticsManualPrevalentResource;
+ bool m_downgradeReferrer { true };
#endif
UniqueRef<AdClickAttributionManager> m_adClickAttribution;
Modified: branches/safari-608-branch/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.h (250492 => 250493)
--- branches/safari-608-branch/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.h 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.h 2019-09-29 23:50:52 UTC (rev 250493)
@@ -80,13 +80,13 @@
bool tryPasswordBasedAuthentication(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler&);
void applySniffingPoliciesAndBindRequestToInferfaceIfNeeded(__strong NSURLRequest*&, bool shouldContentSniff, bool shouldContentEncodingSniff);
- void restrictRequestReferrerToOriginIfNeeded(WebCore::ResourceRequest&, bool shouldBlockCookies);
+ void restrictRequestReferrerToOriginIfNeeded(WebCore::ResourceRequest&);
#if ENABLE(RESOURCE_LOAD_STATISTICS)
static NSHTTPCookieStorage *statelessCookieStorage();
void applyCookieBlockingPolicy(bool shouldBlock);
#endif
- bool isThirdPartyRequest(const WebCore::ResourceRequest&);
+ bool isThirdPartyRequest(const WebCore::ResourceRequest&) const;
bool isAlwaysOnLoggingAllowed() const;
RefPtr<SandboxExtension> m_sandboxExtension;
Modified: branches/safari-608-branch/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm (250492 => 250493)
--- branches/safari-608-branch/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm 2019-09-29 23:50:52 UTC (rev 250493)
@@ -150,7 +150,7 @@
}
#endif
-bool NetworkDataTaskCocoa::isThirdPartyRequest(const WebCore::ResourceRequest& request)
+bool NetworkDataTaskCocoa::isThirdPartyRequest(const WebCore::ResourceRequest& request) const
{
return !WebCore::areRegistrableDomainsEqual(request.url(), request.firstPartyForCookies());
}
@@ -207,7 +207,7 @@
shouldBlockCookies = storedCredentialsPolicy == WebCore::StoredCredentialsPolicy::EphemeralStatelessCookieless
|| (session.networkStorageSession() && session.networkStorageSession()->shouldBlockCookies(request, frameID, pageID));
#endif
- restrictRequestReferrerToOriginIfNeeded(request, shouldBlockCookies);
+ restrictRequestReferrerToOriginIfNeeded(request);
NSURLRequest *nsRequest = request.nsURLRequest(WebCore::HTTPBodyUpdatePolicy::UpdateHTTPBody);
applySniffingPoliciesAndBindRequestToInferfaceIfNeeded(nsRequest, shouldContentSniff == WebCore::ContentSniffingPolicy::SniffContent && !url.isLocalFile(), shouldContentEncodingSniff == WebCore::ContentEncodingSniffingPolicy::Sniff);
@@ -289,9 +289,9 @@
}
}
-void NetworkDataTaskCocoa::restrictRequestReferrerToOriginIfNeeded(WebCore::ResourceRequest& request, bool shouldBlockCookies)
+void NetworkDataTaskCocoa::restrictRequestReferrerToOriginIfNeeded(WebCore::ResourceRequest& request)
{
- if (shouldBlockCookies || (m_session->sessionID().isEphemeral() && isThirdPartyRequest(request)))
+ if ((m_session->sessionID().isEphemeral() || m_session->isResourceLoadStatisticsEnabled()) && m_session->shouldDowngradeReferrer() && isThirdPartyRequest(request))
request.setExistingHTTPReferrerToOriginString();
}
@@ -405,14 +405,8 @@
m_client->willPerformHTTPRedirection(WTFMove(redirectResponse), WTFMove(request), [completionHandler = WTFMove(completionHandler), this, weakThis = makeWeakPtr(*this)] (auto&& request) mutable {
if (!weakThis)
return completionHandler({ });
- if (!request.isNull()) {
-#if ENABLE(RESOURCE_LOAD_STATISTICS)
- bool shouldBlockCookies = m_session->networkStorageSession() && m_session->networkStorageSession()->shouldBlockCookies(request, m_frameID, m_pageID);
-#else
- bool shouldBlockCookies = false;
-#endif
- restrictRequestReferrerToOriginIfNeeded(request, shouldBlockCookies);
- }
+ if (!request.isNull())
+ restrictRequestReferrerToOriginIfNeeded(request);
completionHandler(WTFMove(request));
});
else {
Modified: branches/safari-608-branch/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp (250492 => 250493)
--- branches/safari-608-branch/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp 2019-09-29 23:50:52 UTC (rev 250493)
@@ -472,6 +472,17 @@
#endif
}
+void WKWebsiteDataStoreSetResourceLoadStatisticsShouldDowngradeReferrerForTesting(WKWebsiteDataStoreRef dataStoreRef, bool enabled, void* context, WKWebsiteDataStoreSetResourceLoadStatisticsShouldDowngradeReferrerForTestingFunction completionHandler)
+{
+#if ENABLE(RESOURCE_LOAD_STATISTICS)
+ WebKit::toImpl(dataStoreRef)->websiteDataStore().setResourceLoadStatisticsShouldDowngradeReferrerForTesting(enabled, [context, completionHandler] {
+ completionHandler(context);
+ });
+#else
+ completionHandler(context);
+#endif
+}
+
void WKWebsiteDataStoreStatisticsResetToConsistentState(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreStatisticsResetToConsistentStateFunction completionHandler)
{
#if ENABLE(RESOURCE_LOAD_STATISTICS)
@@ -483,6 +494,7 @@
store.clearResourceLoadStatisticsInWebProcesses([callbackAggregator = callbackAggregator.copyRef()] { });
store.resetCacheMaxAgeCapForPrevalentResources([callbackAggregator = callbackAggregator.copyRef()] { });
store.resetCrossSiteLoadsWithLinkDecorationForTesting([callbackAggregator = callbackAggregator.copyRef()] { });
+ store.setResourceLoadStatisticsShouldDowngradeReferrerForTesting(true, [callbackAggregator = callbackAggregator.copyRef()] { });
store.resetParametersToDefaultValues([callbackAggregator = callbackAggregator.copyRef()] { });
store.scheduleClearInMemoryAndPersistent(WebKit::ShouldGrandfatherStatistics::No, [callbackAggregator = callbackAggregator.copyRef()] { });
#else
Modified: branches/safari-608-branch/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h (250492 => 250493)
--- branches/safari-608-branch/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h 2019-09-29 23:50:52 UTC (rev 250493)
@@ -103,6 +103,8 @@
WK_EXPORT void WKWebsiteDataStoreStatisticsHasLocalStorage(WKWebsiteDataStoreRef dataStoreRef, WKStringRef host, void* context, WKWebsiteDataStoreStatisticsHasLocalStorageFunction callback);
typedef void (*WKWebsiteDataStoreSetStatisticsCacheMaxAgeCapFunction)(void* functionContext);
WK_EXPORT void WKWebsiteDataStoreSetStatisticsCacheMaxAgeCap(WKWebsiteDataStoreRef dataStoreRef, double seconds, void* context, WKWebsiteDataStoreSetStatisticsCacheMaxAgeCapFunction);
+typedef void (*WKWebsiteDataStoreSetResourceLoadStatisticsShouldDowngradeReferrerForTestingFunction)(void* functionContext);
+WK_EXPORT void WKWebsiteDataStoreSetResourceLoadStatisticsShouldDowngradeReferrerForTesting(WKWebsiteDataStoreRef dataStoreRef, bool enabled, void* context, WKWebsiteDataStoreSetResourceLoadStatisticsShouldDowngradeReferrerForTestingFunction completionHandler);
typedef void (*WKWebsiteDataStoreStatisticsResetToConsistentStateFunction)(void* functionContext);
WK_EXPORT void WKWebsiteDataStoreStatisticsResetToConsistentState(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreStatisticsResetToConsistentStateFunction completionHandler);
Modified: branches/safari-608-branch/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h (250492 => 250493)
--- branches/safari-608-branch/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h 2019-09-29 23:50:52 UTC (rev 250493)
@@ -73,6 +73,8 @@
@property (nonatomic) NSUInteger downloadMonitorSpeedMultiplierForTesting WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
@property (nonatomic, nullable, copy, setter=setHSTSStorageDirectory:) NSURL *hstsStorageDirectory WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+@property (nonatomic) BOOL configureJSCForTesting WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+
@end
NS_ASSUME_NONNULL_END
Modified: branches/safari-608-branch/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp (250492 => 250493)
--- branches/safari-608-branch/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp 2019-09-29 23:50:52 UTC (rev 250493)
@@ -974,6 +974,15 @@
});
}
+void NetworkProcessProxy::setShouldDowngradeReferrerForTesting(bool enabled, CompletionHandler<void()>&& completionHandler)
+{
+ if (!canSendMessage()) {
+ completionHandler();
+ return;
+ }
+
+ sendWithAsyncReply(Messages::NetworkProcess::SetShouldDowngradeReferrerForTesting(enabled), WTFMove(completionHandler));
+}
#endif // ENABLE(RESOURCE_LOAD_STATISTICS)
void NetworkProcessProxy::sendProcessWillSuspendImminently()
Modified: branches/safari-608-branch/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h (250492 => 250493)
--- branches/safari-608-branch/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h 2019-09-29 23:50:52 UTC (rev 250493)
@@ -150,6 +150,7 @@
void resetCrossSiteLoadsWithLinkDecorationForTesting(PAL::SessionID, CompletionHandler<void()>&&);
void deleteCookiesForTesting(PAL::SessionID, const RegistrableDomain&, bool includeHttpOnlyCookies, CompletionHandler<void()>&&);
void deleteWebsiteDataInUIProcessForRegistrableDomains(PAL::SessionID, OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, Vector<RegistrableDomain>, CompletionHandler<void(HashSet<WebCore::RegistrableDomain>&&)>&&);
+ void setShouldDowngradeReferrerForTesting(bool, CompletionHandler<void()>&&);
#endif
void processReadyToSuspend();
Modified: branches/safari-608-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (250492 => 250493)
--- branches/safari-608-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp 2019-09-29 23:50:52 UTC (rev 250493)
@@ -1682,6 +1682,20 @@
}
ASSERT(!completionHandler);
}
+
+void WebsiteDataStore::setResourceLoadStatisticsShouldDowngradeReferrerForTesting(bool enabled, CompletionHandler<void()>&& completionHandler)
+{
+ auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler));
+
+ for (auto& processPool : processPools()) {
+ if (auto* networkProcess = processPool->networkProcess()) {
+ networkProcess->setShouldDowngradeReferrerForTesting(enabled, [callbackAggregator = callbackAggregator.copyRef()] { });
+ ASSERT(processPools().size() == 1);
+ break;
+ }
+ }
+ ASSERT(!completionHandler);
+}
#endif // ENABLE(RESOURCE_LOAD_STATISTICS)
void WebsiteDataStore::setCacheMaxAgeCapForPrevalentResources(Seconds seconds, CompletionHandler<void()>&& completionHandler)
Modified: branches/safari-608-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h (250492 => 250493)
--- branches/safari-608-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h 2019-09-29 23:50:52 UTC (rev 250493)
@@ -178,6 +178,7 @@
void resetCrossSiteLoadsWithLinkDecorationForTesting(CompletionHandler<void()>&&);
void deleteCookiesForTesting(const URL&, bool includeHttpOnlyCookies, CompletionHandler<void()>&&);
void hasLocalStorageForTesting(const URL&, CompletionHandler<void(bool)>&&) const;
+ void setResourceLoadStatisticsShouldDowngradeReferrerForTesting(bool, CompletionHandler<void()>&&);
#endif
void setCacheMaxAgeCapForPrevalentResources(Seconds, CompletionHandler<void()>&&);
void resetCacheMaxAgeCapForPrevalentResources(CompletionHandler<void()>&&);
Modified: branches/safari-608-branch/Tools/ChangeLog (250492 => 250493)
--- branches/safari-608-branch/Tools/ChangeLog 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/Tools/ChangeLog 2019-09-29 23:50:52 UTC (rev 250493)
@@ -1,3 +1,46 @@
+2019-09-29 Babak Shafiei <bshaf...@apple.com>
+
+ Apply patch. rdar://problem/55801087
+
+ 2019-09-29 John Wilander <wilan...@apple.com>
+
+ Cherry-pick r250413.
+
+ Patch by Kate Cheney <katherine_che...@apple.com> on 2019-09-26.
+
+ Resource Load Statistics: Downgrade all third-party referrer headers
+ https://bugs.webkit.org/show_bug.cgi?id=201353
+ <rdar://problem/54895650>
+
+ Majority of this patch was written by John Wilander <wilan...@apple.com>.
+
+ Reviewed by Brent Fulgham.
+
+ The changes to the TestRunner facilitates an opt-out for test cases
+ that either test the referrer mechanism explicitly or tests that
+ rely on the full referrer to be sent.
+
+ The new boolean variable and early return in
+ TestRunner::setStatisticsShouldDowngradeReferrer() prevent the same
+ event from trying to set multiple TestRunner callbacks.
+
+ * TestWebKitAPI/WKWebViewConfigurationExtras.h:
+ Fixed a build error.
+ * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+ * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+ (WTR::InjectedBundle::didReceiveMessageToPage):
+ * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+ (WTR::TestRunner::setStatisticsShouldDowngradeReferrer):
+ (WTR::TestRunner::statisticsCallDidSetShouldDowngradeReferrerCallback):
+ * WebKitTestRunner/InjectedBundle/TestRunner.h:
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::setStatisticsShouldDowngradeReferrer):
+ * WebKitTestRunner/TestController.h:
+ * WebKitTestRunner/TestInvocation.cpp:
+ (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
+ (WTR::TestInvocation::didSetShouldDowngradeReferrer):
+ * WebKitTestRunner/TestInvocation.h:
+
2019-09-27 Alan Coon <alanc...@apple.com>
Cherry-pick r250401. rdar://problem/55770702
Modified: branches/safari-608-branch/Tools/TestWebKitAPI/WKWebViewConfigurationExtras.h (250492 => 250493)
--- branches/safari-608-branch/Tools/TestWebKitAPI/WKWebViewConfigurationExtras.h 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/Tools/TestWebKitAPI/WKWebViewConfigurationExtras.h 2019-09-29 23:50:52 UTC (rev 250493)
@@ -27,5 +27,5 @@
@interface WKWebViewConfiguration (TestWebKitAPIExtras)
+ (instancetype)_test_configurationWithTestPlugInClassName:(NSString *)className;
++ (instancetype)_test_configurationWithTestPlugInClassName:(NSString *)className configureJSCForTesting:(BOOL)value andCustomParameterClasses:(NSSet<Class> *)parameterClasses;
@end
-+ (instancetype)_test_configurationWithTestPlugInClassName:(NSString *)className configureJSCForTesting:(BOOL)value andCustomParameterClasses:(NSSet<Class> *)parameterClasses;
Modified: branches/safari-608-branch/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (250492 => 250493)
--- branches/safari-608-branch/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2019-09-29 23:50:52 UTC (rev 250493)
@@ -336,6 +336,7 @@
boolean isStatisticsHasLocalStorage(DOMString hostName);
void setStatisticsCacheMaxAgeCap(double seconds);
void statisticsResetToConsistentState(object completionHandler);
+ void setStatisticsShouldDowngradeReferrer(boolean value, object callback);
// Injected bundle form client.
void installTextDidChangeInTextFieldCallback(object callback);
Modified: branches/safari-608-branch/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (250492 => 250493)
--- branches/safari-608-branch/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp 2019-09-29 23:50:52 UTC (rev 250493)
@@ -323,6 +323,11 @@
return;
}
+ if (WKStringIsEqualToUTF8CString(messageName, "CallDidSetShouldDowngradeReferrer")) {
+ m_testRunner->statisticsCallDidSetShouldDowngradeReferrerCallback();
+ return;
+ }
+
if (WKStringIsEqualToUTF8CString(messageName, "CallDidResetStatisticsToConsistentState")) {
m_testRunner->statisticsCallDidResetToConsistentStateCallback();
return;
Modified: branches/safari-608-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (250492 => 250493)
--- branches/safari-608-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2019-09-29 23:50:52 UTC (rev 250493)
@@ -728,6 +728,7 @@
StatisticsDidClearThroughWebsiteDataRemovalCallbackID,
StatisticsDidResetToConsistentStateCallbackID,
StatisticsDidSetBlockCookiesForHostCallbackID,
+ StatisticsDidSetShouldDowngradeReferrerCallbackID,
AllStorageAccessEntriesCallbackID,
DidRemoveAllSessionCredentialsCallbackID,
GetApplicationManifestCallbackID,
@@ -2073,6 +2074,23 @@
WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
}
+void TestRunner::setStatisticsShouldDowngradeReferrer(bool value, JSValueRef completionHandler)
+{
+ if (m_hasSetDowngradeReferrerCallback)
+ return;
+
+ cacheTestRunnerCallback(StatisticsDidSetShouldDowngradeReferrerCallbackID, completionHandler);
+ WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("SetStatisticsShouldDowngradeReferrer"));
+ WKRetainPtr<WKBooleanRef> messageBody = adoptWK(WKBooleanCreate(value));
+ WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
+ m_hasSetDowngradeReferrerCallback = true;
+}
+
+void TestRunner::statisticsCallDidSetShouldDowngradeReferrerCallback()
+{
+ callTestRunnerCallback(StatisticsDidSetShouldDowngradeReferrerCallbackID);
+}
+
void TestRunner::statisticsCallClearThroughWebsiteDataRemovalCallback()
{
callTestRunnerCallback(StatisticsDidClearThroughWebsiteDataRemovalCallbackID);
Modified: branches/safari-608-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (250492 => 250493)
--- branches/safari-608-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2019-09-29 23:50:52 UTC (rev 250493)
@@ -434,6 +434,8 @@
void statisticsCallClearThroughWebsiteDataRemovalCallback();
bool isStatisticsHasLocalStorage(JSStringRef hostName);
void setStatisticsCacheMaxAgeCap(double seconds);
+ void setStatisticsShouldDowngradeReferrer(bool, JSValueRef callback);
+ void statisticsCallDidSetShouldDowngradeReferrerCallback();
void statisticsResetToConsistentState(JSValueRef completionHandler);
void statisticsCallDidResetToConsistentStateCallback();
@@ -567,6 +569,7 @@
bool m_userStyleSheetEnabled { false };
bool m_dumpAllHTTPRedirectedResponseHeaders { false };
+ bool m_hasSetDowngradeReferrerCallback { false };
};
} // namespace WTR
Modified: branches/safari-608-branch/Tools/WebKitTestRunner/TestController.cpp (250492 => 250493)
--- branches/safari-608-branch/Tools/WebKitTestRunner/TestController.cpp 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/Tools/WebKitTestRunner/TestController.cpp 2019-09-29 23:50:52 UTC (rev 250493)
@@ -3513,6 +3513,15 @@
runUntil(context.done, noTimeout);
}
+void TestController::setStatisticsShouldDowngradeReferrer(bool value)
+{
+ auto* dataStore = WKContextGetWebsiteDataStore(platformContext());
+ ResourceStatisticsCallbackContext context(*this);
+ WKWebsiteDataStoreSetResourceLoadStatisticsShouldDowngradeReferrerForTesting(dataStore, value, &context, resourceStatisticsVoidResultCallback);
+ runUntil(context.done, noTimeout);
+ m_currentInvocation->didSetShouldDowngradeReferrer();
+}
+
void TestController::statisticsResetToConsistentState()
{
auto* dataStore = WKContextGetWebsiteDataStore(platformContext());
Modified: branches/safari-608-branch/Tools/WebKitTestRunner/TestController.h (250492 => 250493)
--- branches/safari-608-branch/Tools/WebKitTestRunner/TestController.h 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/Tools/WebKitTestRunner/TestController.h 2019-09-29 23:50:52 UTC (rev 250493)
@@ -244,6 +244,7 @@
void statisticsDeleteCookiesForHost(WKStringRef host, bool includeHttpOnlyCookies);
bool isStatisticsHasLocalStorage(WKStringRef hostName);
void setStatisticsCacheMaxAgeCap(double seconds);
+ void setStatisticsShouldDowngradeReferrer(bool value);
void statisticsResetToConsistentState();
void getAllStorageAccessEntries();
Modified: branches/safari-608-branch/Tools/WebKitTestRunner/TestInvocation.cpp (250492 => 250493)
--- branches/safari-608-branch/Tools/WebKitTestRunner/TestInvocation.cpp 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/Tools/WebKitTestRunner/TestInvocation.cpp 2019-09-29 23:50:52 UTC (rev 250493)
@@ -1462,6 +1462,13 @@
return nullptr;
}
+ if (WKStringIsEqualToUTF8CString(messageName, "SetStatisticsShouldDowngradeReferrer")) {
+ ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
+ WKBooleanRef value = static_cast<WKBooleanRef>(messageBody);
+ TestController::singleton().setStatisticsShouldDowngradeReferrer(WKBooleanGetValue(value));
+ return nullptr;
+ }
+
if (WKStringIsEqualToUTF8CString(messageName, "RemoveAllSessionCredentials")) {
TestController::singleton().removeAllSessionCredentials();
return nullptr;
@@ -1737,6 +1744,12 @@
WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()->page(), messageName.get(), 0);
}
+void TestInvocation::didSetShouldDowngradeReferrer()
+{
+ WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("CallDidSetShouldDowngradeReferrer"));
+ WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()->page(), messageName.get(), 0);
+}
+
void TestInvocation::didResetStatisticsToConsistentState()
{
WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("CallDidResetStatisticsToConsistentState"));
Modified: branches/safari-608-branch/Tools/WebKitTestRunner/TestInvocation.h (250492 => 250493)
--- branches/safari-608-branch/Tools/WebKitTestRunner/TestInvocation.h 2019-09-29 19:33:37 UTC (rev 250492)
+++ branches/safari-608-branch/Tools/WebKitTestRunner/TestInvocation.h 2019-09-29 23:50:52 UTC (rev 250493)
@@ -72,6 +72,7 @@
void notifyDownloadDone();
void didClearStatisticsThroughWebsiteDataRemoval();
+ void didSetShouldDowngradeReferrer();
void didResetStatisticsToConsistentState();
void didSetBlockCookiesForHost();
void didSetStatisticsDebugMode();