Skip to content

Commit

Permalink
Referrers: Flip ReducedReferrerGranularity to enabled by default
Browse files Browse the repository at this point in the history
We're rolling out ReducedReferrerGranularity to 100% in M85 stable.
Before we reach 100%, we need to enable the behavior by default. This
will take effect in M87; we'll follow up by removing the flag, the
corresponding enterprise policy, and the corresponding field trial
testing configuration.

Launch approval: crbug.com/1019930

Bug: 1014207
Change-Id: Ib575af6a858641fb1fe2c8de73941f5702d88191
  • Loading branch information
David Van Cleve authored and chromium-wpt-export-bot committed Nov 7, 2020
1 parent 47ff38a commit b4d16af
Show file tree
Hide file tree
Showing 117 changed files with 1,442 additions and 4,583 deletions.
7 changes: 5 additions & 2 deletions fetch/api/cors/cors-preflight-referrer.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ var origin = get_host_info().HTTP_ORIGIN + "/";
corsPreflightReferrer("Referrer policy: no-referrer", corsUrl, "no-referrer", undefined, "");
corsPreflightReferrer("Referrer policy: no-referrer", corsUrl, "no-referrer", "myreferrer", "");

corsPreflightReferrer("Referrer policy: \"\"", corsUrl, "", undefined, location.toString())
corsPreflightReferrer("Referrer policy: \"\"", corsUrl, "", "myreferrer", new URL("myreferrer", location).toString());
corsPreflightReferrer("Referrer policy: \"\"", corsUrl, "", undefined, origin);
corsPreflightReferrer("Referrer policy: \"\"", corsUrl, "", "myreferrer", origin);

corsPreflightReferrer("Referrer policy: no-referrer-when-downgrade", corsUrl, "no-referrer-when-downgrade", undefined, location.toString())
corsPreflightReferrer("Referrer policy: no-referrer-when-downgrade", corsUrl, "no-referrer-when-downgrade", "myreferrer", new URL("myreferrer", location).toString());

corsPreflightReferrer("Referrer policy: origin", corsUrl, "origin", undefined, origin);
corsPreflightReferrer("Referrer policy: origin", corsUrl, "origin", "myreferrer", origin);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
<div id=log></div>
<iframe></iframe>
<script>
setup({ single_test: true });
setup({
single_test: true
});
onload = function() {
var fr = document.querySelector("iframe")
fr.src = "about:blank"
fr.onload = function() {
assert_equals(fr.contentDocument.referrer, document.URL)
assert_equals(fr.contentDocument.referrer, document.location.origin + '/')
done()
}
}
Expand Down
35 changes: 19 additions & 16 deletions html/browsers/windows/browsing-context.html
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
<!doctype html>
<html>
<head>
<title>HTML Test: Browsing context is first created</title>
<link rel="author" title="Intel" href="http://www.intel.com/" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
<script>

<head>
<title>HTML Test: Browsing context is first created</title>
<link rel="author" title="Intel" href="http://www.intel.com/" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>

<body>
<div id="log"></div>
<script>
var doc, iframe;

