referrer-origin-when-cross-origin.js (812B)
1 if (this.document === undefined) { 2 importScripts("/resources/testharness.js"); 3 importScripts("../resources/utils.js"); 4 importScripts("/common/get-host-info.sub.js"); 5 6 // A nested importScripts() with a referrer-policy should have no effect 7 // on overall worker policy. 8 importScripts("nested-policy.js"); 9 } 10 11 var referrerOrigin = location.origin + '/'; 12 var fetchedUrl = get_host_info().HTTP_REMOTE_ORIGIN + dirname(location.pathname) + RESOURCES_DIR + "inspect-headers.py?cors&headers=referer"; 13 14 promise_test(function(test) { 15 return fetch(fetchedUrl).then(function(resp) { 16 assert_equals(resp.status, 200, "HTTP status is 200"); 17 assert_equals(resp.headers.get("x-request-referer"), referrerOrigin, "request's referrer is " + referrerOrigin); 18 }); 19 }, "Request's referrer is origin"); 20 21 done();