1 var refererLocation
= location
.href
.replace(/:\/\/.*\@/, "://").replace(/#.*$/, "");
2 var xhr
= new XMLHttpRequest
;
4 importScripts("worker-pre.js");
8 postMessage("log " + message
);
16 function verifyReferer(method
, xhr
)
18 if (xhr
.responseText
== refererLocation
)
19 log("PASS: " + method
+ " referer.");
21 log("FAIL: " + method
+ ". Expected referer: '" + refererLocation
+ "' Actual referer: '" + xhr
.responseText
+ "'");
24 function processStateChange()
26 if (xhr
.readyState
== 4) {
27 verifyReferer("Async", xhr
);
34 xhr
.open("GET", "../../resources/print-referer.cgi", false);
36 verifyReferer("Sync", xhr
);
37 xhr
.open("GET", "../../resources/print-referer.cgi", true);
38 xhr
.onreadystatechange
= processStateChange
;