1
0
Fork 0

For #10761: Updates UI test tracking test page asset (#10945)

master
Oana Horvath 2020-05-28 17:57:10 +03:00 committed by GitHub
parent 6cef0edd5e
commit 43a78c4fd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 77 additions and 12 deletions

View File

@ -3,16 +3,11 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<html dir="ltr" xml:lang="en-US" lang="en-US">
<head>
<head>
<meta charset="utf8">
<title>Trackers</title></head>
</head>
<body>
<p>Trackers</p>
<!-- test-track-simple -->
<script src="http://trackertest.org/tracker.js"></script>
<script src="https://tracking.example.com/tracker.js"></script>
<script src="https://itisatracker.org/tracker.js"></script>
</body>
<script src="../resources/trackingAPI.js" type="text/javascript"></script>
</head>
<body>
<iframe src="http://trackertest.org/"></iframe>
</body>
</html>

View File

@ -0,0 +1,70 @@
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":
createIframe("https://trackertest.org/");
break;
case "socialtracking":
createIframe(
"https://social-tracking.example.org/browser/browser/base/content/test/protectionsUI/cookieServer.sjs"
);
break;
case "cryptomining":
createIframe("http://cryptomining.example.com/");
break;
case "fingerprinting":
createIframe("https://fingerprinting.example.com/");
break;
case "more-tracking":
createIframe("https://itisatracker.org/");
break;
case "cookie":
createIframe(
"https://trackertest.org/browser/browser/base/content/test/protectionsUI/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/protectionsUI/cookieServer.sjs"
);
break;
case "third-party-cookie":
createIframe(
"https://test1.example.org/browser/browser/base/content/test/protectionsUI/cookieServer.sjs"
);
break;
case "image":
createImage(
"http://trackertest.org/browser/browser/base/content/test/protectionsUI/cookieServer.sjs?type=image-no-cookie"
);
break;
case "window-open":
window.win = window.open(
"http://trackertest.org/browser/browser/base/content/test/protectionsUI/cookieServer.sjs",
"_blank",
"width=100,height=100"
);
break;
case "window-close":
window.win.close();
window.win = null;
break;
}
};

View File

@ -76,7 +76,7 @@ object TestAssetHelper {
}
fun getEnhancedTrackingProtectionAsset(server: MockWebServer): TestAsset {
val url = server.url("pages/etp.html").toString().toUri()!!
val url = server.url("pages/trackingPage.html").toString().toUri()!!
return TestAsset(url, "", "")
}