Backed out 3 changesets (bug 1451307) for Mochitest failure on toolkit/components/url-classifier/tests/mochitest/test_bug1254766.html. CLOSED TREE
authorDorel Luca <dluca@mozilla.com>
Thu, 26 Apr 2018 05:08:47 +0300
changeset 471693 76f35d0ecaa690917347f2b0f97180b05e7272bb
parent 471692 52e0b45195cb8f9a0e6c3fc4d9ee49f025232010
child 471775 b62ad926cf2a2d5759222f4e9b40c9e3bd3bdd31
child 471779 733115bbb9b59a4d35232c3a792b7aa524bd7176
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1451307, 1254766
milestone61.0a1
backs outbe0a9b78c2242fcc4eb2545d7fe5b58fecd250e7
13e58d5887d8b8dae297577abe1d15edf254cd44
7f89d94d45bad5bb387568d935e8dff69312fd7b
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 3 changesets (bug 1451307) for Mochitest failure on toolkit/components/url-classifier/tests/mochitest/test_bug1254766.html. CLOSED TREE Backed out changeset be0a9b78c224 (bug 1451307) Backed out changeset 13e58d5887d8 (bug 1451307) Backed out changeset 7f89d94d45ba (bug 1451307)
browser/base/content/moz.build
browser/base/content/test/general/benignPage.html
browser/base/content/test/general/browser.ini
browser/base/content/test/general/browser_trackingUI_1.js
browser/base/content/test/general/browser_trackingUI_2.js
browser/base/content/test/general/browser_trackingUI_3.js
browser/base/content/test/general/browser_trackingUI_4.js
browser/base/content/test/general/browser_trackingUI_5.js
browser/base/content/test/general/browser_trackingUI_6.js
browser/base/content/test/general/browser_trackingUI_telemetry.js
browser/base/content/test/general/file_trackingUI_6.html
browser/base/content/test/general/file_trackingUI_6.js
browser/base/content/test/general/file_trackingUI_6.js^headers^
browser/base/content/test/general/trackingPage.html
browser/base/content/test/trackingUI/.eslintrc.js
browser/base/content/test/trackingUI/benignPage.html
browser/base/content/test/trackingUI/browser.ini
browser/base/content/test/trackingUI/browser_trackingUI_1.js
browser/base/content/test/trackingUI/browser_trackingUI_2.js
browser/base/content/test/trackingUI/browser_trackingUI_3.js
browser/base/content/test/trackingUI/browser_trackingUI_4.js
browser/base/content/test/trackingUI/browser_trackingUI_5.js
browser/base/content/test/trackingUI/browser_trackingUI_6.js
browser/base/content/test/trackingUI/browser_trackingUI_iframe.js
browser/base/content/test/trackingUI/browser_trackingUI_telemetry.js
browser/base/content/test/trackingUI/browser_trackingUI_unloaded_documents.js
browser/base/content/test/trackingUI/file_trackingUI_6.html
browser/base/content/test/trackingUI/file_trackingUI_6.js
browser/base/content/test/trackingUI/file_trackingUI_6.js^headers^
browser/base/content/test/trackingUI/head.js
browser/base/content/test/trackingUI/trackingPage.html
browser/base/content/test/trackingUI/trackingPage_iframe.html
browser/base/content/test/trackingUI/trackingPage_onunload.html
browser/base/moz.build
browser/components/uitour/test/browser.ini
browser/components/uitour/test/browser_trackingProtection.js
netwerk/base/nsChannelClassifier.cpp
netwerk/base/nsChannelClassifier.h
--- a/browser/base/content/moz.build
+++ b/browser/base/content/moz.build
@@ -84,19 +84,16 @@ with Files("test/tabcrashed/**"):
     BUG_COMPONENT = ("Firefox", "Tabbed Browser")
 
 with Files("test/tabs/**"):
     BUG_COMPONENT = ("Firefox", "Tabbed Browser")
 
 with Files("test/touch/**"):
     BUG_COMPONENT = ("Firefox", "General")
 
-with Files("test/trackingUI/**"):
-    BUG_COMPONENT = ("Firefox", "Tracking Protection")
-
 with Files("test/urlbar/**"):
     BUG_COMPONENT = ("Firefox", "Address Bar")
 
 with Files("test/webextensions/**"):
     BUG_COMPONENT = ("Toolkit", "WebExtensions: Untriaged")
 
 with Files("test/webrtc/**"):
     BUG_COMPONENT = ("Core", "WebRTC")
