Bug 1342459 - Fix various no-undef issues in browser/base. r?Mossop draft
authorMark Banner <standard8@mozilla.com>
Tue, 04 Apr 2017 13:42:33 +0100
changeset 556947 1df35d8cab1e3ef692f54f9832c8eb3b0f779523
parent 556946 3c68d659c2b715f811708f043a1e7169d77be2ba
child 556948 10393f89f20a3f3726291c69b21e6423e1a1307e
child 556967 8eb1297d38ed5e1e839d557e29756322b0ac7833
push id52630
push userbmo:standard8@mozilla.com
push dateThu, 06 Apr 2017 10:00:38 +0000
reviewersMossop
bugs1342459
milestone55.0a1
Bug 1342459 - Fix various no-undef issues in browser/base. r?Mossop MozReview-Commit-ID: CRYxu7copKb
browser/base/content/browser-gestureSupport.js
browser/base/content/browser.js
browser/base/content/tabbrowser.xml
browser/base/content/test/general/browser_PageMetaData_pushstate.js
browser/base/content/test/general/browser_backButtonFitts.js
browser/base/content/test/general/browser_bug520538.js
browser/base/content/test/general/browser_bug537474.js
browser/base/content/test/general/browser_bug553455.js
browser/base/content/test/general/browser_documentnavigation.js
browser/base/content/test/general/browser_tabfocus.js
browser/base/content/test/popupNotifications/head.js
browser/base/content/test/social/browser_share.js
browser/base/content/test/social/head.js
browser/base/content/test/urlbar/browser_bug562649.js
browser/base/content/test/urlbar/urlbarAddonIframe.js
browser/base/content/urlbarBindings.xml
browser/base/content/web-panels.js
browser/base/content/webext-panels.js
tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
--- a/browser/base/content/browser-gestureSupport.js
+++ b/browser/base/content/browser-gestureSupport.js
@@ -186,22 +186,22 @@ var gGestureSupport = {
    */
   _shouldDoSwipeGesture: function GS__shouldDoSwipeGesture(aEvent) {
     if (!this._swipeNavigatesHistory(aEvent)) {
       return false;
     }
 
     let isVerticalSwipe = false;
     if (aEvent.direction == aEvent.DIRECTION_UP) {
-      if (gMultiProcessBrowser || content.pageYOffset > 0) {
+      if (gMultiProcessBrowser || window.content.pageYOffset > 0) {
         return false;
       }
       isVerticalSwipe = true;
     } else if (aEvent.direction == aEvent.DIRECTION_DOWN) {
-      if (gMultiProcessBrowser || content.pageYOffset < content.scrollMaxY) {
+      if (gMultiProcessBrowser || window.content.pageYOffset < window.content.scrollMaxY) {
         return false;
       }
       isVerticalSwipe = true;
     }
     if (isVerticalSwipe) {
       // Vertical overscroll has been temporarily disabled until bug 939480 is
       // fixed.
       return false;
@@ -437,39 +437,39 @@ var gGestureSupport = {
 
   /**
    * Perform rotation for ImageDocuments
    *
    * @param aEvent
    *        The MozRotateGestureUpdate event triggering this call
    */
   rotate(aEvent) {
-    if (!(content.document instanceof ImageDocument))
+    if (!(window.content.document instanceof ImageDocument))
       return;
 
-    let contentElement = content.document.body.firstElementChild;
+    let contentElement = window.content.document.body.firstElementChild;
     if (!contentElement)
       return;
     // If we're currently snapping, cancel that snap
     if (contentElement.classList.contains("completeRotation"))
       this._clearCompleteRotation();
 
     this.rotation = Math.round(this.rotation + aEvent.delta);
     contentElement.style.transform = "rotate(" + this.rotation + "deg)";
     this._lastRotateDelta = aEvent.delta;
   },
 
   /**
    * Perform a rotation end for ImageDocuments
    */
   rotateEnd() {
-    if (!(content.document instanceof ImageDocument))
+    if (!(window.content.document instanceof ImageDocument))
       return;
 
-    let contentElement = content.document.body.firstElementChild;
+    let contentElement = window.content.document.body.firstElementChild;
     if (!contentElement)
       return;
 
     let transitionRotation = 0;
 
     // The reason that 360 is allowed here is because when rotating between
     // 315 and 360, setting rotate(0deg) will cause it to rotate the wrong
     // direction around--spinning wildly.
@@ -528,22 +528,22 @@ var gGestureSupport = {
    * When the location/tab changes, need to reload the current rotation for the
    * image
    */
   restoreRotationState() {
     // Bug 863514 - Make gesture support work in electrolysis
     if (gMultiProcessBrowser)
       return;
 
-    if (!(content.document instanceof ImageDocument))
+    if (!(window.content.document instanceof ImageDocument))
       return;
 
-    let contentElement = content.document.body.firstElementChild;
-    let transformValue = content.window.getComputedStyle(contentElement)
-                                       .transform;
+    let contentElement = window.content.document.body.firstElementChild;
+    let transformValue = window.content.window.getComputedStyle(contentElement)
+                                              .transform;
 
     if (transformValue == "none") {
       this.rotation = 0;
       return;
     }
 
     // transformValue is a rotation matrix--split it and do mathemagic to
     // obtain the real rotation value
@@ -553,20 +553,20 @@ var gGestureSupport = {
     this.rotation = Math.round(Math.atan2(transformValue[1], transformValue[0]) *
                                (180 / Math.PI));
   },
 
   /**
    * Removes the transition rule by removing the completeRotation class
    */
   _clearCompleteRotation() {
-    let contentElement = content.document &&
-                         content.document instanceof ImageDocument &&
-                         content.document.body &&
-                         content.document.body.firstElementChild;
+    let contentElement = window.content.document &&
+                         window.content.document instanceof ImageDocument &&
+                         window.content.document.body &&
+                         window.content.document.body.firstElementChild;
     if (!contentElement)
       return;
     contentElement.classList.remove("completeRotation");
     contentElement.removeEventListener("transitionend", this._clearCompleteRotation);
   },
 };
 
 // History Swipe Animation Support (bug 678392)
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -4704,20 +4704,20 @@ var XULBrowserWindow = {
       }
 
       // Disable find commands in documents that ask for them to be disabled.
       if (!gMultiProcessBrowser && aLocationURI &&
           (aLocationURI.schemeIs("about") || aLocationURI.schemeIs("chrome"))) {
         // Don't need to re-enable/disable find commands for same-document location changes
         // (e.g. the replaceStates in about:addons)
         if (!(aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT)) {
-          if (content.document.readyState == "interactive" || content.document.readyState == "complete")
-            disableFindCommands(shouldDisableFind(content.document));
+          if (window.content.document.readyState == "interactive" || window.content.document.readyState == "complete")
+            disableFindCommands(shouldDisableFind(window.content.document));
           else {
-            content.document.addEventListener("readystatechange", onContentRSChange);
+            window.content.document.addEventListener("readystatechange", onContentRSChange);
           }
         }
       } else
         disableFindCommands(false);
 
       // Try not to instantiate gCustomizeMode as much as possible,
       // so don't use CustomizeMode.jsm to check for URI or customizing.
       if (location == "about:blank" &&
@@ -5187,17 +5187,17 @@ nsBrowserAccess.prototype = {
         let browser = this._openURIInNewTab(aURI, referrer, referrerPolicy,
                                             isPrivate, isExternal,
                                             forceNotRemote, userContextId,
                                             openerWindow, triggeringPrincipal);
         if (browser)
           newWindow = browser.contentWindow;
         break;
       default : // OPEN_CURRENTWINDOW or an illegal value
-        newWindow = content;
+        newWindow = window.content;
         if (aURI) {
           let loadflags = isExternal ?
                             Ci.nsIWebNavigation.LOAD_FLAGS_FROM_EXTERNAL :
                             Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
           gBrowser.loadURIWithFlags(aURI.spec, {
                                     triggeringPrincipal,
                                     flags: loadflags,
                                     referrerURI: referrer,
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -1940,17 +1940,17 @@
 
             if (aParams.remoteType) {
               b.setAttribute("remoteType", aParams.remoteType);
               b.setAttribute("remote", "true");
             }
 
             if (aParams.opener) {
               if (aParams.remoteType) {
-                throw new Exception("Cannot set opener window on a remote browser!");
+                throw new Error("Cannot set opener window on a remote browser!");
               }
               b.QueryInterface(Ci.nsIFrameLoaderOwner).presetOpenerWindow(aParams.opener);
             }
 
             if (!aParams.isPreloadBrowser && this.hasAttribute("autocompletepopup")) {
               b.setAttribute("autocompletepopup", this.getAttribute("autocompletepopup"));
             }
 
@@ -5470,17 +5470,17 @@
           }
 
           tab.removeAttribute("soundplaying");
           this.setIcon(tab, icon, browser.contentPrincipal);
         ]]>
       </handler>
       <handler event="DOMAudioPlaybackStarted">
         <![CDATA[
-          var tab = getTabFromAudioEvent(event)
+          var tab = this.getTabFromAudioEvent(event)
           if (!tab) {
             return;
           }
 
           clearTimeout(tab._soundPlayingAttrRemovalTimer);
           tab._soundPlayingAttrRemovalTimer = 0;
 
           let modifiedAttrs = [];
@@ -5500,17 +5500,17 @@
             getComputedStyle(tab).opacity;
           }
 
           this._tabAttrModified(tab, modifiedAttrs);
         ]]>
       </handler>
       <handler event="DOMAudioPlaybackStopped">
         <![CDATA[
-          var tab = getTabFromAudioEvent(event)
+          var tab = this.getTabFromAudioEvent(event)
           if (!tab) {
             return;
           }
 
           if (tab.hasAttribute("soundplaying")) {
             let removalDelay = Services.prefs.getIntPref("browser.tabs.delayHidingAudioPlayingIconMS");
 
             tab.style.setProperty("--soundplaying-removal-delay", `${removalDelay - 300}ms`);
@@ -5522,31 +5522,31 @@
               tab.removeAttribute("soundplaying");
               this._tabAttrModified(tab, ["soundplaying", "soundplaying-scheduledremoval"]);
             }, removalDelay);
           }
         ]]>
       </handler>
       <handler event="DOMAudioPlaybackBlockStarted">
         <![CDATA[
-          var tab = getTabFromAudioEvent(event)
+          var tab = this.getTabFromAudioEvent(event)
           if (!tab) {
             return;
           }
 
           if (!tab.hasAttribute("blocked")) {
             tab.setAttribute("blocked", true);
             this._tabAttrModified(tab, ["blocked"]);
             tab.startMediaBlockTimer();
           }
         ]]>
       </handler>
       <handler event="DOMAudioPlaybackBlockStopped">
         <![CDATA[
-          var tab = getTabFromAudioEvent(event)
+          var tab = this.getTabFromAudioEvent(event)
           if (!tab) {
             return;
           }
 
           if (tab.hasAttribute("blocked")) {
             tab.removeAttribute("blocked");
             this._tabAttrModified(tab, ["blocked"]);
             let hist = Services.telemetry.getHistogramById("TAB_AUDIO_INDICATOR_USED");
--- a/browser/base/content/test/general/browser_PageMetaData_pushstate.js
+++ b/browser/base/content/test/general/browser_PageMetaData_pushstate.js
@@ -1,16 +1,20 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
+/* eslint-env mozilla/frame-script */
+
 add_task(function* () {
   let rooturi = "https://example.com/browser/toolkit/modules/tests/browser/";
   yield BrowserTestUtils.openNewForegroundTab(gBrowser, rooturi + "metadata_simple.html");
   yield ContentTask.spawn(gBrowser.selectedBrowser, { rooturi }, function* (args) {
+    Components.utils.import("resource://gre/modules/PageMetadata.jsm");
+
     let result = PageMetadata.getData(content.document);
     // Result should have description.
     Assert.equal(result.url, args.rooturi + "metadata_simple.html", "metadata url is correct");
     Assert.equal(result.title, "Test Title", "metadata title is correct");
     Assert.equal(result.description, "A very simple test page", "description is correct");
 
     content.history.pushState({}, "2", "2.html");
     result = PageMetadata.getData(content.document);
--- a/browser/base/content/test/general/browser_backButtonFitts.js
+++ b/browser/base/content/test/general/browser_backButtonFitts.js
@@ -23,18 +23,18 @@ add_task(function* () {
 
   // Find where the nav-bar is vertically.
   var navBar = document.getElementById("nav-bar");
   var boundingRect = navBar.getBoundingClientRect();
   var yPixel = boundingRect.top + Math.floor(boundingRect.height / 2);
   var xPixel = 0; // Use the first pixel of the screen since it is maximized.
 
   let resultLocation = yield new Promise(resolve => {
-    messageManager.addMessageListener("Test:PopStateOccurred", function statePopped(message) {
-      messageManager.removeMessageListener("Test:PopStateOccurred", statePopped);
+    window.messageManager.addMessageListener("Test:PopStateOccurred", function statePopped(message) {
+      window.messageManager.removeMessageListener("Test:PopStateOccurred", statePopped);
       resolve(message.data.location);
     });
 
     EventUtils.synthesizeMouseAtPoint(xPixel, yPixel, {}, window);
   });
 
   is(resultLocation, firstLocation, "Clicking the first pixel should have navigated back.");
   window.restore();
--- a/browser/base/content/test/general/browser_bug520538.js
+++ b/browser/base/content/test/general/browser_bug520538.js
@@ -1,15 +1,15 @@
 function test() {
   var tabCount = gBrowser.tabs.length;
   gBrowser.selectedBrowser.focus();
-  browserDOMWindow.openURI(makeURI("about:blank"),
-                           null,
-                           Ci.nsIBrowserDOMWindow.OPEN_NEWTAB,
-                           Ci.nsIBrowserDOMWindow.OPEN_EXTERNAL);
+  window.browserDOMWindow.openURI(makeURI("about:blank"),
+                                  null,
+                                  Ci.nsIBrowserDOMWindow.OPEN_NEWTAB,
+                                  Ci.nsIBrowserDOMWindow.OPEN_EXTERNAL);
   is(gBrowser.tabs.length, tabCount + 1,
      "'--new-tab about:blank' opens a new tab");
   is(gBrowser.selectedTab, gBrowser.tabs[tabCount],
      "'--new-tab about:blank' selects the new tab");
   is(document.activeElement, gURLBar.inputField,
      "'--new-tab about:blank' focuses the location bar");
   gBrowser.removeCurrentTab();
 }
--- a/browser/base/content/test/general/browser_bug537474.js
+++ b/browser/base/content/test/general/browser_bug537474.js
@@ -1,8 +1,7 @@
 add_task(function *() {
   let browserLoadedPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
-  browserDOMWindow.openURI(makeURI("about:"), null,
-                           Ci.nsIBrowserDOMWindow.OPEN_CURRENTWINDOW, null)
+  window.browserDOMWindow.openURI(makeURI("about:"), null,
+                                  Ci.nsIBrowserDOMWindow.OPEN_CURRENTWINDOW, null)
   yield browserLoadedPromise;
   is(gBrowser.currentURI.spec, "about:", "page loads in the current content window");
 });
-
--- a/browser/base/content/test/general/browser_bug553455.js
+++ b/browser/base/content/test/general/browser_bug553455.js
@@ -648,17 +648,17 @@ function test_localFile() {
 
     yield removeTab();
   });
 },
 
 function test_tabClose() {
   return Task.spawn(function* () {
     if (!Preferences.get("xpinstall.customConfirmationUI", false)) {
-      runNextTest();
+      info("Test skipped due to xpinstall.customConfirmationUI being false.");
       return;
     }
 
     let progressPromise = waitForProgressNotification();
     let dialogPromise = waitForInstallDialog();
     gBrowser.selectedTab = gBrowser.addTab("about:blank");
     yield BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
     gBrowser.loadURI(TESTROOT + "amosigned.xpi");
--- a/browser/base/content/test/general/browser_documentnavigation.js
+++ b/browser/base/content/test/general/browser_documentnavigation.js
@@ -23,17 +23,17 @@ function* expectFocusOnF6(backward, expe
       expected += "," + expectedElement;
     }
 
     is(msg.data.details, expected, desc + " child focus matches");
     focusChangedInChildResolver();
   }
 
   if (onContent) {
-    messageManager.addMessageListener("BrowserTest:FocusChanged", focusChangedListener);
+    window.messageManager.addMessageListener("BrowserTest:FocusChanged", focusChangedListener);
 
     yield ContentTask.spawn(gBrowser.selectedBrowser, { expectedElementId: expectedElement }, function* (arg) {
       let contentExpectedElement = content.document.getElementById(arg.expectedElementId);
       if (!contentExpectedElement) {
         // Element not found, so look in the child frames.
         for (let f = 0; f < content.frames.length; f++) {
           if (content.frames[f].document.getElementById(arg.expectedElementId)) {
             contentExpectedElement = content.frames[f].document;
@@ -74,17 +74,17 @@ function* expectFocusOnF6(backward, expe
     expectedDocument = "main-window";
     expectedElement = gBrowser.selectedBrowser;
   }
 
   is(fm.focusedWindow.document.documentElement.id, expectedDocument, desc + " document matches");
   is(fm.focusedElement, expectedElement, desc + " element matches");
 
   if (onContent) {
-    messageManager.removeMessageListener("BrowserTest:FocusChanged", focusChangedListener);
+    window.messageManager.removeMessageListener("BrowserTest:FocusChanged", focusChangedListener);
   }
 }
 
 // Load a page and navigate between it and the chrome window.
 add_task(function* () {
   let page1Promise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
   gBrowser.selectedBrowser.loadURI(testPage1);
   yield page1Promise;
--- a/browser/base/content/test/general/browser_tabfocus.js
+++ b/browser/base/content/test/general/browser_tabfocus.js
@@ -40,18 +40,18 @@ var currentTestName = "";
 var _expectedElement = null;
 var _expectedWindow = null;
 
 var currentPromiseResolver = null;
 
 function* getFocusedElementForBrowser(browser, dontCheckExtraFocus = false) {
   if (gMultiProcessBrowser) {
     return new Promise((resolve, reject) => {
-      messageManager.addMessageListener("Browser:GetCurrentFocus", function getCurrentFocus(message) {
-        messageManager.removeMessageListener("Browser:GetCurrentFocus", getCurrentFocus);
+      window.messageManager.addMessageListener("Browser:GetCurrentFocus", function getCurrentFocus(message) {
+        window.messageManager.removeMessageListener("Browser:GetCurrentFocus", getCurrentFocus);
         resolve(message.data.details);
       });
 
       // The dontCheckExtraFocus flag is used to indicate not to check some
       // additional focus related properties. This is needed as both URLs are
       // loaded using the same child process and share focus managers.
       browser.messageManager.sendAsyncMessage("Browser:GetFocusedElement",
         { dontCheckExtraFocus });
@@ -139,17 +139,17 @@ add_task(function*() {
   var childFocusScript = "data:,(" + focusInChild.toString() + ")();";
   browser1.messageManager.loadFrameScript(childFocusScript, true);
   browser2.messageManager.loadFrameScript(childFocusScript, true);
 
   gURLBar.focus();
   yield SimpleTest.promiseFocus();
 
   if (gMultiProcessBrowser) {
-    messageManager.addMessageListener("Browser:FocusChanged", message => {
+    window.messageManager.addMessageListener("Browser:FocusChanged", message => {
       actualEvents.push(message.data.details);
       compareFocusResults();
     });
   }
 
   _lastfocus = "urlbar";
   _lastfocuswindow = "main-window";
 
--- a/browser/base/content/test/popupNotifications/head.js
+++ b/browser/base/content/test/popupNotifications/head.js
@@ -63,16 +63,19 @@ function promiseTabLoadEvent(tab, url) {
     browser.loadURI(url);
   }
 
   return BrowserTestUtils.browserLoaded(browser, false, url);
 }
 
 const PREF_SECURITY_DELAY_INITIAL = Services.prefs.getIntPref("security.notification_enable_delay");
 
+// Tests that call setup() should have a `tests` array defined for the actual
+// tests to be run.
+/* global tests */
 function setup() {
   BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com/")
                   .then(goNext);
   registerCleanupFunction(() => {
     gBrowser.removeTab(gBrowser.selectedTab);
     PopupNotifications.buttonDelay = PREF_SECURITY_DELAY_INITIAL;
   });
 }
--- a/browser/base/content/test/social/browser_share.js
+++ b/browser/base/content/test/social/browser_share.js
@@ -36,17 +36,17 @@ function test() {
       content.close();
     }, true);
     /* if text is entered into field, onbeforeunload will cause a modal dialog
        unless dialogs have been disabled for the iframe. */
     content.onbeforeunload = function(e) {
       return "FAIL.";
     };
   }.toString() + ")();";
-  let mm = getGroupMessageManager("social");
+  let mm = window.getGroupMessageManager("social");
   mm.loadFrameScript(frameScript, true);
 
   // Animation on the panel can cause intermittent failures such as bug 1115131.
   SocialShare.panel.setAttribute("animate", "false");
   registerCleanupFunction(function() {
     SocialShare.panel.removeAttribute("animate");
     mm.removeDelayedFrameScript(frameScript);
     Services.prefs.clearUserPref("social.directories");
@@ -186,17 +186,17 @@ var tests = {
     let testIndex = 0;
     let testData = corpus[testIndex++];
 
     // initialize the button into the navbar
     CustomizableUI.addWidgetToArea("social-share-button", CustomizableUI.AREA_NAVBAR);
     // ensure correct state
     SocialUI.onCustomizeEnd(window);
 
-    let mm = getGroupMessageManager("social");
+    let mm = window.getGroupMessageManager("social");
     mm.addMessageListener("sharedata", function handler(msg) {
       BrowserTestUtils.removeTab(testTab).then(() => {
         hasoptions(testData.options, JSON.parse(msg.data));
         testData = corpus[testIndex++];
         BrowserTestUtils.waitForCondition(() => { return SocialShare.currentShare == null; }, "share panel closed").then(() => {
           if (testData) {
             runOneTest();
           } else {
@@ -272,17 +272,17 @@ var tests = {
             "https://example.com/wiki/education": {
               "text": "Education",
               "rels": ["tag"]
             }
           }
         }
       });
 
-      let mm = getGroupMessageManager("social");
+      let mm = window.getGroupMessageManager("social");
       mm.addMessageListener("sharedata", function handler(msg) {
         is(msg.data, expecting, "microformats data ok");
         BrowserTestUtils.waitForCondition(() => { return SocialShare.currentShare == null; },
                                           "share panel closed").then(() => {
           mm.removeMessageListener("sharedata", handler);
           BrowserTestUtils.removeTab(testTab).then(() => {
             SocialService.disableProvider(manifest.origin, next);
           });
@@ -320,17 +320,17 @@ var tests = {
     // ensure correct state
     SocialUI.onCustomizeEnd(window);
 
     ensureFrameLoaded(iframe).then(() => {
       let subframe = iframe.contentDocument.getElementById("activation-frame");
       ensureFrameLoaded(subframe, activationPage).then(() => {
         is(subframe.contentDocument.location.href, activationPage, "activation page loaded");
         promiseObserverNotified("social:provider-enabled").then(() => {
-          let mm = getGroupMessageManager("social");
+          let mm = window.getGroupMessageManager("social");
           mm.addMessageListener("sharedata", function handler(msg) {
             ok(true, "share completed");
 
             BrowserTestUtils.waitForCondition(() => { return SocialShare.currentShare == null; },
                                               "share panel closed").then(() => {
               BrowserTestUtils.removeTab(testTab).then(() => {
                 mm.removeMessageListener("sharedata", handler);
                 SocialService.uninstallProvider(manifest.origin, next);
--- a/browser/base/content/test/social/head.js
+++ b/browser/base/content/test/social/head.js
@@ -112,21 +112,16 @@ function runSocialTestWithProvider(manif
   let providersAdded = 0;
 
   manifests.forEach(function(m) {
     SocialService.addProvider(m, function(provider) {
 
       providersAdded++;
       info("runSocialTestWithProvider: provider added");
 
-      // we want to set the first specified provider as the UI's provider
-      if (provider.origin == manifests[0].origin) {
-        firstProvider = provider;
-      }
-
       // If we've added all the providers we need, call the callback to start
       // the tests (and give it a callback it can call to finish them)
       if (providersAdded == manifests.length) {
         registerCleanupFunction(function() {
           finishSocialTest(true);
         });
         BrowserTestUtils.waitForCondition(() => provider.enabled,
                                           "providers added and enabled").then(() => {
--- a/browser/base/content/test/urlbar/browser_bug562649.js
+++ b/browser/base/content/test/urlbar/browser_bug562649.js
@@ -1,14 +1,14 @@
 function test() {
   const URI = "data:text/plain,bug562649";
-  browserDOMWindow.openURI(makeURI(URI),
-                           null,
-                           Ci.nsIBrowserDOMWindow.OPEN_NEWTAB,
-                           Ci.nsIBrowserDOMWindow.OPEN_EXTERNAL);
+  window.browserDOMWindow.openURI(makeURI(URI),
+                                  null,
+                                  Ci.nsIBrowserDOMWindow.OPEN_NEWTAB,
+                                  Ci.nsIBrowserDOMWindow.OPEN_EXTERNAL);
 
   is(gBrowser.userTypedValue, URI, "userTypedValue matches test URI");
   is(gURLBar.value, URI, "location bar value matches test URI");
 
   gBrowser.selectedTab = gBrowser.addTab();
   gBrowser.removeCurrentTab({ skipPermitUnload: true });
   is(gBrowser.userTypedValue, URI, "userTypedValue matches test URI after switching tabs");
   is(gURLBar.value, URI, "location bar value matches test URI after switching tabs");
--- a/browser/base/content/test/urlbar/urlbarAddonIframe.js
+++ b/browser/base/content/test/urlbar/urlbarAddonIframe.js
@@ -1,8 +1,11 @@
+// urlbar is injected into the urlbar add-on iframe by Panel.jsm for tests.
+/* global urlbar */
+
 // Listen for messages from the test.
 addEventListener("TestEvent", event => {
   let type = event.detail.type;
   dump("urlbarAddonIframe.js got TestEvent, type=" + type +
        " messageID=" + event.detail.messageID + "\n");
   switch (type) {
   case "function":
     callUrlbarFunction(event.detail);
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -1235,18 +1235,18 @@ file, You can obtain one at http://mozil
       <handler event="blur"><![CDATA[
         if (event.originalTarget == this.inputField) {
           this._clearNoActions();
           this.formatValue();
           if (this.getAttribute("pageproxystate") != "valid") {
             UpdatePopupNotificationsVisibility();
           }
         }
-        if (ExtensionSearchHandler.hasActiveInputSession()) {
-          ExtensionSearchHandler.handleInputCancelled();
+        if (this.ExtensionSearchHandler.hasActiveInputSession()) {
+          this.ExtensionSearchHandler.handleInputCancelled();
         }
       ]]></handler>
 
       <handler event="dragstart" phase="capturing"><![CDATA[
         // Drag only if the gesture starts from the input field.
         if (this.inputField != event.originalTarget &&
             !(this.inputField.compareDocumentPosition(event.originalTarget) &
               Node.DOCUMENT_POSITION_CONTAINED_BY))
--- a/browser/base/content/web-panels.js
+++ b/browser/base/content/web-panels.js
@@ -1,13 +1,16 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * 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/. */
 
+// Via web-panels.xul
+/* import-globals-from browser.js */
+
 const NS_ERROR_MODULE_NETWORK = 2152398848;
 const NS_NET_STATUS_READ_FROM = NS_ERROR_MODULE_NETWORK + 8;
 const NS_NET_STATUS_WROTE_TO  = NS_ERROR_MODULE_NETWORK + 9;
 
 function getPanelBrowser() {
     return document.getElementById("web-panels-browser");
 }
 
--- a/browser/base/content/webext-panels.js
+++ b/browser/base/content/webext-panels.js
@@ -1,13 +1,16 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * 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/. */
 
+// Via webext-panels.xul
+/* import-globals-from browser.js */
+
 XPCOMUtils.defineLazyModuleGetter(this, "ExtensionParent",
                                   "resource://gre/modules/ExtensionParent.jsm");
 Cu.import("resource://gre/modules/ExtensionUtils.jsm");
 
 var {
   promiseEvent,
 } = ExtensionUtils;
 
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js
@@ -296,16 +296,18 @@ module.exports = {
     "ChromeWindow": false,
     "ChromeWorker": false,
     "ChromeUtils": false,
     "Components": false,
     "CSSPrimitiveValue": false,
     "CSSValueList": false,
     "dump": true,
     "ImageDocument": false,
+    // Non-standard, specific to Firefox.
+    "InstallTrigger": false,
     // Specific to Firefox
     // eslint-disable-next-line max-len
     // https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/InternalError
     "InternalError": true,
     "KeyEvent": false,
     "openDialog": false,
     "MenuBoxObject": false,
     // Specific to Firefox (Chrome code only).