blob: cc5cc8e01d40dac173ccff3325a860f46d318cb2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
if (this.document === undefined) {
importScripts("/resources/testharness.js");
importScripts("../resources/utils.js");
}
function testReferrer(referrer, expected) {
promise_test(function(test) {
var url = RESOURCES_DIR + "inspect-headers.py?headers=referer"
var req = new Request(url, { referrer: referrer });
return fetch(req).then(function(resp) {
var actual = resp.headers.get("x-request-referer");
if (expected) {
assert_equals(actual, expected, "request's referer should be: " + expected);
return;
}
if (actual) {
assert_equals(actual, "", "request's referer should be empty");
}
});
});
}
testReferrer("about:client", window.location.href);
var fooURL = new URL("./foo", window.location).href;
testReferrer(fooURL, fooURL);
done();
|