rename from browser/base/content/test/trackingUI/benignPage.html
rename to browser/base/content/test/general/benignPage.html
--- a/browser/base/content/test/general/browser.ini
+++ b/browser/base/content/test/general/browser.ini
@@ -455,16 +455,54 @@ support-files =
 # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
 [browser_tabs_isActive.js]
 # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
 [browser_tabs_owner.js]
 # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
 [browser_testOpenNewRemoteTabsFromNonRemoteBrowsers.js]
 run-if = e10s
 # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
+[browser_trackingUI_1.js]
+tags = trackingprotection
+support-files =
+  trackingPage.html
+  benignPage.html
+# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
+[browser_trackingUI_2.js]
+tags = trackingprotection
+support-files =
+  trackingPage.html
+  benignPage.html
+# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
+[browser_trackingUI_3.js]
+tags = trackingprotection
+# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
+[browser_trackingUI_4.js]
+tags = trackingprotection
+support-files =
+  trackingPage.html
+  benignPage.html
+# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
+[browser_trackingUI_5.js]
+tags = trackingprotection
+support-files =
+  trackingPage.html
+# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
+[browser_trackingUI_6.js]
+tags = trackingprotection
+support-files =
+  file_trackingUI_6.html
+  file_trackingUI_6.js
+  file_trackingUI_6.js^headers^
+# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
+[browser_trackingUI_telemetry.js]
+tags = trackingprotection
+support-files =
+  trackingPage.html
+# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
 [browser_typeAheadFind.js]
 # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
 [browser_unknownContentType_title.js]
 # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
 [browser_unloaddialogs.js]
 # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
 [browser_utilityOverlay.js]
 # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
rename from browser/base/content/test/trackingUI/browser_trackingUI_1.js
rename to browser/base/content/test/general/browser_trackingUI_1.js
--- a/browser/base/content/test/trackingUI/browser_trackingUI_1.js
+++ b/browser/base/content/test/general/browser_trackingUI_1.js
@@ -2,19 +2,25 @@
  * Test that the Tracking Protection section is visible in the Control Center
  * and has the correct state for the cases when:
  *   1) A page with no tracking elements is loaded.
  *   2) A page with tracking elements is loaded and they are blocked.
  *   3) A page with tracking elements is loaded and they are not blocked.
  * See also Bugs 1175327, 1043801, 1178985
  */
 
+const PREF = "privacy.trackingprotection.enabled";
+const PB_PREF = "privacy.trackingprotection.pbmode.enabled";
+const BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/benignPage.html";
+const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/trackingPage.html";
 var TrackingProtection = null;
 var tabbrowser = null;
 
