Bug 1170804 - Fix bugs found by eslint in components/. r=margaret
authorMichael Comella <michael.l.comella@gmail.com>
Wed, 24 Jun 2015 21:56:23 -0700
changeset 268445 7c445f47c4d6a78ff57c5b3d32702e6cd0ab6156
parent 268444 14f8333949e896ba722adb4a2492a31aa8eeae62
child 268446 de00e0badee1ad02ae895ceabfe1c7e3d2a7b543
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-esr52@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret
bugs1170804
milestone41.0a1
Bug 1170804 - Fix bugs found by eslint in components/. r=margaret A few errors still remain.
mobile/android/components/AboutRedirector.js
mobile/android/components/BlocklistPrompt.js
mobile/android/components/ContentDispatchChooser.js
mobile/android/components/LoginManagerPrompter.js
mobile/android/components/PromptService.js
--- a/mobile/android/components/AboutRedirector.js
+++ b/mobile/android/components/AboutRedirector.js
@@ -17,17 +17,19 @@ let modules = {
 
   // about:fennec and about:firefox are aliases for about:,
   // but hidden from about:about
   fennec: {
     uri: "chrome://browser/content/about.xhtml",
     privileged: true,
     hide: true
   },
-  get firefox() this.fennec,
+  get firefox() {
+    return this.fennec
+  },
 
   // about:blank has some bad loading behavior we can avoid, if we use an alias
   empty: {
     uri: "about:blank",
     privileged: false,
     hide: true
   },
 
--- a/mobile/android/components/BlocklistPrompt.js
+++ b/mobile/android/components/BlocklistPrompt.js
@@ -43,17 +43,17 @@ BlocklistPrompt.prototype = {
                                    "blocked-add-on",
                                    "",
                                    "PRIORITY_CRITICAL_HIGH",
                                    buttons);
     }
     // Disable softblocked items automatically
     for (let i = 0; i < aAddons.length; i++) {
       if (aAddons[i].item instanceof Ci.nsIPluginTag)
-        addonList[i].item.disabled = true;
+        aAddons[i].item.disabled = true;
       else
         aAddons[i].item.userDisabled = true;
     }
   },
   classID: Components.ID("{4e6ea350-b09a-11df-94e2-0800200c9a66}"),
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIBlocklistPrompt])
 };
 
--- a/mobile/android/components/ContentDispatchChooser.js
+++ b/mobile/android/components/ContentDispatchChooser.js
@@ -1,15 +1,16 @@
 /* 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/. */
 
 const Ci = Components.interfaces;
 const Cu = Components.utils;
 const Cc = Components.classes;
+const Cr = Components.results;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/Messaging.jsm");
 
 function ContentDispatchChooser() {}
 
 ContentDispatchChooser.prototype =
--- a/mobile/android/components/LoginManagerPrompter.js
+++ b/mobile/android/components/LoginManagerPrompter.js
@@ -1,19 +1,20 @@
 /* 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/. */
 
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cr = Components.results;
+const Cu = Components.utils;
 
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-Components.utils.import("resource://gre/modules/Services.jsm");
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+Cu.import("resource://gre/modules/Services.jsm");
 
 /* Constants for password prompt telemetry.
  * Mirrored in nsLoginManagerPrompter.js */
 const PROMPT_DISPLAYED = 0;
 
 const PROMPT_ADD = 1;
 const PROMPT_NOTNOW = 2;
 const PROMPT_NEVER = 3;
@@ -438,17 +439,17 @@ LoginManagerPrompter.prototype = {
             uri = Services.io.newURI(aURI, null, null);
         }
         var scheme = uri.scheme;
 
         var hostname = scheme + "://" + uri.host;
 
         // If the URI explicitly specified a port, only include it when
         // it's not the default. (We never want "http://foo.com:80")
-        port = uri.port;
+        let port = uri.port;
         if (port != -1) {
             var handler = Services.io.getProtocolHandler(scheme);
             if (port != handler.defaultPort)
                 hostname += ":" + port;
         }
 
         return hostname;
     },
--- a/mobile/android/components/PromptService.js
+++ b/mobile/android/components/PromptService.js
@@ -369,21 +369,21 @@ InternalPrompt.prototype = {
   nsIAuthPrompt_prompt : function (title, text, passwordRealm, savePassword, defaultText, result) {
     // TODO: Port functions from nsLoginManagerPrompter.js to here
     if (defaultText)
       result.value = defaultText;
     return this.nsIPrompt_prompt(title, text, result, null, {});
   },
 
   nsIAuthPrompt_promptUsernameAndPassword : function (aTitle, aText, aPasswordRealm, aSavePassword, aUser, aPass) {
-    return nsIAuthPrompt_loginPrompt(aTitle, aText, aPasswordRealm, aSavePassword, aUser, aPass);
+    return this.nsIAuthPrompt_loginPrompt(aTitle, aText, aPasswordRealm, aSavePassword, aUser, aPass);
   },
 
   nsIAuthPrompt_promptPassword : function (aTitle, aText, aPasswordRealm, aSavePassword, aPass) {
-    return nsIAuthPrompt_loginPrompt(aTitle, aText, aPasswordRealm, aSavePassword, null, aPass);
+    return this.nsIAuthPrompt_loginPrompt(aTitle, aText, aPasswordRealm, aSavePassword, null, aPass);
   },
 
   nsIAuthPrompt_loginPrompt: function(aTitle, aPasswordRealm, aSavePassword, aUser, aPass) {
     let checkMsg = null;
     let check = { value: false };
     let hostname, realm;
     [hostname, realm, aUser] = PromptUtils.getHostnameAndRealm(aPasswordRealm);
 
@@ -798,17 +798,17 @@ let PromptUtils = {
   },
 
   getFormattedHostname : function pu_getFormattedHostname(uri) {
     let scheme = uri.scheme;
     let hostname = scheme + "://" + uri.host;
 
     // If the URI explicitly specified a port, only include it when
     // it's not the default. (We never want "http://foo.com:80")
-    port = uri.port;
+    let port = uri.port;
     if (port != -1) {
       let handler = Services.io.getProtocolHandler(scheme);
       if (port != handler.defaultPort)
         hostname += ":" + port;
     }
     return hostname;
   },