mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 09:45:41 +00:00
Bug 1495623 [wpt PR 5054] - Add test cases for multiple Referrer-Policy headers, a=testonly
Automatic update from web-platform-testsAdd test cases for multiple Referrer-Policy headers (#5054) * Add test cases for multiple Referrer-Policy headers The test cases exercise various ways that multiple policies can be delivered in Referrer-Policy headers, such as: Referrer-Policy: origin, no-referrer Referrer-Policy: origin Referrer-Policy: no-referrer Referrer-Policy: origin Referrer-Policy: origin no-referrer As requested in https://github.com/w3c/webappsec-referrer-policy/issues/81 * Update expectation for invalid header, add extension-token test -- wpt-commits: 028ac8c49c304bbc7b4d0000c83641b19947612c wpt-pr: 5054
This commit is contained in:
parent
634051957d
commit
15bb3ce079
@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Referrer Policy: multiple Referrer-Policy header and header values are allowed</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Referrer Policy: multiple Referrer-Policy header and header values are allowed</h1>
|
||||
<p></p>
|
||||
|
||||
<pre id="received_message">Running...</pre>
|
||||
|
||||
<script>
|
||||
var test = async_test("Image uses the last recognized Referrer-Policy header value");
|
||||
var urlPath = '/referrer-policy/generic/subresource/image.py?cache_destroyer=' + (new Date()).getTime();
|
||||
var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
|
||||
urlPath;
|
||||
queryImage(url, test.step_func(function(message) {
|
||||
assert_equals(message.referrer, document.location.origin + "/");
|
||||
test.done();
|
||||
}), null, 'no-referrer', test);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,2 @@
|
||||
Referrer-Policy: no-referrer
|
||||
Referrer-Policy: no-referrer,origin
|
@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Referrer Policy: multiple Referrer-Policy header values are allowed</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Referrer Policy: multiple Referrer-Policy header values are allowed</h1>
|
||||
<p></p>
|
||||
|
||||
<pre id="received_message">Running...</pre>
|
||||
|
||||
<script>
|
||||
var test = async_test("Image uses the last recognized Referrer-Policy header value");
|
||||
var urlPath = '/referrer-policy/generic/subresource/image.py?cache_destroyer=' + (new Date()).getTime();
|
||||
var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
|
||||
urlPath;
|
||||
queryImage(url, test.step_func(function(message) {
|
||||
assert_equals(message.referrer, document.location.origin + "/");
|
||||
test.done();
|
||||
}), null, 'no-referrer', test);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1 @@
|
||||
Referrer-Policy: no-referrer, origin
|
@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Referrer Policy: multiple Referrer-Policy headers with one invalid</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Referrer Policy: multiple Referrer-Policy headers with one invalid</h1>
|
||||
<p></p>
|
||||
|
||||
<pre id="received_message">Running...</pre>
|
||||
|
||||
<script>
|
||||
var test = async_test("Referrer policy header parsing fails if one header is invalid");
|
||||
var urlPath = '/referrer-policy/generic/subresource/image.py?cache_destroyer=' + (new Date()).getTime();
|
||||
var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
|
||||
urlPath;
|
||||
queryImage(url, test.step_func(function(message) {
|
||||
assert_equals(message.referrer, document.location.href);
|
||||
test.done();
|
||||
}), null, 'no-referrer', test);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,2 @@
|
||||
Referrer-Policy: origin
|
||||
Referrer-Policy: origin no-referrer
|
@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Referrer Policy: multiple Referrer-Policy headers with one invalid</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Referrer Policy: multiple Referrer-Policy headers with one invalid</h1>
|
||||
<p></p>
|
||||
|
||||
<pre id="received_message">Running...</pre>
|
||||
|
||||
<script>
|
||||
var test = async_test("Image uses last recognized referrer policy token from Referrer-Policy headers");
|
||||
var urlPath = '/referrer-policy/generic/subresource/image.py?cache_destroyer=' + (new Date()).getTime();
|
||||
var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
|
||||
urlPath;
|
||||
queryImage(url, test.step_func(function(message) {
|
||||
assert_equals(message.referrer, document.location.origin + "/");
|
||||
test.done();
|
||||
}), null, 'no-referrer', test);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,2 @@
|
||||
Referrer-Policy: no-referrer
|
||||
Referrer-Policy: origin,not-a-valid-token
|
@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Referrer Policy: multiple Referrer-Policy headers are allowed</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<script src="/referrer-policy/generic/common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Referrer Policy: multiple Referrer-Policy headers are allowed</h1>
|
||||
<p></p>
|
||||
|
||||
<pre id="received_message">Running...</pre>
|
||||
|
||||
<script>
|
||||
var test = async_test("Image uses the last recognized Referrer-Policy header");
|
||||
var urlPath = '/referrer-policy/generic/subresource/image.py?cache_destroyer=' + (new Date()).getTime();
|
||||
var url = location.protocol + "//www1." + location.hostname + ":" + location.port +
|
||||
urlPath;
|
||||
queryImage(url, test.step_func(function(message) {
|
||||
assert_equals(message.referrer, document.location.origin + "/");
|
||||
test.done();
|
||||
}), null, 'no-referrer', test);
|
||||
</script>
|
||||
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,2 @@
|
||||
Referrer-Policy: no-referrer
|
||||
Referrer-Policy: origin
|
Loading…
Reference in New Issue
Block a user