Revision control
Copy as Markdown
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":
break;
case "fingerprinting":
break;
case "more-tracking":
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(
);
break;
case "third-party-cookie":
createIframe(
);
break;
case "image":
createImage(
);
break;
case "window-open":
window.win = window.open(
"_blank",
"width=100,height=100"
);
break;
case "window-close":
window.win.close();
window.win = null;
break;
}
};