diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-02-25 15:07:00 -0500 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-14 12:55:19 +0200 |
commit | eb70e6e3d0bff11c25f14b1196025791bf2308fb (patch) | |
tree | 5ef4ce17db83c74d7b05ec12c8f59e095a6dd5bd /toolkit/components/url-classifier/tests/mochitest/test_trackingprotection_bug1157081.html | |
parent | 32ead795290b3399d56b4708fc75b77d296f6a1a (diff) | |
download | UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.gz UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.lz UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.xz UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.zip |
Issue #439 - Remove tests from toolkit/
Diffstat (limited to 'toolkit/components/url-classifier/tests/mochitest/test_trackingprotection_bug1157081.html')
-rw-r--r-- | toolkit/components/url-classifier/tests/mochitest/test_trackingprotection_bug1157081.html | 107 |
1 files changed, 0 insertions, 107 deletions
diff --git a/toolkit/components/url-classifier/tests/mochitest/test_trackingprotection_bug1157081.html b/toolkit/components/url-classifier/tests/mochitest/test_trackingprotection_bug1157081.html deleted file mode 100644 index 7611dd245..000000000 --- a/toolkit/components/url-classifier/tests/mochitest/test_trackingprotection_bug1157081.html +++ /dev/null @@ -1,107 +0,0 @@ -<!DOCTYPE HTML> -<!-- Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ --> -<html> -<head> - <title>Test Tracking Protection with and without Safe Browsing (Bug #1157081)</title> - <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"> -</head> - -<body> -<p id="display"></p> -<div id="content" style="display: none"> -</div> -<pre id="test"> - -<script class="testbody" type="text/javascript"> - -var Cc = SpecialPowers.Cc; -var Ci = SpecialPowers.Ci; - -var mainWindow = window.QueryInterface(Ci.nsIInterfaceRequestor) - .getInterface(Ci.nsIWebNavigation) - .QueryInterface(Ci.nsIDocShellTreeItem) - .rootTreeItem - .QueryInterface(Ci.nsIInterfaceRequestor) - .getInterface(Ci.nsIDOMWindow); -var contentPage = "chrome://mochitests/content/chrome/toolkit/components/url-classifier/tests/mochitest/classifiedAnnotatedPBFrame.html" - -Components.utils.import("resource://gre/modules/Services.jsm"); -Components.utils.import("resource://testing-common/UrlClassifierTestUtils.jsm"); - -function whenDelayedStartupFinished(aWindow, aCallback) { - Services.obs.addObserver(function observer(aSubject, aTopic) { - if (aWindow == aSubject) { - Services.obs.removeObserver(observer, aTopic); - setTimeout(aCallback, 0); - } - }, "browser-delayed-startup-finished", false); -} - -function testOnWindow(aCallback) { - var win = mainWindow.OpenBrowserWindow(); - win.addEventListener("load", function onLoad() { - win.removeEventListener("load", onLoad, false); - whenDelayedStartupFinished(win, function() { - win.addEventListener("DOMContentLoaded", function onInnerLoad() { - if (win.content.location.href != contentPage) { - win.gBrowser.loadURI(contentPage); - return; - } - win.removeEventListener("DOMContentLoaded", onInnerLoad, true); - - win.content.addEventListener('load', function innerLoad2() { - win.content.removeEventListener('load', innerLoad2, false); - SimpleTest.executeSoon(function() { aCallback(win); }); - }, false, true); - }, true); - SimpleTest.executeSoon(function() { win.gBrowser.loadURI(contentPage); }); - }); - }, true); -} - -var badids = [ - "badscript" -]; - -function checkLoads(aWindow, aBlocked) { - var win = aWindow.content; - is(win.document.getElementById("badscript").dataset.touched, aBlocked ? "no" : "yes", "Should not load tracking javascript"); -} - -SpecialPowers.pushPrefEnv( - {"set" : [["urlclassifier.trackingTable", "test-track-simple"], - ["privacy.trackingprotection.enabled", true], - ["browser.safebrowsing.malware.enabled", false], - ["browser.safebrowsing.phishing.enabled", false], - ["channelclassifier.allowlist_example", true]]}, - test); - -function test() { - SimpleTest.registerCleanupFunction(UrlClassifierTestUtils.cleanupTestTrackers); - UrlClassifierTestUtils.addTestTrackers().then(() => { - // Safe Browsing turned OFF, tracking protection should work nevertheless - testOnWindow(function(aWindow) { - checkLoads(aWindow, true); - aWindow.close(); - - // Safe Browsing turned ON, tracking protection should still work - SpecialPowers.setBoolPref("browser.safebrowsing.phishing.enabled", true); - testOnWindow(function(aWindow) { - checkLoads(aWindow, true); - aWindow.close(); - SimpleTest.finish(); - }); - }); - }); -} - -SimpleTest.waitForExplicitFinish(); - -</script> - -</pre> -<iframe id="testFrame" width="100%" height="100%" onload=""></iframe> -</body> -</html> |