Bug 1237340: Fix browser and toolkit eslint failures. r?felipe draft
authorDave Townsend <dtownsend@oxymoronical.com>
Wed, 06 Jan 2016 10:10:35 -0800
changeset 319376 d8b316591db43f19b125ef8754506edf941a1d69
parent 319371 b6b9c0012ba7bef84ffcf600791b079eba1e3713
child 512583 72ab36138f9a603d2e80e6741c3824414a60df70
push id9017
push userdtownsend@mozilla.com
push dateWed, 06 Jan 2016 18:10:44 +0000
reviewersfelipe
bugs1237340
milestone46.0a1
Bug 1237340: Fix browser and toolkit eslint failures. r?felipe
.eslintignore
browser/extensions/pocket/content/main.js
browser/extensions/pocket/content/panels/js/messages.js
browser/extensions/pocket/content/panels/js/tmpl.js
browser/extensions/pocket/content/pktApi.jsm
testing/mochitest/browser.eslintrc
testing/mochitest/chrome.eslintrc
testing/mochitest/mochitest.eslintrc
testing/xpcshell/xpcshell.eslintrc
toolkit/components/extensions/ExtensionUtils.jsm
toolkit/content/aboutProfiles.js
toolkit/content/jar.mn
toolkit/mozapps/extensions/test/xpcshell/test_duplicateplugins.js
--- a/.eslintignore
+++ b/.eslintignore
@@ -78,16 +78,17 @@ browser/components/pocket/**
 browser/components/preferences/**
 browser/components/privatebrowsing/**
 browser/components/sessionstore/**
 browser/components/shell/**
 browser/components/tabview/**
 browser/components/translation/**
 browser/components/uitour/**
 browser/extensions/pdfjs/**
+browser/extensions/pocket/content/panels/js/vendor/**
 browser/extensions/shumway/**
 browser/fuel/**
 browser/locales/**
 
 # Loop specific exclusions
 
 # This file currently uses a non-standard (and not on a standards track)
 # if statement within catch.
--- a/browser/extensions/pocket/content/main.js
+++ b/browser/extensions/pocket/content/main.js
@@ -192,28 +192,28 @@ var pktUI = (function() {
 
     	var panelId = showPanel("chrome://pocket/content/panels/saved.html?pockethost=" + Services.prefs.getCharPref("extensions.pocket.site") + "&premiumStatus=" + (pktApi.isPremiumUser() ? '1' : '0') + '&inoverflowmenu='+inOverflowMenu + "&locale=" + getUILocale(), {
     		onShow: function() {
                 var saveLinkMessageId = 'saveLink';
 
                 // Send error message for invalid url
                 if (!isValidURL) {
                     // TODO: Pass key for localized error in error object
-                    var error = {
+                    let error = {
                         message: 'Only links can be saved',
                         localizedKey: "onlylinkssaved"
                     };
                     pktUIMessaging.sendErrorMessageToPanel(panelId, saveLinkMessageId, error);
                     return;
                 }
 
                 // Check online state
                 if (!navigator.onLine) {
                     // TODO: Pass key for localized error in error object
-                    var error = {
+                    let error = {
                         message: 'You must be connected to the Internet in order to save to Pocket. Please connect to the Internet and try again.'
                     };
                     pktUIMessaging.sendErrorMessageToPanel(panelId, saveLinkMessageId, error);
                     return;
                 }
 
                 // Add url
                 var options = {
--- a/browser/extensions/pocket/content/panels/js/messages.js
+++ b/browser/extensions/pocket/content/panels/js/messages.js
@@ -70,9 +70,9 @@ var pktPanelMessaging = (function() {
      * Public functions
      */
     return {
       panelIdFromURL: panelIdFromURL,
         addMessageListener : addMessageListener,
         removeMessageListener : removeMessageListener,
         sendMessage: sendMessage
     };
-}());
\ No newline at end of file
+}());
--- a/browser/extensions/pocket/content/panels/js/tmpl.js
+++ b/browser/extensions/pocket/content/panels/js/tmpl.js
@@ -142,9 +142,9 @@ templates['signupstoryboard_shell'] = te
     + " <a href=\"https://"
     + escapeExpression(((helper = (helper = helpers.pockethost || (depth0 != null ? depth0.pockethost : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"pockethost","hash":{},"data":data}) : helper)))
     + "/login?ep=3&src=extension&s=ffi&t=login&v="
     + escapeExpression(((helper = (helper = helpers.variant || (depth0 != null ? depth0.variant : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"variant","hash":{},"data":data}) : helper)))
     + "\" target=\"_blank\">"
     + escapeExpression(((helper = (helper = helpers.loginnow || (depth0 != null ? depth0.loginnow : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"loginnow","hash":{},"data":data}) : helper)))
     + "</a>.</p>\n</div>";
 },"useData":true});
