Bug 1522565 - Tests for cryptominers and fingerprinters sub-panels. r=nhnt11

Differential Revision: https://phabricator.services.mozilla.com/D18827
This commit is contained in:
Johann Hofmann
2019-02-06 14:12:20 +01:00
parent a5bb82422f
commit 3e973f9c07
8 changed files with 236 additions and 31 deletions

View File

@@ -1,44 +1,41 @@
function createIframe(src) {
let ifr = document.createElement("iframe");
ifr.src = src;
document.body.appendChild(ifr);
}
onmessage = event => {
switch (event.data) {
case "tracking": {
let ifr = document.createElement("iframe");
ifr.src = "https://trackertest.org/";
document.body.appendChild(ifr);
}
case "tracking":
createIframe("https://trackertest.org/");
break;
case "more-tracking": {
let ifr = document.createElement("iframe");
ifr.src = "https://itisatracker.org/";
document.body.appendChild(ifr);
}
case "cryptomining":
createIframe("http://cryptomining.example.com/");
break;
case "cookie": {
let ifr = document.createElement("iframe");
ifr.src = "https://trackertest.org/browser/browser/base/content/test/trackingUI/cookieServer.sjs";
document.body.appendChild(ifr);
}
case "fingerprinting":
createIframe("https://fingerprinting.example.com/");
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...
let ifr = document.createElement("iframe");
ifr.src = "http://not-tracking.example.com/browser/browser/base/content/test/trackingUI/cookieServer.sjs";
document.body.appendChild(ifr);
}
case "more-tracking":
createIframe("https://itisatracker.org/");
break;
case "third-party-cookie": {
let ifr = document.createElement("iframe");
ifr.src = "https://test1.example.org/browser/browser/base/content/test/trackingUI/cookieServer.sjs";
document.body.appendChild(ifr);
}
case "cookie":
createIframe("https://trackertest.org/browser/browser/base/content/test/trackingUI/cookieServer.sjs");
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("http://not-tracking.example.com/browser/browser/base/content/test/trackingUI/cookieServer.sjs");
break;
case "third-party-cookie":
createIframe("https://test1.example.org/browser/browser/base/content/test/trackingUI/cookieServer.sjs");
break;
case "window-open":
window.win = window.open("http://trackertest.org/browser/browser/base/content/test/trackingUI/cookieServer.sjs", "_blank", "width=100,height=100");
window.win = window.open("http://trackertest.org/browser/browser/base/content/test/trackingUI/cookieServer.sjs", "_blank", "width=100,height=100");
break;
case "window-close":
window.win.close();
window.win = null;
window.win.close();
window.win = null;
break;
}
};