Source code
Revision control
Copy as Markdown
Other Tools
function createIframe(src) {
let ifr = document.createElement("iframe");
ifr.src = src;
document.body.appendChild(ifr);
}
function createImage(src) {
let img = document.createElement("img");
img.src = src;
img.onload = () => {
parent.postMessage("done", "*");
};
document.body.appendChild(img);
}
onmessage = event => {
switch (event.data) {
case "tracking":
break;
case "socialtracking":
createIframe(
"https://social-tracking.example.org/browser/browser/base/content/test/protectionsUI/cookieServer.sjs"
);
break;
case "cryptomining":
// eslint-disable-next-line @microsoft/sdl/no-insecure-url
break;
case "fingerprinting":
break;
case "more-tracking":
break;
case "more-tracking-2":
break;
case "cookie":
createIframe(
);
break;
case "first-party-cookie":
// Since the content blocking log doesn't seem to get updated for
// top-level cookies right now, we just create an iframe with the
// first party domain...
createIframe(
// eslint-disable-next-line @microsoft/sdl/no-insecure-url
);
break;
case "third-party-cookie":
createIframe(
);
break;
case "image":
createImage(
// eslint-disable-next-line @microsoft/sdl/no-insecure-url
);
break;
case "window-open":
window.win = window.open(
// eslint-disable-next-line @microsoft/sdl/no-insecure-url
"_blank",
"width=100,height=100"
);
break;
case "window-close":
window.win.close();
window.win = null;
break;
}
};