Bug 1229874: Part 2 - Fix the major errors detected by ESLint. r=billm
authorKris Maglione <maglione.k@gmail.com>
Wed, 02 Dec 2015 16:58:24 -0800
changeset 309673 a618b79155185a63ef94710be7d80c4f571e92bb
parent 309672 1a8e8ab6ee3dacc69e865879a4eb6739904d57b1
child 309674 f70ee6e84e82ec22a16f33c6a3f3da3402a36272
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm
bugs1229874
milestone45.0a1
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
Bug 1229874: Part 2 - Fix the major errors detected by ESLint. r=billm
browser/components/extensions/ext-contextMenus.js
browser/components/extensions/ext-utils.js
toolkit/components/extensions/Extension.jsm
toolkit/components/extensions/test/xpcshell/test_locale_converter.js
--- a/browser/components/extensions/ext-contextMenus.js
+++ b/browser/components/extensions/ext-contextMenus.js
@@ -28,17 +28,17 @@ function contextMenuObserver(subject, to
 
 // When a new contextMenu is opened, this function is called and
 // we populate the |xulMenu| with all the items from extensions
 // to be displayed. We always clear all the items again when
 // popuphidden fires. Since most of the info we need is already
 // calculated in nsContextMenu.jsm we simple reuse its flags here.
 // For remote processes there is a gContextMenuContentData where all
 // the important info is stored from the child process. We get
-// this data in |contentData|.
+// this data in |contextData|.
 var menuBuilder = {
   build: function(contextData) {
     // TODO: icons should be set for items
     let xulMenu = contextData.menu;
     xulMenu.addEventListener("popuphidden", this);
     let doc = xulMenu.ownerDocument;
     for (let [ext, menuItemMap] of contextMenuMap) {
       let parentMap = new Map();
@@ -93,17 +93,17 @@ var menuBuilder = {
       }
       if (topLevelItems.size > 1) {
         // If more than one top level items are visible, callopse them.
         let top = doc.createElement("menu");
         top.setAttribute("label", ext.name);
         top.setAttribute("ext-type", "top-level-menu");
         let menupopup = doc.createElement("menupopup");
         top.appendChild(menupopup);
-        for (i of topLevelItems) {
+        for (let i of topLevelItems) {
           menupopup.appendChild(i);
         }
         xulMenu.appendChild(top);
         this._itemsToCleanUp.add(top);
       } else if (topLevelItems.size == 1) {
         // If there is only one visible item, we can just append it.
         let singleItem = topLevelItems.values().next().value;
         xulMenu.appendChild(singleItem);
@@ -321,23 +321,23 @@ MenuItem.prototype = {
         break
       }
     }
     if (!enabled) {
       return false;
     }
 
     if (this.documentUrlMatchPattern &&
-        !this.documentUrlMatchPattern.matches(contentData.documentURIObject)) {
+        !this.documentUrlMatchPattern.matches(contextData.documentURIObject)) {
       return false;
     }
 
     if (this.targetUrlPatterns &&
         (contextData.onImage || contextData.onAudio || contextData.onVideo) &&
-        !this.targetUrlPatterns.matches(contentData.mediaURL)) {
+        !this.targetUrlPatterns.matches(contextData.mediaURL)) {
       // TODO: double check if mediaURL is always set when we need it
       return false;
     }
 
     return true;
   },
 };
 
--- a/browser/components/extensions/ext-utils.js
+++ b/browser/components/extensions/ext-utils.js
@@ -468,17 +468,17 @@ global.WindowManager = {
       incognito: PrivateBrowsingUtils.isWindowPrivate(window),
 
       // We fudge on these next two.
       type: this.windowType(window),
       state: window.fullScreen ? "fullscreen" : "normal",
     };
 
     if (getInfo && getInfo.populate) {
-      results.tabs = TabManager.for(extension).getTabs(window);
+      result.tabs = TabManager.for(extension).getTabs(window);
     }
 
     return result;
   },
 };
 
 // Manages listeners for window opening and closing. A window is
 // considered open when the "load" event fires on it. A window is
--- a/toolkit/components/extensions/Extension.jsm
+++ b/toolkit/components/extensions/Extension.jsm
@@ -345,17 +345,17 @@ var GlobalManager = {
     let context = new ExtensionPage(extension, {type: "tab", contentWindow, uri, docShell, incognito});
     inject(extension, context);
 
     let eventHandler = docShell.chromeEventHandler;
     let listener = event => {
       if (event.target != docShell.contentViewer.DOMDocument) {
         return;
       }
-      eventHandler.removeEventListener("unload", listener);
+      eventHandler.removeEventListener("unload", listener, true);
       context.unload();
     };
     eventHandler.addEventListener("unload", listener, true);
   },
 };
 
 // Represents the data contained in an extension, contained either
 // in a directory or a zip file, which may or may not be installed.
@@ -576,17 +576,17 @@ ExtensionData.prototype = {
     yield Promise.all(Array.from(locales.keys(),
                                  locale => this.readLocaleFile(locale)));
 
     let defaultLocale = this.defaultLocale;
     if (defaultLocale) {
       if (!locales.has(defaultLocale)) {
         this.manifestError('Value for "default_locale" property must correspond to ' +
                            'a directory in "_locales/". Not found: ' +
-                           JSON.stringify(`_locales/${default_locale}/`));
+                           JSON.stringify(`_locales/${this.manifest.default_locale}/`));
       }
     } else if (locales.size) {
       this.manifestError('The "default_locale" property is required when a ' +
                          '"_locales/" directory is present.');
     }
 
     return this.localeData.messages;
   }),
--- a/toolkit/components/extensions/test/xpcshell/test_locale_converter.js
+++ b/toolkit/components/extensions/test/xpcshell/test_locale_converter.js
@@ -100,16 +100,17 @@ add_task(function* testAsyncConvert() {
   equal(result, "Foo <localized-xxx> bar <localized-yyy> baz");
 });
 
 
 // Test that attempting to initialize a converter with the URI of a
 // nonexistent WebExtension fails.
 add_task(function* testInvalidUUID() {
   let uri = NetUtil.newURI("moz-extension://eb4f3be8-41c9-4970-aa6d-b84d1ecc02b2/file.css");
+  let stream = StringStream("Foo __MSG_xxx__ bar __MSG_yyy__ baz");
 
   Assert.throws(() => {
     convService.convert(stream, FROM_TYPE, TO_TYPE, uri);
   });
 
   Assert.throws(() => {
     let listener = { QueryInterface: XPCOMUtils.generateQI([Ci.nsIStreamListener]) };