referrer-unsafe-url.js (776B)
1 if (this.document === undefined) { 2 importScripts("/resources/testharness.js"); 3 importScripts("../resources/utils.js"); 4 5 // A nested importScripts() with a referrer-policy should have no effect 6 // on overall worker policy. 7 importScripts("nested-policy.js"); 8 } 9 10 var referrerUrl = location.href; 11 var fetchedUrl = RESOURCES_DIR + "inspect-headers.py?headers=referer"; 12 13 promise_test(function(test) { 14 return fetch(fetchedUrl).then(function(resp) { 15 assert_equals(resp.status, 200, "HTTP status is 200"); 16 assert_equals(resp.type , "basic", "Response's type is basic"); 17 assert_equals(resp.headers.get("x-request-referer"), referrerUrl, "request's referrer is " + referrerUrl); 18 }); 19 }, "Request's referrer is the full url of current document/worker"); 20 21 done();