Bug 1340652 P4 Test fetch referer header in worker and redirected worker scripts. r=baku

This commit is contained in:
Ben Kelly 2017-02-23 10:54:42 -05:00
Родитель cb2ab572f1
Коммит 5a378c4750
4 изменённых файлов: 57 добавлений и 6 удалений

Просмотреть файл

@ -87099,6 +87099,18 @@
{}
]
],
"fetch/api/basic/request-referrer-redirected-worker.html": [
[
"/fetch/api/basic/request-referrer-redirected-worker.html",
{}
]
],
"fetch/api/basic/request-referrer-worker.html": [
[
"/fetch/api/basic/request-referrer-worker.html",
{}
]
],
"fetch/api/basic/request-referrer.html": [
[
"/fetch/api/basic/request-referrer.html",
@ -163318,12 +163330,20 @@
"6a15c64c072f4e57470ed3f2709e43fa2f806b79",
"support"
],
"fetch/api/basic/request-referrer-redirected-worker.html": [
"41013925a84ab080c9c9f3b16ef4d8fdd1d50588",
"testharness"
],
"fetch/api/basic/request-referrer-worker.html": [
"3dad9617d76eed94d8b759d0d27b20c431873dd4",
"testharness"
],
"fetch/api/basic/request-referrer.html": [
"acf1ca37cf3904eccf4c7a9248c49e68f6260866",
"testharness"
],
"fetch/api/basic/request-referrer.js": [
"5267f72887c4f7b039d2a5aae3519dc54cceca97",
"03c8ccec8ee4b37994bf38f20ff9fd531a209974",
"support"
],
"fetch/api/basic/request-upload-worker.html": [

Просмотреть файл

@ -0,0 +1,17 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Fetch in worker: referrer header</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
let finalURL = "/fetch/api/basic/request-referrer.js";
let url = "/fetch/api/resources/redirect.py?location=" +
encodeURIComponent(finalURL);
fetch_tests_from_worker(new Worker(url));
</script>
</body>
</html>

Просмотреть файл

@ -0,0 +1,14 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Fetch in worker: referrer header</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
fetch_tests_from_worker(new Worker("request-referrer.js"));
</script>
</body>
</html>

Просмотреть файл

@ -3,7 +3,7 @@ if (this.document === undefined) {
importScripts("../resources/utils.js");
}
function testReferrer(referrer, expected) {
function testReferrer(referrer, expected, desc) {
promise_test(function(test) {
var url = RESOURCES_DIR + "inspect-headers.py?headers=referer"
var req = new Request(url, { referrer: referrer });
@ -17,12 +17,12 @@ function testReferrer(referrer, expected) {
assert_equals(actual, "", "request's referer should be empty");
}
});
});
}, desc);
}
testReferrer("about:client", window.location.href);
testReferrer("about:client", self.location.href, 'about:client referrer');
var fooURL = new URL("./foo", window.location).href;
testReferrer(fooURL, fooURL);
var fooURL = new URL("./foo", self.location).href;
testReferrer(fooURL, fooURL, 'url referrer');
done();