Bug 1257246: Update browser for eslint 2. r=felipe
authorDave Townsend <dtownsend@oxymoronical.com>
Tue, 05 Apr 2016 11:33:33 -0700
changeset 349013 5e40adeb0332005944a6249befae7a33c4e811db
parent 349012 4a108098012bf930f133f5ef582f559671fc89b5
child 349014 db2d6e47a3f4769eb2eede2ec521a8249c0fc6aa
push id14989
push userdtownsend@mozilla.com
push dateFri, 08 Apr 2016 20:09:09 +0000
reviewersfelipe
bugs1257246
milestone48.0a1
Bug 1257246: Update browser for eslint 2. r=felipe Most of this is fixing functions that in some cases return a value but then can also run to completion without returning anything. ESLint 2 catches this where previous versions didn't. Unless there was an obvious other choice I just made these functions return undefined at the end which is effectively what already happens. MozReview-Commit-ID: DEskVIjiKDM
browser/base/content/browser-addons.js
browser/base/content/browser-plugins.js
browser/base/content/browser-syncui.js
browser/base/content/browser.js
browser/base/content/pageinfo/pageInfo.js
browser/base/content/sanitize.js
browser/base/content/sync/genericChange.js
browser/base/content/sync/setup.js
browser/base/content/tabbrowser.xml
browser/components/customizableui/CustomizableUI.jsm
browser/components/customizableui/test/browser_984455_bookmarks_items_reparenting.js
browser/components/migration/ESEDBReader.jsm
browser/components/migration/MSMigrationUtils.jsm
browser/components/migration/content/migration.js
browser/components/uitour/test/head.js
browser/experiments/Experiments.jsm
browser/modules/test/head.js
browser/tools/mozscreenshots/mozscreenshots/extension/configurations/TabsInTitlebar.jsm
browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Toolbars.jsm
--- a/browser/base/content/browser-addons.js
+++ b/browser/base/content/browser-addons.js
@@ -655,16 +655,17 @@ var LightweightThemeListener = {
 
   init: function () {
     XPCOMUtils.defineLazyGetter(this, "styleSheet", function() {
       for (let i = document.styleSheets.length - 1; i >= 0; i--) {
         let sheet = document.styleSheets[i];
         if (sheet.href == "chrome://browser/skin/browser-lightweightTheme.css")
           return sheet;
       }
+      return undefined;
     });
 
     Services.obs.addObserver(this, "lightweight-theme-styling-update", false);
     Services.obs.addObserver(this, "lightweight-theme-optimized", false);
     if (document.documentElement.hasAttribute("lwtheme"))
       this.updateStyleSheet(document.documentElement.style.backgroundImage);
   },
 
--- a/browser/base/content/browser-plugins.js
+++ b/browser/base/content/browser-plugins.js
@@ -6,17 +6,16 @@
 var gPluginHandler = {
   PREF_SESSION_PERSIST_MINUTES: "plugin.sessionPermissionNow.intervalInMinutes",
   PREF_PERSISTENT_DAYS: "plugin.persistentPermissionAlways.intervalInDays",
   MESSAGES: [
     "PluginContent:ShowClickToPlayNotification",
     "PluginContent:RemoveNotification",
     "PluginContent:UpdateHiddenPluginUI",
     "PluginContent:HideNotificationBar",
-    "PluginContent:ShowInstallNotification",
     "PluginContent:InstallSinglePlugin",
     "PluginContent:ShowPluginCrashedNotification",
     "PluginContent:SubmitReport",
     "PluginContent:LinkClickCallback",
   ],
 
   init: function () {
     const mm = window.messageManager;
@@ -51,18 +50,16 @@ var gPluginHandler = {
         break;
       case "PluginContent:UpdateHiddenPluginUI":
         this.updateHiddenPluginUI(msg.target, msg.data.haveInsecure, msg.data.actions,
                                   msg.principal, msg.data.location);
         break;
       case "PluginContent:HideNotificationBar":
         this.hideNotificationBar(msg.target, msg.data.name);
         break;
-      case "PluginContent:ShowInstallNotification":
-        return this.showInstallNotification(msg.target, msg.data.pluginInfo);
       case "PluginContent:InstallSinglePlugin":
         this.installSinglePlugin(msg.data.pluginInfo);
         break;
       case "PluginContent:ShowPluginCrashedNotification":
         this.showPluginCrashedNotification(msg.target, msg.data.messageString,
                                            msg.data.pluginID);
         break;
       case "PluginContent:SubmitReport":
--- a/browser/base/content/browser-syncui.js
+++ b/browser/base/content/browser-syncui.js
@@ -246,17 +246,17 @@ var gSyncUI = {
   // Handle clicking the toolbar button - which either opens the Sync setup
   // pages or forces a sync now. Does *not* return a promise as it is called
   // via the UI.
   handleToolbarButton() {
     this._needsSetup().then(needsSetup => {
       if (needsSetup || this._loginFailed()) {
         this.openSetup();
       } else {
-        return this.doSync();
+        this.doSync();
       }
     }).catch(err => {
       this.log.error("Failed to handle toolbar button command", err);
     });
   },
 
   /**
    * Invoke the Sync setup wizard.
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -3361,17 +3361,17 @@ const DOMLinkHandler = {
 
     gBrowser.setIcon(tab, aURL, aLoadingPrincipal);
     return true;
   },
 
   addSearch: function(aBrowser, aEngine, aURL) {
     let tab = gBrowser.getTabForBrowser(aBrowser);
     if (!tab)
-      return false;
+      return;
 
     BrowserSearch.addEngine(aBrowser, aEngine, makeURI(aURL));
   },
 }
 
 const BrowserSearch = {
   addEngine: function(browser, engine, uri) {
     if (!this.searchBar)
--- a/browser/base/content/pageinfo/pageInfo.js
+++ b/browser/base/content/pageinfo/pageInfo.js
@@ -263,16 +263,17 @@ const nsICertificateDialogs = Components
 const CERTIFICATEDIALOGS_CONTRACTID = "@mozilla.org/nsCertificateDialogs;1"
 
 // clipboard helper
 function getClipboardHelper() {
     try {
         return Components.classes["@mozilla.org/widget/clipboardhelper;1"].getService(Components.interfaces.nsIClipboardHelper);
     } catch(e) {
         // do nothing, later code will handle the error
+        return null;
     }
 }
 const gClipboardHelper = getClipboardHelper();
 
 // Interface for image loading content
 const nsIImageLoadingContent = Components.interfaces.nsIImageLoadingContent;
 
 // namespaces, don't need all of these yet...
--- a/browser/base/content/sanitize.js
+++ b/browser/base/content/sanitize.js
@@ -598,16 +598,17 @@ Sanitizer.prototype = {
       _canCloseWindow: function(aWindow) {
         if (aWindow.CanCloseWindow()) {
           // We already showed PermitUnload for the window, so let's
           // make sure we don't do it again when we actually close the
           // window.
           aWindow.skipNextCanClose = true;
           return true;
         }
+        return false;
       },
       _resetAllWindowClosures: function(aWindowList) {
         for (let win of aWindowList) {
           win.skipNextCanClose = false;
         }
       },
       clear: Task.async(function* () {
         // NB: this closes all *browser* windows, not other windows like the library, about window,
@@ -660,16 +661,17 @@ Sanitizer.prototype = {
             let docEl = newWindow.document.documentElement;
             let sizemode = docEl.getAttribute("sizemode");
             if (!newWindow.fullScreen && sizemode == "fullscreen") {
               docEl.setAttribute("sizemode", "normal");
               e.preventDefault();
               e.stopPropagation();
               return false;
             }
+            return undefined;
           }
           newWindow.addEventListener("fullscreen", onFullScreen);
         }
 
         let promiseReady = new Promise(resolve => {
           // Window creation and destruction is asynchronous. We need to wait
           // until all existing windows are fully closed, and the new window is
           // fully open, before continuing. Otherwise the rest of the sanitizer
--- a/browser/base/content/sync/genericChange.js
+++ b/browser/base/content/sync/genericChange.js
@@ -142,16 +142,17 @@ var Change = {
       case "UpdatePassphrase":
       case "ResetPassphrase":
         return this.doChangePassphrase();
         break;
       case "ChangePassword":
         return this.doChangePassword();
         break;
     }
+    return undefined;
   },
 
   doGeneratePassphrase: function () {
     let passphrase = Weave.Utils.generatePassphrase();
     this._passphraseBox.value = Weave.Utils.hyphenatePassphrase(passphrase);
     this._dialog.getButton("finish").disabled = false;
   },
 
--- a/browser/base/content/sync/setup.js
+++ b/browser/base/content/sync/setup.js
@@ -118,24 +118,24 @@ var gSyncSetup = {
                                            .getAttribute("accesskey");
     this._backButtonLabel = this.wizard.getButton("back").label;
     this._backButtonAccesskey = this.wizard.getButton("back")
                                            .getAttribute("accesskey");
   },
 
   startNewAccountSetup: function () {
     if (!Weave.Utils.ensureMPUnlocked())
-      return false;
+      return;
     this._settingUpNew = true;
     this.wizard.pageIndex = NEW_ACCOUNT_START_PAGE;
   },
 
   useExistingAccount: function () {
     if (!Weave.Utils.ensureMPUnlocked())
-      return false;
+      return;
     this._settingUpNew = false;
     if (this.wizardType == "pair") {
       // We're already pairing, so there's no point in pairing again.
       // Go straight to the manual login page.
       this.wizard.pageIndex = EXISTING_ACCOUNT_LOGIN_PAGE;
     } else {
       this.wizard.pageIndex = EXISTING_ACCOUNT_CONNECT_PAGE;
     }
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -4309,16 +4309,17 @@
               });
 
               browser.dispatchEvent(event);
 
               break;
             }
 
           }
+          return undefined;
         ]]></body>
       </method>
 
       <method name="observe">
         <parameter name="aSubject"/>
         <parameter name="aTopic"/>
         <parameter name="aData"/>
         <body><![CDATA[
--- a/browser/components/customizableui/CustomizableUI.jsm
+++ b/browser/components/customizableui/CustomizableUI.jsm
@@ -2129,17 +2129,18 @@ var CustomizableUIInternal = {
       cancelable: true,
       detail: aDetails
     });
     aWindow.gNavToolbox.dispatchEvent(evt);
   },
 
   dispatchToolboxEvent: function(aEventType, aDetails={}, aWindow=null) {
     if (aWindow) {
-      return this._dispatchToolboxEventToWindow(aEventType, aDetails, aWindow);
+      this._dispatchToolboxEventToWindow(aEventType, aDetails, aWindow);
+      return;
     }
     for (let [win, ] of gBuildWindows) {
       this._dispatchToolboxEventToWindow(aEventType, aDetails, win);
     }
   },
 
   createWidget: function(aProperties) {
     let widget = this.normalizeWidget(aProperties, CustomizableUI.SOURCE_EXTERNAL);
@@ -2413,16 +2414,17 @@ var CustomizableUIInternal = {
         // Don't copy the function to the normalized widget object, instead
         // keep it on the original object provided to the API so that
         // additional methods can be implemented and used by the event
         // handlers.
         return aWidget.implementation[aEventName].apply(aWidget.implementation,
                                                         aArgs);
       } catch (e) {
         Cu.reportError(e);
+        return undefined;
       }
     };
   },
 
   destroyWidget: function(aWidgetId) {
     let widget = gPalette.get(aWidgetId);
     if (!widget) {
       gGroupWrapperCache.delete(aWidgetId);
@@ -3907,17 +3909,17 @@ function XULWidgetGroupWrapper(aWidgetId
       return null;
     }
 
     let areaProps = gAreas.get(placement.area);
     return areaProps && areaProps.get("type");
   });
 
   this.__defineGetter__("instances", function() {
-    return Array.from(gBuildWindows, ([win,]) => this.forWindow(win));
+    return Array.from(gBuildWindows, (wins) => this.forWindow(wins[0]));
   });
 
   Object.freeze(this);
 }
 
 /**
  * A XULWidgetSingleWrapper is a wrapper around a single instance of a XUL
  * widget in a particular window.
--- a/browser/components/customizableui/test/browser_984455_bookmarks_items_reparenting.js
+++ b/browser/components/customizableui/test/browser_984455_bookmarks_items_reparenting.js
@@ -123,16 +123,17 @@ function checkBookmarksItemsChevronConte
     EventUtils.synthesizeMouseAtCenter(chevron, {});
     info("Waiting for bookmark toolbar item chevron popup to show");
     yield shownPromise;
     yield waitForCondition(() => {
       for (let child of chevronPopup.children) {
         if (child.style.visibility != "hidden")
           return true;
       }
+      return false;
     });
     yield checkPlacesContextMenu(chevronPopup);
     info("Waiting for bookmark toolbar item chevron popup to close");
     yield closePopup(chevronPopup);
   });
 }
 
 /**
--- a/browser/components/migration/ESEDBReader.jsm
+++ b/browser/components/migration/ESEDBReader.jsm
@@ -473,16 +473,17 @@ ESEDB.prototype = {
       return new Date(Date.UTC(systemTime.wYear,
                                  systemTime.wMonth - 1,
                                  systemTime.wDay,
                                  systemTime.wHour,
                                  systemTime.wMinute,
                                  systemTime.wSecond,
                                  systemTime.wMilliseconds));
     }
+    return undefined;
   },
 
   _getColumnInfo(tableName, columns) {
     let rv = [];
     for (let column of columns) {
       let columnInfoFromDB = new ESE.JET_COLUMNDEF();
       ESE.GetColumnInfoW(this._sessionId, this._dbId, tableName, column.name,
                          columnInfoFromDB.address(), ESE.JET_COLUMNDEF.size, 0 /* JET_ColInfo */);
--- a/browser/components/migration/MSMigrationUtils.jsm
+++ b/browser/components/migration/MSMigrationUtils.jsm
@@ -867,16 +867,17 @@ WindowsVaultFormPasswords.prototype = {
       }
       ctypesKernelHelpers.finalize();
       ctypesVaultHelpers.finalize();
       aCallback(migrationSucceeded);
     }
     if (aOnlyCheckExists) {
       return false;
     }
+    return undefined;
   }
 };
 
 var MSMigrationUtils = {
   MIGRATION_TYPE_IE: 1,
   MIGRATION_TYPE_EDGE: 2,
   CtypesKernelHelpers: CtypesKernelHelpers,
   getBookmarksMigrator(migrationType = this.MIGRATION_TYPE_IE) {
--- a/browser/components/migration/content/migration.js
+++ b/browser/components/migration/content/migration.js
@@ -156,16 +156,17 @@ var MigrationWizard = {
       else
         this._wiz.currentPage.next = "importItems";
 
       if (sourceProfiles && sourceProfiles.length == 1)
         this._selectedProfile = sourceProfiles[0];
       else
         this._selectedProfile = null;
     }
+    return undefined;
   },
 
   // 2 - [Profile Selection]
   onSelectProfilePageShow: function ()
   {
     // Disabling this for now, since we ask about import sources in automigration
     // too and don't want to disable the back button
     // if (this._autoMigrate)
--- a/browser/components/uitour/test/head.js
+++ b/browser/components/uitour/test/head.js
@@ -22,16 +22,17 @@ function waitForConditionPromise(conditi
     } catch (e) {
       return defer.reject(e);
     }
     if (conditionPassed) {
       return defer.resolve();
     }
     tries++;
     setTimeout(checkCondition, SINGLE_TRY_TIMEOUT);
+    return undefined;
   }
   setTimeout(checkCondition, SINGLE_TRY_TIMEOUT);
   return defer.promise;
 }
 
 function waitForCondition(condition, nextTest, errorMsg) {
   waitForConditionPromise(condition, errorMsg).then(nextTest, (reason) => {
     ok(false, reason + (reason.stack ? "\n" + reason.stack : ""));
--- a/browser/experiments/Experiments.jsm
+++ b/browser/experiments/Experiments.jsm
@@ -1817,16 +1817,17 @@ Experiments.ExperimentEntry.prototype = 
         if (install.existingAddon) {
           this._log.warn("_installAddon() - onInstallStarted, addon already installed");
         }
 
         if (install.addon.type !== "experiment") {
           this._log.error("_installAddon() - onInstallStarted, wrong addon type");
           return false;
         }
+        return undefined;
       },
 
       onInstallEnded: install => {
         this._log.trace("_installAddon() - install ended for " + this.id);
         gActiveInstallURLs.delete(install.sourceURI.spec);
 
         this._lastChangedDate = this._policy.now();
         this._startDate = this._policy.now();
--- a/browser/modules/test/head.js
+++ b/browser/modules/test/head.js
@@ -16,16 +16,17 @@ function waitForConditionPromise(conditi
     } catch (e) {
       return defer.reject(e);
     }
     if (conditionPassed) {
       return defer.resolve();
     }
     tries++;
     setTimeout(checkCondition, SINGLE_TRY_TIMEOUT);
+    return undefined;
   }
   setTimeout(checkCondition, SINGLE_TRY_TIMEOUT);
   return defer.promise;
 }
 
 function waitForCondition(condition, nextTest, errorMsg) {
   waitForConditionPromise(condition, errorMsg).then(nextTest, (reason) => {
     ok(false, reason + (reason.stack ? "\n" + e.stack : ""));
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/TabsInTitlebar.jsm
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/TabsInTitlebar.jsm
@@ -19,16 +19,17 @@ this.TabsInTitlebar = {
 
   configurations: {
     tabsInTitlebar: {
       applyConfig: Task.async(function*() {
         if (Services.appinfo.OS == "Linux") {
           return Promise.reject("TabsInTitlebar isn't supported on Linux");
         }
         Services.prefs.setBoolPref(PREF_TABS_IN_TITLEBAR, true);
+        return undefined;
       }),
     },
 
     tabsOutsideTitlebar: {
       applyConfig: Task.async(function*() {
         Services.prefs.setBoolPref(PREF_TABS_IN_TITLEBAR, false);
       }),
     },
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Toolbars.jsm
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Toolbars.jsm
@@ -32,16 +32,17 @@ this.Toolbars = {
         toggleMenubarIfNecessary(true);
       }),
 
       verifyConfig: Task.async(function*() {
         let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
         if (browserWindow.fullScreen) {
           return Promise.reject("The bookmark toolbar and menubar are not shown in fullscreen.");
         }
+        return undefined;
       }),
     },
 
   },
 };
 
 
 ///// helpers /////