Bug 1342144 - Fix ESLint errors in toolkit/. r=Yoric draft
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Fri, 24 Feb 2017 22:02:11 +0900
changeset 489774 750a58b1d258a7112d3def04940ad3e610b19747
parent 489773 af62eeccdc22b63022ac18e46023c153798caa94
child 489843 96afc864c15937b3546bd820cf1daed331ac4c0b
push id46895
push userVYV03354@nifty.ne.jp
push dateSun, 26 Feb 2017 03:42:29 +0000
reviewersYoric
bugs1342144
milestone54.0a1
Bug 1342144 - Fix ESLint errors in toolkit/. r=Yoric MozReview-Commit-ID: 9sp2uMryv8U
toolkit/components/contentprefs/tests/mochitest/test_remoteContentPrefs.html
toolkit/components/prompts/test/test_modal_prompts.html
toolkit/components/prompts/test/test_modal_select.html
toolkit/components/windowcreator/test/test_bug1170334_wbp_xmlstyle.html
toolkit/components/windowcreator/test/test_bug1192654.html
toolkit/components/windowwatcher/test/test_modal_windows.html
toolkit/content/tests/widgets/test_videocontrols_audio.html
toolkit/mozapps/extensions/test/mochitest/test_bug687194.html
--- a/toolkit/components/contentprefs/tests/mochitest/test_remoteContentPrefs.html
+++ b/toolkit/components/contentprefs/tests/mochitest/test_remoteContentPrefs.html
@@ -7,25 +7,28 @@
   </script>
   <script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
 </head>
 <body>
 
   <script type="application/javascript">
     "use strict";
