Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- Manifest: dom/security/test/general/mochitest.toml
<!DOCTYPE HTML>
<html>
<head>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<iframe id="frame_meta_in_head"></iframe>
<iframe id="frame_meta_notin_head"></iframe>
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
let testCounter = 0;
function checkTestsDone() {
testCounter++;
if(testCounter == 2) {
SimpleTest.finish();
}
}
var script = SpecialPowers.loadChromeScript(() => {
/* eslint-env mozilla/chrome-script */
let counter = 0;
Services.obs.addObserver(function onExamResp(subject) {
let channel = subject.QueryInterface(Ci.nsIHttpChannel);
return;
}
let refererHeaderSet = false;
try {
channel.getRequestHeader("referer");
refererHeaderSet = true;
} catch (e) {
refererHeaderSet = false;
}
ok(!refererHeaderSet, "the referer header should not be set");
counter++;
sendAsyncMessage("checked-referer-header");
}, "http-on-stop-request");
});
script.addMessageListener("checked-referer-header", checkTestsDone);
let frame1 = document.getElementById("frame_meta_in_head");
frame1.src = "/tests/dom/security/test/general/file_meta_referrer_in_head.html";
let frame2 = document.getElementById("frame_meta_notin_head");
frame2.src = "/tests/dom/security/test/general/file_meta_referrer_notin_head.html";
</script>
</body>
</html>