setup(function () {
setup(function() {
// Create new browsing context via iframe
iframe = document.createElement("iframe");
document.body.appendChild(iframe);
doc = iframe.contentDocument;
});

test(function () {
test(function() {
assert_equals(doc.compatMode, "BackCompat", "The compatMode of a document without a document type declaration should be 'BackCompat'."); // Quirksmode
assert_equals(doc.contentType, "text/html", "The document should be an HTML document.");
assert_equals(doc.readyState, "complete", "The readyState attribute should be 'complete'.");
Expand All @@ -29,7 +31,7 @@
assert_equals(doc.characterSet, "UTF-8", "The document's encoding should be 'UTF-8'.");
}, "Check that browsing context has new, ready HTML document");

test(function () {
test(function() {
assert_equals(doc.childNodes.length, 1, "The document must have only one child.");
assert_equals(doc.documentElement.tagName, "HTML");
assert_equals(doc.documentElement.childNodes.length, 2, "The HTML element should have 2 children.");
Expand All @@ -39,10 +41,11 @@
assert_false(doc.documentElement.childNodes[1].hasChildNodes(), "The BODY element should not have children.");
}, "Check that new document nodes extant, empty");

test(function () {
assert_equals(doc.referrer, document.URL, "The document's referrer should be its creator document's address.");
test(function() {
assert_equals(doc.referrer, document.location.origin + '/', "The document's referrer should be its creator document's address's origin.");
assert_equals(iframe.contentWindow.parent.document, document);
}, "Check the document properties corresponding to the creator browsing context");
</script>
</body>
</script>
</body>

</html>
Original file line number Diff line number Diff line change
Expand Up @@ -9,49 +9,45 @@
<script src="../resources/reporting-common.js"></script>

<script>
let tests = [
// popup origin, popup COOP, popup COEP, popup COOP report only, popup COEP report only, expected reports

let tests = [
// popup origin, popup COOP, popup COEP, popup COOP report only, popup COEP report only, expected reports

// Open a cross-origin popup with a same-origin COOP and no COEP. COOP
// switches the browsing context group and hence produces one report.
// This test verifies that the navigated to document properly sends a
// navigation-to report. The navigationURI is the referrer.
[
CROSS_ORIGIN,
`same-origin; report-to="${popupReportEndpoint.name}"`,
"",
"",
"",
// Open a cross-origin popup with a same-origin COOP and no COEP. COOP
// switches the browsing context group and hence produces one report.
// This test verifies that the navigated to document properly sends a
// navigation-to report. The navigationURI is the referrer.
[
{
CROSS_ORIGIN,
`same-origin; report-to="${popupReportEndpoint.name}"`,
"",
"",
"",
[{
"endpoint": popupReportEndpoint,
"report": {
"body": {
"disposition": "enforce",
"effectivePolicy": "same-origin",
"previousResponseURL": "",
"referrer": `${location.href}`, // referrer
"referrer": `${location.origin}/`, // referrer
"type": "navigation-to-response"
},
"url": /uuid=EXECUTOR_UUID$/,
"type": "coop"
}
}
]
],
// Open a same-origin popup with a unsafe-none COOP and no COEP. COOP switches
// the browsing context group and hence produces one report.
// This test verifies that having different policies on same origin documents
// still properly produces report to the navigated-to-document.
[
SAME_ORIGIN,
`unsafe-none; report-to="${popupReportEndpoint.name}"`,
"",
"",
"",
}]
],
// Open a same-origin popup with a unsafe-none COOP and no COEP. COOP switches
// the browsing context group and hence produces one report.
// This test verifies that having different policies on same origin documents
// still properly produces report to the navigated-to-document.
[
{
SAME_ORIGIN,
`unsafe-none; report-to="${popupReportEndpoint.name}"`,
"",
"",
"",
[{
"endpoint": popupReportEndpoint,
"report": {
"body": {
Expand All @@ -64,47 +60,43 @@
"url": /uuid=EXECUTOR_UUID$/,
"type": "coop"
}
}
]
],
// Open a cross-origin popup with a unsafe-none COOP (with reporting) and no
// COEP. COOP switches the browsing context group and hence produces one
// reports to the unsafe-none document. This test verifies that unsafe-none
// properly sends report in that configuration.
[
CROSS_ORIGIN,
`unsafe-none; report-to="${popupReportEndpoint.name}"`,
"",
"",
"",
}]
],
// Open a cross-origin popup with a unsafe-none COOP (with reporting) and no
// COEP. COOP switches the browsing context group and hence produces one
// reports to the unsafe-none document. This test verifies that unsafe-none
// properly sends report in that configuration.
[
{
CROSS_ORIGIN,
`unsafe-none; report-to="${popupReportEndpoint.name}"`,
"",
"",
"",
[{
"endpoint": popupReportEndpoint,
"report": {
"body": {
"disposition": "enforce",
"previousResponseURL": "",
"referrer": `${location.href}`, // referrer
"referrer": `${location.origin}/`, // referrer
"type": "navigation-to-response"
},
"url": /uuid=EXECUTOR_UUID$/,
"type": "coop"
}
}
]
],
// Open a same-origin popup with a same-origin COOP Report only value, the
// report only matches the previous document COOP value, no report is sent.
[
SAME_ORIGIN,
"",
"",
`same-origin; report-to="${popupReportOnlyEndpoint.name}"`,
"",
[]
],
];

runNavigationReportingTests(document.title, tests);
}]
],
// Open a same-origin popup with a same-origin COOP Report only value, the
// report only matches the previous document COOP value, no report is sent.
[
SAME_ORIGIN,
"",
"",
`same-origin; report-to="${popupReportOnlyEndpoint.name}"`,
"",
[]
],
];

runNavigationReportingTests(document.title, tests);
</script>
Loading

0 comments on commit b4d16af

Please sign in to comment.