+var {UrlClassifierTestUtils} = ChromeUtils.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
+
 registerCleanupFunction(function() {
   TrackingProtection = tabbrowser = null;
   UrlClassifierTestUtils.cleanupTestTrackers();
   Services.prefs.clearUserPref(PREF);
   Services.prefs.clearUserPref(PB_PREF);
   while (gBrowser.tabs.length > 1) {
     gBrowser.removeCurrentTab();
   }
rename from browser/base/content/test/trackingUI/browser_trackingUI_2.js
rename to browser/base/content/test/general/browser_trackingUI_2.js
--- a/browser/base/content/test/trackingUI/browser_trackingUI_2.js
+++ b/browser/base/content/test/general/browser_trackingUI_2.js
@@ -1,17 +1,23 @@
 /*
  * Test that the Tracking Protection section is never visible in the
  * Control Center when the feature is off.
  * See also Bugs 1175327, 1043801, 1178985.
  */
 
+const PREF = "privacy.trackingprotection.enabled";
+const PB_PREF = "privacy.trackingprotection.pbmode.enabled";
+const BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/benignPage.html";
+const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/trackingPage.html";
 var TrackingProtection = null;
 var tabbrowser = null;
 
+var {UrlClassifierTestUtils} = ChromeUtils.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
+
 registerCleanupFunction(function() {
   TrackingProtection = tabbrowser = null;
   UrlClassifierTestUtils.cleanupTestTrackers();
   Services.prefs.clearUserPref(PREF);
   Services.prefs.clearUserPref(PB_PREF);
   while (gBrowser.tabs.length > 1) {
     gBrowser.removeCurrentTab();
   }
rename from browser/base/content/test/trackingUI/browser_trackingUI_3.js
rename to browser/base/content/test/general/browser_trackingUI_3.js
--- a/browser/base/content/test/trackingUI/browser_trackingUI_3.js
+++ b/browser/base/content/test/general/browser_trackingUI_3.js
@@ -1,16 +1,19 @@
 /*
  * Test that the Tracking Protection is correctly enabled / disabled
  * in both normal and private windows given all possible states of the prefs:
  *   privacy.trackingprotection.enabled
  *   privacy.trackingprotection.pbmode.enabled
  * See also Bug 1178985.
  */
 
+const PREF = "privacy.trackingprotection.enabled";
+const PB_PREF = "privacy.trackingprotection.pbmode.enabled";
+
 registerCleanupFunction(function() {
   Services.prefs.clearUserPref(PREF);
   Services.prefs.clearUserPref(PB_PREF);
 });
 
 add_task(async function testNormalBrowsing() {
   let TrackingProtection = gBrowser.ownerGlobal.TrackingProtection;
   ok(TrackingProtection, "TP is attached to the browser window");
rename from browser/base/content/test/trackingUI/browser_trackingUI_4.js
rename to browser/base/content/test/general/browser_trackingUI_4.js
--- a/browser/base/content/test/trackingUI/browser_trackingUI_4.js
+++ b/browser/base/content/test/general/browser_trackingUI_4.js
@@ -1,17 +1,23 @@
 /*
  * Test that the Tracking Protection icon is properly animated in the identity
  * block when loading tabs and switching between tabs.
  * See also Bug 1175858.
  */
 
+const PREF = "privacy.trackingprotection.enabled";
+const PB_PREF = "privacy.trackingprotection.pbmode.enabled";
+const BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/benignPage.html";
+const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/trackingPage.html";
 var TrackingProtection = null;
 var tabbrowser = null;
 
+var {UrlClassifierTestUtils} = ChromeUtils.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
+
 registerCleanupFunction(function() {
   TrackingProtection = tabbrowser = null;
   UrlClassifierTestUtils.cleanupTestTrackers();
   Services.prefs.clearUserPref(PREF);
   Services.prefs.clearUserPref(PB_PREF);
   while (gBrowser.tabs.length > 1) {
     gBrowser.removeCurrentTab();
   }
rename from browser/base/content/test/trackingUI/browser_trackingUI_5.js
rename to browser/base/content/test/general/browser_trackingUI_5.js
--- a/browser/base/content/test/trackingUI/browser_trackingUI_5.js
+++ b/browser/base/content/test/general/browser_trackingUI_5.js
@@ -1,16 +1,19 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that sites added to the Tracking Protection whitelist in private
 // browsing mode don't persist once the private browsing window closes.
 
+const PB_PREF = "privacy.trackingprotection.pbmode.enabled";
+const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/trackingPage.html";
 var TrackingProtection = null;
 var browser = null;
+var {UrlClassifierTestUtils} = ChromeUtils.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
 
 registerCleanupFunction(function() {
   TrackingProtection = browser = null;
   UrlClassifierTestUtils.cleanupTestTrackers();
 });
 
 function hidden(sel) {
   let win = browser.ownerGlobal;
@@ -70,17 +73,17 @@ function testTrackingPageUnblocked() {
 
 add_task(async function testExceptionAddition() {
   await UrlClassifierTestUtils.addTestTrackers();
   let privateWin = await promiseOpenAndLoadWindow({private: true}, true);
   browser = privateWin.gBrowser;
   let tab = await BrowserTestUtils.openNewForegroundTab({ gBrowser: browser, waitForLoad: true, waitForStateStop: true });
 
   TrackingProtection = browser.ownerGlobal.TrackingProtection;
-  await SpecialPowers.pushPrefEnv({"set": [[PB_PREF, true]]});
+  await pushPrefs([PB_PREF, true]);
 
   ok(TrackingProtection.enabled, "TP is enabled after setting the pref");
 
   info("Load a test page containing tracking elements");
   await promiseTabLoadEvent(tab, TRACKING_PAGE);
 
   testTrackingPage(tab.ownerGlobal);
 
rename from browser/base/content/test/trackingUI/browser_trackingUI_6.js
rename to browser/base/content/test/general/browser_trackingUI_6.js
--- a/browser/base/content/test/trackingUI/browser_trackingUI_6.js
+++ b/browser/base/content/test/general/browser_trackingUI_6.js
@@ -1,9 +1,9 @@
-const URL = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "http://mochi.test:8888") + "file_trackingUI_6.html";
+const URL = "http://mochi.test:8888/browser/browser/base/content/test/general/file_trackingUI_6.html";
 
 function waitForSecurityChange(numChanges = 1) {
   return new Promise(resolve => {
     let n = 0;
     let listener = {
       onSecurityChange() {
         n = n + 1;
         info("Received onSecurityChange event " + n + " of " + numChanges);
rename from browser/base/content/test/trackingUI/browser_trackingUI_telemetry.js
rename to browser/base/content/test/general/browser_trackingUI_telemetry.js
--- a/browser/base/content/test/trackingUI/browser_trackingUI_telemetry.js
+++ b/browser/base/content/test/general/browser_trackingUI_telemetry.js
@@ -1,12 +1,17 @@
 /*
  * Test telemetry for Tracking Protection
  */
 
+const PREF = "privacy.trackingprotection.enabled";
+const BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/benignPage.html";
+const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/trackingPage.html";
+const {UrlClassifierTestUtils} = ChromeUtils.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
+
 /**
  * Enable local telemetry recording for the duration of the tests.
  */
 var oldCanRecord = Services.telemetry.canRecordExtended;
 Services.telemetry.canRecordExtended = true;
 Services.prefs.setBoolPref(PREF, false);
 Services.telemetry.getHistogramById("TRACKING_PROTECTION_ENABLED").clear();
 registerCleanupFunction(function() {
rename from browser/base/content/test/trackingUI/file_trackingUI_6.html
rename to browser/base/content/test/general/file_trackingUI_6.html
--- a/browser/base/content/test/trackingUI/file_trackingUI_6.html
+++ b/browser/base/content/test/general/file_trackingUI_6.html
@@ -3,14 +3,14 @@
 <head>
   <meta charset="UTF-8">
   <title>Testing the shield from fetch and XHR</title>
 </head>
 <body>
   <p>Hello there!</p>
   <script type="application/javascript">
     function test_fetch() {
-      let url = "http://trackertest.org/browser/browser/base/content/test/trackingUI/file_trackingUI_6.js";
+      let url = "http://trackertest.org/browser/browser/base/content/test/general/file_trackingUI_6.js";
       return fetch(url);
     }
   </script>
 </body>
 </html>
rename from browser/base/content/test/trackingUI/file_trackingUI_6.js
rename to browser/base/content/test/general/file_trackingUI_6.js
rename from browser/base/content/test/trackingUI/file_trackingUI_6.js^headers^
rename to browser/base/content/test/general/file_trackingUI_6.js^headers^
rename from browser/base/content/test/trackingUI/trackingPage.html
rename to browser/base/content/test/general/trackingPage.html
deleted file mode 100644
--- a/browser/base/content/test/trackingUI/.eslintrc.js
+++ /dev/null
@@ -1,7 +0,0 @@
-"use strict";
-
-module.exports = {
-  "extends": [
-    "plugin:mozilla/browser-test"
-  ]
-};
deleted file mode 100644
--- a/browser/base/content/test/trackingUI/browser.ini
+++ /dev/null
@@ -1,24 +0,0 @@
-[DEFAULT]
-tags = trackingprotection
-support-files =
-  head.js
-  trackingPage.html
-  benignPage.html
-
-[browser_trackingUI_1.js]
-[browser_trackingUI_2.js]
-[browser_trackingUI_3.js]
-[browser_trackingUI_4.js]
-[browser_trackingUI_5.js]
-[browser_trackingUI_6.js]
-support-files =
-  file_trackingUI_6.html
-  file_trackingUI_6.js
-  file_trackingUI_6.js^headers^
-[browser_trackingUI_iframe.js]
-support-files =
-  trackingPage_iframe.html
-[browser_trackingUI_telemetry.js]
-[browser_trackingUI_unloaded_documents.js]
-support-files =
-  trackingPage_onunload.html
deleted file mode 100644
--- a/browser/base/content/test/trackingUI/browser_trackingUI_iframe.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-const URL = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "http://example.org") + "trackingPage_iframe.html";
-
-/**
- * Tests that sites that only contain trackers in iframes still
- * get the tracking protection UI.
- */
-
-add_task(async function test_iframe() {
-  await UrlClassifierTestUtils.addTestTrackers();
-
-  await SpecialPowers.pushPrefEnv({ set: [[PREF, true]] });
-
-  await BrowserTestUtils.withNewTab(URL, async function(browser) {
-    var TrackingProtection = browser.ownerGlobal.TrackingProtection;
-    ok(TrackingProtection, "got TP object");
-    ok(TrackingProtection.enabled, "TP is enabled");
-
-    is(TrackingProtection.content.getAttribute("state"), "blocked-tracking-content",
-        'content: state="blocked-tracking-content"');
-    is(TrackingProtection.icon.getAttribute("state"), "blocked-tracking-content",
-        'icon: state="blocked-tracking-content"');
-    is(TrackingProtection.icon.getAttribute("tooltiptext"),
-       gNavigatorBundle.getString("trackingProtection.icon.activeTooltip"), "correct tooltip");
-  });
-
-  UrlClassifierTestUtils.cleanupTestTrackers();
-});
deleted file mode 100644
--- a/browser/base/content/test/trackingUI/browser_trackingUI_unloaded_documents.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-const URL = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "http://example.org") + "trackingPage_onunload.html";
-
-/**
- * Tests that visiting a new page while a request to a tracker is still
- * in flight (such as when it was triggered on unload) does not cause
- * the tracking UI to appear.
- */
-
-add_task(async function test_onunload() {
-  await UrlClassifierTestUtils.addTestTrackers();
-
-  await SpecialPowers.pushPrefEnv({ set: [[PREF, true]] });
-
-  let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, URL);
-  let browser = tab.linkedBrowser;
-
-  let loaded = BrowserTestUtils.browserLoaded(browser, false, "http://example.com/");
-  await BrowserTestUtils.loadURI(browser, "http://example.com/");
-  await loaded;
-  var TrackingProtection = browser.ownerGlobal.TrackingProtection;
-  ok(TrackingProtection, "got TP object");
-  ok(TrackingProtection.enabled, "TP is enabled");
-
-  ok(!TrackingProtection.container.hidden, "The container is visible");
-  ok(!TrackingProtection.content.hasAttribute("state"), "content: no state");
-  ok(!TrackingProtection.icon.hasAttribute("state"), "icon: no state");
-  ok(!TrackingProtection.icon.hasAttribute("tooltiptext"), "icon: no tooltip");
-
-  BrowserTestUtils.removeTab(tab);
-  UrlClassifierTestUtils.cleanupTestTrackers();
-});
deleted file mode 100644
--- a/browser/base/content/test/trackingUI/head.js
+++ /dev/null
@@ -1,77 +0,0 @@
-var {UrlClassifierTestUtils} = ChromeUtils.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
-
-const PREF = "privacy.trackingprotection.enabled";
-const PB_PREF = "privacy.trackingprotection.pbmode.enabled";
-const ROOT = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "http://tracking.example.org");
-const BENIGN_PAGE = ROOT + "benignPage.html";
-const TRACKING_PAGE = ROOT + "trackingPage.html";
-
-function promiseWindowWillBeClosed(win) {
-  return new Promise((resolve, reject) => {
-    Services.obs.addObserver(function observe(subject, topic) {
-      if (subject == win) {
-        Services.obs.removeObserver(observe, topic);
-        executeSoon(resolve);
-      }
-    }, "domwindowclosed");
-  });
-}
-
-function promiseWindowClosed(win) {
-  let promise = promiseWindowWillBeClosed(win);
-  win.close();
-  return promise;
-}
-
-function promiseOpenAndLoadWindow(aOptions, aWaitForDelayedStartup = false) {
-  return new Promise(resolve => {
-    let win = OpenBrowserWindow(aOptions);
-    if (aWaitForDelayedStartup) {
-      Services.obs.addObserver(function onDS(aSubject, aTopic, aData) {
-        if (aSubject != win) {
-          return;
-        }
-        Services.obs.removeObserver(onDS, "browser-delayed-startup-finished");
-        resolve(win);
-      }, "browser-delayed-startup-finished");
-
-    } else {
-      win.addEventListener("load", function() {
-        resolve(win);
-      }, {once: true});
-    }
-  });
-}
-
-/**
- * Waits for a load (or custom) event to finish in a given tab. If provided
- * load an uri into the tab.
- *
- * @param tab
- *        The tab to load into.
- * @param [optional] url
- *        The url to load, or the current url.
- * @return {Promise} resolved when the event is handled.
- * @resolves to the received event
- * @rejects if a valid load event is not received within a meaningful interval
- */
-function promiseTabLoadEvent(tab, url) {
-  info("Wait tab event: load");
-
-  function handle(loadedUrl) {
-    if (loadedUrl === "about:blank" || (url && loadedUrl !== url)) {
-      info(`Skipping spurious load event for ${loadedUrl}`);
-      return false;
-    }
-
-    info("Tab event received: load");
-    return true;
-  }
-
-  let loaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, handle);
-
-  if (url)
-    BrowserTestUtils.loadURI(tab.linkedBrowser, url);
-
-  return loaded;
-}
deleted file mode 100644
--- a/browser/base/content/test/trackingUI/trackingPage_iframe.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE HTML>
-<!-- Any copyright is dedicated to the Public Domain.
-   - http://creativecommons.org/publicdomain/zero/1.0/ -->
-<html dir="ltr" xml:lang="en-US" lang="en-US">
-  <head>
-    <meta charset="utf8">
-  </head>
-  <body>
-    <iframe src="http://example.com/browser/browser/base/content/test/trackingUI/trackingPage.html"></iframe>
-  </body>
-</html>
deleted file mode 100644
--- a/browser/base/content/test/trackingUI/trackingPage_onunload.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<!DOCTYPE HTML>
-<!-- Any copyright is dedicated to the Public Domain.
-   - http://creativecommons.org/publicdomain/zero/1.0/ -->
-<html dir="ltr" xml:lang="en-US" lang="en-US">
-  <head>
-    <meta charset="utf8">
-    <script>
-      window.onunload = function() {
-        var img = new Image();
-        img.src = "http://tracking.example.com/";
-        document.body.appendChild(img);
-      };
-    </script>
-  </head>
-  <body>
-    Testing tracking requests onunload.
-  </body>
-</html>
--- a/browser/base/moz.build
+++ b/browser/base/moz.build
@@ -48,17 +48,16 @@ BROWSER_CHROME_MANIFESTS += [
     'content/test/siteIdentity/browser.ini',
     'content/test/static/browser.ini',
     'content/test/statuspanel/browser.ini',
     'content/test/sync/browser.ini',
     'content/test/tabcrashed/browser.ini',
     'content/test/tabPrompts/browser.ini',
     'content/test/tabs/browser.ini',
     'content/test/touch/browser.ini',
-    'content/test/trackingUI/browser.ini',
     'content/test/urlbar/browser.ini',
     'content/test/webextensions/browser.ini',
     'content/test/webrtc/browser.ini',
 ]
 
 DEFINES['MOZ_APP_VERSION'] = CONFIG['MOZ_APP_VERSION']
 DEFINES['MOZ_APP_VERSION_DISPLAY'] = CONFIG['MOZ_APP_VERSION_DISPLAY']
 
--- a/browser/components/uitour/test/browser.ini
+++ b/browser/components/uitour/test/browser.ini
@@ -12,18 +12,18 @@ skip-if = debug || asan # updateUI leaks
 [browser_no_tabs.js]
 [browser_openPreferences.js]
 [browser_openSearchPanel.js]
 skip-if = true # Bug 1113038 - Intermittent "Popup was opened"
 [browser_trackingProtection.js]
 skip-if = os == "linux" # Intermittent NS_ERROR_NOT_AVAILABLE [nsIUrlClassifierDBService.beginUpdate]
 tag = trackingprotection
 support-files =
-  !/browser/base/content/test/trackingUI/benignPage.html
-  !/browser/base/content/test/trackingUI/trackingPage.html
+  !/browser/base/content/test/general/benignPage.html
+  !/browser/base/content/test/general/trackingPage.html
 [browser_trackingProtection_tour.js]
 tag = trackingprotection
 [browser_showMenu.js]
 tag = trackingprotection
 [browser_UITour.js]
 skip-if = os == "linux" # Intermittent failures, bug 951965
 [browser_UITour2.js]
 [browser_UITour3.js]
--- a/browser/components/uitour/test/browser_trackingProtection.js
+++ b/browser/components/uitour/test/browser_trackingProtection.js
@@ -1,14 +1,14 @@
 "use strict";
 
 const PREF_INTRO_COUNT = "privacy.trackingprotection.introCount";
 const PREF_TP_ENABLED = "privacy.trackingprotection.enabled";
-const BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/trackingUI/benignPage.html";
-const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
+const BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/benignPage.html";
+const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/trackingPage.html";
 const TOOLTIP_PANEL = document.getElementById("UITourTooltip");
 const TOOLTIP_ANCHOR = document.getElementById("tracking-protection-icon");
 
 var {UrlClassifierTestUtils} = ChromeUtils.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
 
 registerCleanupFunction(function() {
   UrlClassifierTestUtils.cleanupTestTrackers();
   Services.prefs.clearUserPref(PREF_TP_ENABLED);
--- a/netwerk/base/nsChannelClassifier.cpp
+++ b/netwerk/base/nsChannelClassifier.cpp
@@ -798,35 +798,16 @@ nsChannelClassifier::SameLoadingURI(nsID
     return false;
   }
   bool equals = false;
   nsresult rv = docURI->EqualsExceptRef(channelLoadingURI, &equals);
   return NS_SUCCEEDED(rv) && equals;
 }
 
 // static
-nsPIDOMWindowOuter*
-nsChannelClassifier::GetWindowForChannel(nsIChannel *aChannel)
-{
-  nsCOMPtr<nsILoadContext> ctx;
-  NS_QueryNotificationCallbacks(aChannel, ctx);
-  if (!ctx) {
-    return nullptr;
-  }
-
-  nsCOMPtr<mozIDOMWindowProxy> window;
-  ctx->GetAssociatedWindow(getter_AddRefs(window));
-  if (!window) {
-    return nullptr;
-  }
-
-  return nsPIDOMWindowOuter::From(window);
-}
-
-// static
 nsresult
 nsChannelClassifier::SetBlockedContent(nsIChannel *channel,
                                        nsresult aErrorCode,
                                        const nsACString& aList,
                                        const nsACString& aProvider,
                                        const nsACString& aFullHash)
 {
   NS_ENSURE_ARG(!aList.IsEmpty());
@@ -844,69 +825,51 @@ nsChannelClassifier::SetBlockedContent(n
   nsresult rv;
   nsCOMPtr<nsIClassifiedChannel> classifiedChannel = do_QueryInterface(channel, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (classifiedChannel) {
     classifiedChannel->SetMatchedInfo(aList, aProvider, aFullHash);
   }
 
+  nsCOMPtr<mozIDOMWindowProxy> win;
+  nsCOMPtr<mozIThirdPartyUtil> thirdPartyUtil =
+    do_GetService(THIRDPARTYUTIL_CONTRACTID, &rv);
+  NS_ENSURE_SUCCESS(rv, NS_OK);
+  rv = thirdPartyUtil->GetTopWindowForChannel(channel, getter_AddRefs(win));
+  NS_ENSURE_SUCCESS(rv, NS_OK);
+  auto* pwin = nsPIDOMWindowOuter::From(win);
+  nsCOMPtr<nsIDocShell> docShell = pwin->GetDocShell();
+  if (!docShell) {
+    return NS_OK;
+  }
+  nsCOMPtr<nsIDocument> doc = docShell->GetDocument();
+  NS_ENSURE_TRUE(doc, NS_OK);
+
   // This event might come after the user has navigated to another page.
   // To prevent showing the TrackingProtection UI on the wrong page, we need to
   // check that the loading URI for the channel is the same as the URI currently
-  // loaded in the document that is associated with the channel (which may be
-  // different than the top-level document, so we avoid ignoring all iframes).
-  nsCOMPtr<nsPIDOMWindowOuter> win = GetWindowForChannel(channel);
-  if (!win) {
-    return NS_OK;
-  }
-  nsCOMPtr<nsIDocument> frameDoc = win->GetExtantDoc();
-
-  // If the blocked request is the document load request to an iframe that
-  // contains a tracking page, the window associated with the channel belongs
-  // to that iframe, not its loading parent. In this case we actually want to
-  // compare load URIs with the parent frame, so we step up one level.
-  bool isDocumentLoad = false;
-  Unused << NS_WARN_IF(NS_FAILED(channel->GetIsDocument(&isDocumentLoad)));
-  if (isDocumentLoad || !frameDoc) {
-    win = win->GetParent();
-    if (NS_WARN_IF(!win)) {
-      return NS_OK;
-    }
-    frameDoc = win->GetExtantDoc();
-  }
-
-  if (!frameDoc || !SameLoadingURI(frameDoc, channel)) {
-    return NS_OK;
-  }
-
-  // Get the root docshell for updating the security UI.
-  nsCOMPtr<nsPIDOMWindowOuter> topWin = win->GetScriptableTop();
-  nsCOMPtr<nsIDocShell> topDocShell = topWin->GetDocShell();
-  if (!topDocShell) {
+  // loaded in the document.
+  if (!SameLoadingURI(doc, channel)) {
     return NS_OK;
   }
 
   // Notify nsIWebProgressListeners of this security event.
   // Can be used to change the UI state.
-  nsCOMPtr<nsISecurityEventSink> eventSink = do_QueryInterface(topDocShell, &rv);
+  nsCOMPtr<nsISecurityEventSink> eventSink = do_QueryInterface(docShell, &rv);
   NS_ENSURE_SUCCESS(rv, NS_OK);
   uint32_t state = 0;
   nsCOMPtr<nsISecureBrowserUI> securityUI;
-  topDocShell->GetSecurityUI(getter_AddRefs(securityUI));
+  docShell->GetSecurityUI(getter_AddRefs(securityUI));
   if (!securityUI) {
     return NS_OK;
   }
   securityUI->GetState(&state);
   if (aErrorCode == NS_ERROR_TRACKING_URI) {
-    nsCOMPtr<nsIDocument> topLevelDoc = topDocShell->GetDocument();
-    if (!topLevelDoc) {
-      return NS_OK;
-    }
-    topLevelDoc->SetHasTrackingContentBlocked(true);
+    doc->SetHasTrackingContentBlocked(true);
     state |= nsIWebProgressListener::STATE_BLOCKED_TRACKING_CONTENT;
   } else {
     state |= nsIWebProgressListener::STATE_BLOCKED_UNSAFE_CONTENT;
   }
 
   eventSink->OnSecurityChange(channel, state);
 
   // Log a warning to the web console.
@@ -917,17 +880,17 @@ nsChannelClassifier::SetBlockedContent(n
   const char* message = (aErrorCode == NS_ERROR_TRACKING_URI) ?
     "TrackingUriBlocked" : "UnsafeUriBlocked";
   nsCString category = (aErrorCode == NS_ERROR_TRACKING_URI) ?
     NS_LITERAL_CSTRING("Tracking Protection") :
     NS_LITERAL_CSTRING("Safe Browsing");
 
   nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
                                   category,
-                                  frameDoc,
+                                  doc,
                                   nsContentUtils::eNECKO_PROPERTIES,
                                   message,
                                   params, ArrayLength(params));
 
   return NS_OK;
 }
 
 namespace {
--- a/netwerk/base/nsChannelClassifier.h
+++ b/netwerk/base/nsChannelClassifier.h
@@ -75,18 +75,16 @@ private:
     // Helper function so that we ensure we call ContinueBeginConnect once
     // Start is called. Returns NS_OK if and only if we will get a callback
     // from the classifier service.
     nsresult StartInternal();
     // Helper function to check a URI against the hostname whitelist
     bool IsHostnameWhitelisted(nsIURI *aUri, const nsACString &aWhitelisted);
     // Checks that the channel was loaded by the URI currently loaded in aDoc
     static bool SameLoadingURI(nsIDocument *aDoc, nsIChannel *aChannel);
-    // Helper function to get the (not necessarily top-level) window from a channel.
-    static nsPIDOMWindowOuter* GetWindowForChannel(nsIChannel *aChannel);
     // Note this function will be also used to decide whether or not to enable
     // channel annotation. When |aAnnotationsOnly| is true, this function
     // is called by ShouldEnableTrackingAnnotation(). Otherwise, this is called
     // by ShouldEnableTrackingProtection().
     nsresult ShouldEnableTrackingProtectionInternal(nsIChannel *aChannel,
                                                     bool aAnnotationsOnly,
                                                     bool *result);