-})();
\ No newline at end of file
+})();
--- a/browser/extensions/pocket/content/pktApi.jsm
+++ b/browser/extensions/pocket/content/pktApi.jsm
@@ -118,17 +118,17 @@ var pktApi = (function() {
      * @return {string} String containing the value of the key. If the key
      *                  does not exist, null is returned
      */
      function getSetting(key) {
      	// TODO : Move this to sqlite or a local file so it's not editable (and is safer)
      	// https://developer.mozilla.org/en-US/Add-ons/Overlay_Extensions/XUL_School/Local_Storage
      	
 		if (!prefBranch.prefHasUserValue(key))
-			return;
+			return undefined;
 		
 		return prefBranch.getComplexValue(key, Components.interfaces.nsISupportsString).data;
      }
 
      /**
       * Wrapper for different plattforms to set a value for a given key in settings
       * @param {string} key     A string containing the name of the key you want
       *                         to create/update.
--- a/testing/mochitest/browser.eslintrc
+++ b/testing/mochitest/browser.eslintrc
@@ -1,13 +1,11 @@
 // Parent config file for all browser-chrome files.
 {
   "rules": {
-    // Head files want to define globals so don't warn for unused globals
-    "no-unused-vars": [2, {"vars": "local", "args": "none"}],
     "mozilla/import-headjs-globals": 1,
     "mozilla/import-browserjs-globals": 1,
   },
 
   "env": {
     "browser": true,
   },
 
--- a/testing/mochitest/chrome.eslintrc
+++ b/testing/mochitest/chrome.eslintrc
@@ -1,13 +1,11 @@
 // Parent config file for all mochitest files.
 {
   rules: {
-    // Head files want to define globals so don't warn for unused globals
-    "no-unused-vars": [2, {"vars": "local", "args": "none"}],
     "mozilla/import-headjs-globals": 1,
   },
 
   "env": {
     "browser": true,
   },
 
   // All globals made available in the test environment.
--- a/testing/mochitest/mochitest.eslintrc
+++ b/testing/mochitest/mochitest.eslintrc
@@ -1,13 +1,11 @@
 // Parent config file for all mochitest files.
 {
   rules: {
-    // Head files want to define globals so don't warn for unused globals
-    "no-unused-vars": [2, {"vars": "local", "args": "none"}],
     "mozilla/import-headjs-globals": 1,
   },
 
   "env": {
     "browser": true,
   },
 
   // All globals made available in the test environment.
--- a/testing/xpcshell/xpcshell.eslintrc
+++ b/testing/xpcshell/xpcshell.eslintrc
@@ -1,13 +1,11 @@
 // Parent config file for all xpcshell files.
 {
   rules: {
-    // Head files want to define globals so don't warn for unused globals
-    "no-unused-vars": [2, {"vars": "local", "args": "none"}],
     "mozilla/import-headjs-globals": 1,
   },
 
   // All globals made available in the test environment.
   "globals": {
     "add_task": false,
     "add_test": false,
     "Assert": false,
--- a/toolkit/components/extensions/ExtensionUtils.jsm
+++ b/toolkit/components/extensions/ExtensionUtils.jsm
@@ -654,17 +654,17 @@ Port.prototype = {
   close() {
     this.disconnect();
   },
 };
 
 function getMessageManager(target) {
   if (target instanceof Ci.nsIFrameLoaderOwner) {
     return target.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader.messageManager;
-   }
+  }
   return target;
 }
 
 // Each extension scope gets its own Messenger object. It handles the
 // basics of sendMessage, onMessage, connect, and onConnect.
 //
 // |context| is the extension scope.
 // |broker| is a MessageBroker used to receive and send messages.
--- a/toolkit/content/aboutProfiles.js
+++ b/toolkit/content/aboutProfiles.js
@@ -3,16 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 'use strict';
 
 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
 
 Cu.import('resource://gre/modules/Services.jsm');
 Cu.import('resource://gre/modules/XPCOMUtils.jsm');
+Cu.import('resource://gre/modules/AppConstants.jsm');
 
 XPCOMUtils.defineLazyServiceGetter(
   this,
   'ProfileService',
   '@mozilla.org/toolkit/profile-service;1',
   'nsIToolkitProfileService'
 );
 
@@ -171,25 +172,23 @@ function display(profileData) {
 
     let td = document.createElement('td');
     td.appendChild(document.createTextNode(value));
     tr.appendChild(td);
 
     if (dir) {
       td.appendChild(document.createTextNode(' '));
       let button = document.createElement('button');
-      let buttonText = document.createTextNode(bundle.GetStringFromName(
-#ifdef XP_WIN
-        'winOpenDir'
-#elif XP_MACOSX
-        'macOpenDir'
-#else
-        'openDir'
-#endif
-      ));
+      let string = 'openDir';
+      if (AppConstants.platform == "win") {
+        string = 'winOpenDir';
+      } else if (AppConstants.platform == "macosx") {
+        string = 'macOpenDir';
+      }
+      let buttonText = document.createTextNode(bundle.GetStringFromName(string));
       button.appendChild(buttonText);
       td.appendChild(button);
 
       button.addEventListener('click', function(e) {
         openDirectory(value);
       });
     }
   }
--- a/toolkit/content/jar.mn
+++ b/toolkit/content/jar.mn
@@ -19,17 +19,17 @@ toolkit.jar:
 #ifdef MOZILLA_OFFICIAL
    content/global/aboutRights.xhtml
 #else
    content/global/aboutRights.xhtml           (aboutRights-unbranded.xhtml)
 #endif
    content/global/aboutNetworking.js
    content/global/aboutNetworking.xhtml
 #ifndef ANDROID
-*  content/global/aboutProfiles.js
+   content/global/aboutProfiles.js
    content/global/aboutProfiles.xhtml
 #endif
    content/global/aboutServiceWorkers.js
    content/global/aboutServiceWorkers.xhtml
    content/global/aboutwebrtc/aboutWebrtc.css   (aboutwebrtc/aboutWebrtc.css)
    content/global/aboutwebrtc/aboutWebrtc.js    (aboutwebrtc/aboutWebrtc.js)
    content/global/aboutwebrtc/aboutWebrtc.xhtml (aboutwebrtc/aboutWebrtc.xhtml)
    content/global/aboutSupport.js
--- a/toolkit/mozapps/extensions/test/xpcshell/test_duplicateplugins.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_duplicateplugins.js
@@ -23,17 +23,16 @@ var PLUGINS = [{
   name: "Duplicate Plugin 1",
   description: "A duplicate plugin",
   version: "1",
   blocklisted: false,
   enabledState: Ci.nsIPluginTag.STATE_ENABLED,
   get disabled() {
     return this.enabledState == Ci.nsIPluginTag.STATE_DISABLED;
   },
-  filename: "",
   filename: "/usr/lib/plugins/dupplugin1.so"
 }, {
   name: "Duplicate Plugin 2",
   description: "Another duplicate plugin",
   version: "1",
   blocklisted: false,
   enabledState: Ci.nsIPluginTag.STATE_ENABLED,
   get disabled() {
@@ -44,17 +43,16 @@ var PLUGINS = [{
   name: "Duplicate Plugin 2",
   description: "Another duplicate plugin",
   version: "1",
   blocklisted: false,
   enabledState: Ci.nsIPluginTag.STATE_ENABLED,
   get disabled() {
     return this.enabledState == Ci.nsIPluginTag.STATE_DISABLED;
   },
-  filename: "",
   filename: "/usr/lib/plugins/dupplugin2.so"
 }, {
   name: "Non-duplicate Plugin", // 3
   description: "Not a duplicate plugin",
   version: "1",
   blocklisted: false,
   enabledState: Ci.nsIPluginTag.STATE_ENABLED,
   get disabled() {
@@ -65,17 +63,16 @@ var PLUGINS = [{
   name: "Non-duplicate Plugin", // 4
   description: "Not a duplicate because the descriptions are different",
   version: "1",
   blocklisted: false,
   enabledState: Ci.nsIPluginTag.STATE_ENABLED,
   get disabled() {
     return this.enabledState == Ci.nsIPluginTag.STATE_DISABLED;
   },
-  filename: "",
   filename: "/usr/lib/plugins/dupplugin4.so"
 }, {
   name: "Another Non-duplicate Plugin", // 5
   description: "Not a duplicate plugin",
   version: "1",
   blocklisted: false,
   enabledState: Ci.nsIPluginTag.STATE_ENABLED,
   get disabled() {