+    /* import-globals-from ../../../../../testing/mochitest/tests/SimpleTest/SpawnTask.js */
 
     SimpleTest.waitForExplicitFinish();
 
     const childFrameURL =
       "data:text/html,<!DOCTYPE HTML><html><body></body></html>";
 
     function childFrameScript(isFramePrivate) {
       "use strict";
+      /* global addMessageListener */
 
+      /* eslint no-shadow: 0 */
       function Defer() {
         let d = {};
         d.promise = new Promise((resolve, reject) => {
           d.resolve = resolve;
           d.reject = reject;
         });
 
         return d;
@@ -55,34 +58,34 @@
 
       function* test1(mm) {
         let tester = new Tester(mm);
 
         tester.ok(cps !== null, "got the content pref service");
 
         let setPref = Defer();
         cps.setGlobal("testing", 42, null, {
-          handleCompletion: function(reason) {
+          handleCompletion(reason) {
             tester.is(reason, 0, "set a pref?");
             setPref.resolve();
           }
         });
 
         yield setPref.promise;
 
         let numResults = 0;
         let gotGlobal = Defer();
         cps.getGlobal("testing", null, {
-          handleResult: function(pref) {
+          handleResult(pref) {
             numResults++;
             tester.is(pref.name, "testing", "pref has the right name");
             tester.is(pref.value, 42, "pref has the right value");
           },
 
-          handleCompletion: function(reason) {
+          handleCompletion(reason) {
             tester.is(reason, 0, "get a pref?");
             tester.is(numResults, 1, "got the right number of prefs");
             gotGlobal.resolve();
           }
         });
 
         yield gotGlobal.promise;
       }
@@ -90,31 +93,31 @@
       function* test2(mm) {
         let tester = new Tester(mm);
 
         let observer;
         let removed = false;
         let gotSet = Defer();
         let gotRemoved = Defer();
         cps.addObserverForName("testName", observer = {
-          onContentPrefSet: function(group, name, value, isPrivate) {
+          onContentPrefSet(group, name, value, isPrivate) {
             tester.info("received prefSet notification");
             if (removed) {
               mm.sendAsyncMessage("testRemoteContentPrefs:fail",
                                   { reason: "unexpected notification" });
             }
             tester.is(group, null, "group should be null");
             tester.is(name, "testName", "should only see testName");
             tester.is(value, 42, "value should be correct");
             tester.is(isPrivate, isFramePrivate, "privacy should match");
 
             gotSet.resolve();
           },
 
-          onContentPrefRemoved: function(group, name, isPrivate) {
+          onContentPrefRemoved(group, name, isPrivate) {
             tester.info("received prefRemoved notification");
             tester.is(group, null, "group should be null");
             tester.is(name, "testName", "name should match");
             tester.is(isPrivate, isFramePrivate, "privacy should match");
 
             cps.removeObserverForName("testName", observer);
             removed = true;
 
@@ -129,61 +132,62 @@
         yield gotRemoved.promise;
       }
 
       function* test3(mm) {
         let tester = new Tester(mm);
 
         let setGlobalDone = Defer();
         cps.setGlobal("testName", 42, null, {
-          handleCompletion: function(reason) {
+          handleCompletion(reason) {
             tester.is(reason, 0, "set a pref");
             cps.set("http://mochi.test", "testpref", "str", null, {
-              handleCompletion: function(reason) {
+              /* eslint no-shadow: 0 */
+              handleCompletion(reason) {
                 tester.is(reason, 0, "set a pref");
                 setGlobalDone.resolve();
               }
             });
           }
         });
 
         yield setGlobalDone.promise;
 
         let removeDone = Defer();
         cps.removeByDomain("http://mochi.test", null, {
-          handleCompletion: function(reason) {
+          handleCompletion(reason) {
             tester.is(reason, 0, "remove succeeded");
             cps.getByDomainAndName("http://mochi.test", "testpref", null, {
-              handleResult: function() {
+              handleResult() {
                 mm.sendAsyncMessage("testRemoteContentPrefs:fail",
                                     { reason: "got removed pref in test3" });
               },
-              handleCompletion: function() {
+              handleCompletion() {
                 removeDone.resolve();
               },
-              handleError: function(rv) {
+              handleError(rv) {
                 mm.sendAsyncMessage("testRemoteContentPrefs:fail",
                                     { reason: `got a pref error ${rv}` });
               }
             });
           }
         });
 
         yield removeDone.promise;
       }
 
       function* test4(mm) {
         let tester = new Tester(mm);
 
         let observed = Defer();
         let prefObserver = {
-          onContentPrefSet: function(group, name, value, isPrivate) {
+          onContentPrefSet(group, name, value, isPrivate) {
             observed.resolve({ group, name, value, isPrivate });
           },
-          onContentPrefRemoved: function(group, name, isPrivate) {
+          onContentPrefRemoved(group, name, isPrivate) {
             observed.reject("got unexpected notification");
           }
         };
 
         cps.addObserverForName("test", prefObserver);
 
         cps.set("http://mochi.test", "test", 42, { usePrivateBrowsing: true });
         let event = yield observed.promise;
@@ -273,35 +277,35 @@
       curTest = Defer();
       mm.sendAsyncMessage("testRemoteContentPrefs:test3", {});
       yield curTest.promise;
 
       curTest = Defer();
       mm.addMessageListener("testRemoteContentPrefs:getPref", function(msg) {
         let results = [];
         cps.getByDomainAndName(msg.data.group, msg.data.name, null, {
-          handleResult: function(pref) {
+          handleResult(pref) {
             info("received handleResult");
             results.push(pref);
           },
-          handleCompletion: function(reason) {
+          handleCompletion(reason) {
             mm.sendAsyncMessage("testRemoteContentPrefs:prefResults",
                                 { results });
           },
-          handleError: function(rv) {
+          handleError(rv) {
             ok(false, `failed to get pref ${rv}`);
             curTest.reject("got unexpected error");
           }
         });
       });
 
       mm.sendAsyncMessage("testRemoteContentPrefs:test4", {});
       yield curTest.promise;
 
-      document.getElementById('iframe').remove();
+      document.getElementById("iframe").remove();
     }
 
     function runTest(isPrivate) {
       info("testing with isPrivate=" + isPrivate);
       let iframe = document.createElement("iframe");
       SpecialPowers.wrap(iframe).mozbrowser = true;
       if (isPrivate) {
         SpecialPowers.wrap(iframe).mozprivatebrowsing = true;
--- a/toolkit/components/prompts/test/test_modal_prompts.html
+++ b/toolkit/components/prompts/test/test_modal_prompts.html
@@ -12,20 +12,20 @@ Prompter tests: modal prompts
 <p id="display"></p>
 
 <div id="content" style="display: none">
   <iframe id="iframe"></iframe>
 </div>
 
 <pre id="test">
 <script class="testbody" type="text/javascript">
-
+/* import-globals-from prompt_common.js */
 function* runTests() {
-    const { NetUtil } = SpecialPowers.Cu.import('resource://gre/modules/NetUtil.jsm');
-    let state, action;
+    const { NetUtil } = SpecialPowers.Cu.import("resource://gre/modules/NetUtil.jsm");
+    let state, action, promptDone;
     ok(true, "Running tests (isTabModal=" + isTabModal + ", usePromptService=" + usePromptService + ")");
 
     let prompter, promptArgs;
     if (usePromptService) {
         prompter = Cc["@mozilla.org/embedcomp/prompt-service;1"].
                    getService(Ci.nsIPromptService2);
     } else {
         prompter = Cc["@mozilla.org/prompter;1"].
@@ -977,17 +977,17 @@ function* runTests() {
         realm : ""
     };
 
 
     // =====
     // (promptAuth is only accessible from the prompt service)
     info("Starting test: promptAuth with empty realm");
     state = {
-        msg : 'http://example.com is requesting your username and password.',
+        msg : "http://example.com is requesting your username and password.",
         title : "TestTitle",
         iconClass   : "authentication-icon question-icon",
         titleHidden : true,
         textHidden  : false,
         passHidden  : false,
         checkHidden : false,
         textValue   : "",
         passValue   : "",
@@ -1015,20 +1015,20 @@ function* runTests() {
         yield promptDone;
     }
 
 
     // =====
     // (promptAuth is only accessible from the prompt service)
     info("Starting test: promptAuth with long realm");
     state = {
-        msg : 'http://example.com is requesting your username and password. The site '  +
-              'says: \u201cabcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi ' +
-              'abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi '        +
-              'abcdefghi \u2026\u201d',
+        msg : "http://example.com is requesting your username and password. The site " +
+              "says: \u201cabcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi " +
+              "abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi " +
+              "abcdefghi \u2026\u201d",
         title : "TestTitle",
         iconClass   : "authentication-icon question-icon",
         titleHidden : true,
         textHidden  : false,
         passHidden  : false,
         checkHidden : false,
         textValue   : "",
         passValue   : "",
@@ -1068,18 +1068,18 @@ function* runTests() {
         password : "",
         domain   : "",
         flags    : Ci. nsIAuthInformation.AUTH_HOST |
                    Ci.nsIAuthInformation.CROSS_ORIGIN_SUB_RESOURCE,
         authenticationScheme : "basic",
         realm : ""
     }
     state = {
-        msg : 'http://example.com is requesting your username and password. ' +
-              'WARNING: Your password will not be sent to the website you are currently visiting!',
+        msg : "http://example.com is requesting your username and password. " +
+              "WARNING: Your password will not be sent to the website you are currently visiting!",
         title : "TestTitle",
         iconClass   : "authentication-icon question-icon",
         titleHidden : true,
         textHidden  : false,
         passHidden  : false,
         checkHidden : false,
         textValue   : "",
         passValue   : "",
@@ -1111,18 +1111,18 @@ function* runTests() {
         username : "",
         password : "",
         domain   : "",
         flags : Ci. nsIAuthInformation.AUTH_HOST | Ci.nsIAuthInformation.CROSS_ORIGIN_SUB_RESOURCE,
         authenticationScheme : "basic",
         realm : "Something!!!"
     }
     state = {
-        msg : 'http://example.com is requesting your username and password. ' +
-              'WARNING: Your password will not be sent to the website you are currently visiting!',
+        msg : "http://example.com is requesting your username and password. " +
+              "WARNING: Your password will not be sent to the website you are currently visiting!",
         title : "TestTitle",
         iconClass   : "authentication-icon question-icon",
         titleHidden : true,
         textHidden  : false,
         passHidden  : false,
         checkHidden : false,
         textValue   : "",
         passValue   : "",
--- a/toolkit/components/prompts/test/test_modal_select.html
+++ b/toolkit/components/prompts/test/test_modal_select.html
@@ -12,17 +12,17 @@ Prompter tests: modal prompts
 <p id="display"></p>
 
 <div id="content" style="display: none">
   <iframe id="iframe"></iframe>
 </div>
 
 <pre id="test">
 <script class="testbody" type="text/javascript">
-
+/* import-globals-from prompt_common.js */
 let prompter = Cc["@mozilla.org/embedcomp/prompt-service;1"].
                getService(Ci.nsIPromptService2);
 
 function checkPromptState(promptState, expectedState) {
     // XXX check title? OS X has title in content
     // XXX check focused element
     // XXX check button labels?
 
@@ -36,107 +36,106 @@ function checkPromptState(promptState, e
 
     for (let i = 0; i < promptState.items; i++) {
         is(promptState.items[i], expectedState.items[i], "Checking list item #" + i);
     }
 }
 
 let selectVal = {};
 let isOK;
-let state, action;
 
 function handlePrompt(state, action) {
   return new Promise(resolve => {
     gChromeScript.addMessageListener("promptHandled", function handled(msg) {
       gChromeScript.removeMessageListener("promptHandled", handled);
       checkPromptState(msg.promptState, state);
       resolve(true);
     });
-    gChromeScript.sendAsyncMessage("handlePrompt", { action: action, isSelect: true});
+    gChromeScript.sendAsyncMessage("handlePrompt", { action, isSelect: true});
   });
 }
 
 
 // =====
 add_task(function* test_select_empty_list() {
     info("Starting test: Select (0 items, ok)");
-    state = {
+    let state = {
         msg   : "This is the select text.",
         title : "TestTitle",
         items : [],
     };
-    action = {
+    let action = {
         buttonClick: "ok",
     };
-    promptDone = handlePrompt(state, action);
-    items = [];
+    let promptDone = handlePrompt(state, action);
+    let items = [];
     selectVal.value = null; // outparam, just making sure.
     isOK = prompter.select(window, "TestTitle", "This is the select text.", items.length, items, selectVal);
     is(isOK, true, "checked expected retval");
     is(selectVal.value, -1, "checking selected index");
 
     yield promptDone;
 });
 
 // =====
 add_task(function* test_select_ok() {
     info("Starting test: Select (3 items, ok)");
-    state = {
+    let state = {
         msg   : "This is the select text.",
         title : "TestTitle",
         items : ["one", "two", "three"],
     };
-    action = {
+    let action = {
         buttonClick: "ok",
     };
-    promptDone = handlePrompt(state, action);
-    items = ["one", "two", "three"];
+    let promptDone = handlePrompt(state, action);
+    let items = ["one", "two", "three"];
     selectVal.value = null; // outparam, just making sure.
     isOK = prompter.select(window, "TestTitle", "This is the select text.", items.length, items, selectVal);
     is(isOK, true, "checked expected retval");
     is(selectVal.value, 0, "checking selected index");
 
     yield promptDone;
 });
 
 // =====
 add_task(function* test_select_item() {
     info("Starting test: Select (3 items, selection changed, ok)");
-    state = {
+    let state = {
         msg   : "This is the select text.",
         title : "TestTitle",
         items : ["one", "two", "three"],
     };
-    action = {
+    let action = {
         buttonClick: "ok",
         selectItem: 1,
     };
-    promptDone = handlePrompt(state, action);
-    items = ["one", "two", "three"];
+    let promptDone = handlePrompt(state, action);
+    let items = ["one", "two", "three"];
     selectVal.value = null; // outparam, just making sure.
     isOK = prompter.select(window, "TestTitle", "This is the select text.", items.length, items, selectVal);
     is(isOK, true, "checked expected retval");
     is(selectVal.value, 1, "checking selected index");
 
     yield promptDone;
 });
 
 // =====
 add_task(function* test_cancel_prompt() {
     info("Starting test: Select (3 items, cancel)");
-    state = {
+    let state = {
         msg   : "This is the select text.",
         title : "TestTitle",
         items : ["one", "two", "three"],
     };
-    action = {
+    let action = {
         buttonClick: "cancel",
     };
-    promptDone = handlePrompt(state, action);
-    items = ["one", "two", "three"];
+    let promptDone = handlePrompt(state, action);
+    let items = ["one", "two", "three"];
     selectVal.value = null; // outparam, just making sure.
     isOK = prompter.select(window, "TestTitle", "This is the select text.", items.length, items, selectVal);
     is(isOK, false, "checked expected retval");
     is(selectVal.value, 0, "checking selected index");
 
     yield promptDone;
 });
 
--- a/toolkit/components/windowcreator/test/test_bug1170334_wbp_xmlstyle.html
+++ b/toolkit/components/windowcreator/test/test_bug1170334_wbp_xmlstyle.html
@@ -12,17 +12,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1170334">Mozilla Bug 1170334</a>
 <p id="display"></p>
 <pre id="results"></pre>
 <div id="content">
   <iframe src="bug1170334_iframe.xml" id="iframe"></iframe>
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
-const nameStem="test_bug1170334_" + Date.now();
+const nameStem = "test_bug1170334_" + Date.now();
 const { Ci, Cc, Cu, Cr } = SpecialPowers;
 let iframe = document.getElementById("iframe");
 
 SimpleTest.waitForExplicitFinish();
 
 iframe.onload = function iframe_onload1() {
   let doc = iframe.contentDocument;
   ok(doc, "iframe content document exists");
@@ -36,20 +36,20 @@ iframe.onload = function iframe_onload1(
             .get("TmpD", Ci.nsIFile);
   let tmpFile = tmp.clone();
   tmpFile.append(nameStem + "_iframe.xml");
   let tmpDir = tmp.clone();
   tmpDir.append(nameStem + "_files");
 
   // When the document in the iframe is saved, try to load the result.
   wbp.progressListener = {
-    onProgressChange: function(){},
-    onLocationChange: function(){},
-    onStatusChange: function(){},
-    onSecurityChange: function(){},
+    onProgressChange() {},
+    onLocationChange() {},
+    onStatusChange() {},
+    onSecurityChange() {},
     onStateChange: function wbp_stateChange(_wbp, _req, state, status) {
       if ((state & Ci.nsIWebProgressListener.STATE_STOP) == 0) {
 	return;
       }
       is(status, Cr.NS_OK, "nsWebBrowserPersist status");
       iframe.onload = function iframe_onload2() {
 	let elem = iframe.contentDocument.documentElement;
 	is(elem && elem.tagName, "thing", "document element tag");
--- a/toolkit/components/windowcreator/test/test_bug1192654.html
+++ b/toolkit/components/windowcreator/test/test_bug1192654.html
@@ -19,17 +19,17 @@ https://bugzilla.mozilla.org/show_bug.cg
        uses a data URI because data: is a non-persistable scheme and
        thus triggers the bug.
     -->
   <iframe src="data:text/html,<iframe%20src=%22data:text/plain,Example%22>"
 	  id="iframe"></iframe>
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
-const nameStem="test_bug1192654_" + Date.now();
+const nameStem = "test_bug1192654_" + Date.now();
 const { Ci, Cc, Cu, Cr } = SpecialPowers;
 let iframe = document.getElementById("iframe");
 
 SimpleTest.waitForExplicitFinish();
 
 iframe.onload = function iframe_onload1() {
   let doc = iframe.contentDocument;
   ok(doc, "iframe content document exists");
@@ -40,20 +40,20 @@ iframe.onload = function iframe_onload1(
             .getService(Ci.nsIProperties)
             .get("TmpD", Ci.nsIFile);
   let tmpFile = tmp.clone();
   tmpFile.append(nameStem + "_iframe.xml");
   let tmpDir = tmp.clone();
   tmpDir.append(nameStem + "_files");
 
   wbp.progressListener = {
-    onProgressChange: function(){},
-    onLocationChange: function(){},
-    onStatusChange: function(){},
-    onSecurityChange: function(){},
+    onProgressChange() {},
+    onLocationChange() {},
+    onStatusChange() {},
+    onSecurityChange() {},
     onStateChange: wbp_stateChange,
   };
   SimpleTest.registerCleanupFunction(cleanUp);
 
   wbp.saveDocument(doc, tmpFile, tmpDir, null, 0, 0);
 
   function wbp_stateChange(_wbp, _req, state, status) {
     if ((state & Ci.nsIWebProgressListener.STATE_STOP) == 0) {
--- a/toolkit/components/windowwatcher/test/test_modal_windows.html
+++ b/toolkit/components/windowwatcher/test/test_modal_windows.html
@@ -32,18 +32,18 @@ that is opened reports itself as being m
 
       let wbc = treeOwner.QueryInterface(Ci.nsIInterfaceRequestor)
                          .getInterface(Ci.nsIWebBrowserChrome);
       ok(wbc.isWindowModal(), "Should report as modal");
 
       win.close();
     });
 
-    let modal = window.openDialog("data:text/html,<p>This is a modal window for test_modal_windows.html</p>",
-                                  "_blank", "modal", null);
+    window.openDialog("data:text/html,<p>This is a modal window for test_modal_windows.html</p>",
+                      "_blank", "modal", null);
     // Since the modal runs a nested event loop, just to be on the safe side,
     // we'll wait a tick of the main event loop before resolving the task.
     yield new Promise(resolve => setTimeout(resolve, 0));
   });
 
   </script>
 </head>
 <body>
--- a/toolkit/content/tests/widgets/test_videocontrols_audio.html
+++ b/toolkit/content/tests/widgets/test_videocontrols_audio.html
@@ -15,17 +15,17 @@
 
 <pre id="test">
 <script class="testbody" type="application/javascript">
 
   var domUtils = SpecialPowers.Cc["@mozilla.org/inspector/dom-utils;1"].
     getService(SpecialPowers.Ci.inIDOMUtils);
 
   function findElementByAttribute(element, aName, aValue) {
-    if (!('getAttribute' in element)) {
+    if (!("getAttribute" in element)) {
       return false;
     }
     if (element.getAttribute(aName) === aValue) {
       return element;
     }
     let children = domUtils.getChildrenForNode(element, true);
     for (let child of children) {
       var result = findElementByAttribute(child, aName, aValue);
--- a/toolkit/mozapps/extensions/test/mochitest/test_bug687194.html
+++ b/toolkit/mozapps/extensions/test/mochitest/test_bug687194.html
@@ -18,32 +18,33 @@
       "data:text/html,<!DOCTYPE HTML><html><body></body></html>";
 
     function childFrameScript() {
       "use strict";
 
       var ios =
           Components.classes["@mozilla.org/network/io-service;1"]
                     .getService(Components.interfaces.nsIIOService);
+      /* global Ci, addMessageListener */
       let cr =
           Components.classes["@mozilla.org/chrome/chrome-registry;1"]
                     .getService(Ci.nsIXULChromeRegistry);
       addMessageListener("test687194:resolveChromeURI", function(message) {
         let result;
         let threw = false;
         try {
             let uri = ios.newURI(message.data.URI);
             result = cr.convertChromeURL(uri).spec;
         } catch (e) {
             threw = true;
             result = "EXCEPTION: " + e;
         }
 
         message.target.sendAsyncMessage("test687194:resolveChromeURI:Answer",
-                                        { threw: threw, result: result });
+                                        { threw, result });
       });
     }
 
     let test;
     function* testStructure(mm) {
       let lastResult;
 
       mm.addMessageListener("test687194:resolveChromeURI:Answer", function(msg) {
@@ -56,32 +57,33 @@
       is(lastResult.threw, true, "URI shouldn't resolve to begin with");
 
       let { AddonManager } = SpecialPowers.Cu.import("resource://gre/modules/AddonManager.jsm", {});
       const INSTALL_URI =
         "http://mochi.test:8888/tests/toolkit/mozapps/extensions/test/mochitest/file_bug687194.xpi"
       AddonManager.getInstallForURL(INSTALL_URI, (install) => {
         install = SpecialPowers.wrap(install);
         install.addListener(SpecialPowers.wrapCallbackObject({
-          onInstallEnded: function(install, addon) {
+          /* eslint no-shadow: 0 */
+          onInstallEnded(install, addon) {
             SimpleTest.executeSoon(() => test.next(addon));
           }
         }));
         install.install();
       }, "application/x-xpinstall");
 
       let addon = SpecialPowers.wrap(yield);
 
       mm.sendAsyncMessage("test687194:resolveChromeURI",
                           { URI: "chrome://bug687194/content/e10sbug.js" });
       lastResult = yield;
       is(lastResult.threw, false, "able to resolve after the installation");
 
       let listener = SpecialPowers.wrapCallbackObject({
-        onUninstalled: function(removedAddon) {
+        onUninstalled(removedAddon) {
           if (removedAddon.id === addon.id) {
             AddonManager.removeAddonListener(listener);
             SimpleTest.executeSoon(() => test.next());
           }
         }
       });
       AddonManager.addAddonListener(listener);
       addon.uninstall();