Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Bug 1647681</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
<script>
async function runTests() {
await SpecialPowers.pushPrefEnv({set: [
["privacy.trackingprotection.annotate_channels", true],
]});
var chromeScript;
chromeScript = SpecialPowers.loadChromeScript(_ => {
/* eslint-env mozilla/chrome-script */
function onExamResp(subject) {
let channel = subject.QueryInterface(Ci.nsIHttpChannel);
let classifiedChannel = subject.QueryInterface(Ci.nsIClassifiedChannel);
if (
!channel ||
!classifiedChannel ||
!channel.URI.spec.startsWith(
)
) {
return;
}
sendAsyncMessage("last-channel-flags", {
classified: Ci.nsIClassifiedChannel.CLASSIFIED_TRACKING == classifiedChannel.classificationFlags,
});
}
addMessageListener("done", __ => {
Services.obs.removeObserver(onExamResp, "http-on-examine-response");
});
Services.obs.addObserver(onExamResp, "http-on-examine-response");
sendAsyncMessage("start-test");
});
chromeScript.addMessageListener(
"start-test",
async _ => {
},
{ once: true }
);
chromeScript.addMessageListener(
"last-channel-flags",
data => {
ok(data.classified, "tracker script should be classified when the top-level is sandboxed");
chromeScript.sendAsyncMessage("done");
SimpleTest.finish();
},
{ once: true }
);
}
SimpleTest.waitForExplicitFinish();
runTests();
</script>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test"></pre>
</body>
</html>