Bug 1464938: Stop needlessly waiting for responses to startup messages. r=aswan a=pascalc
authorKris Maglione <maglione.k@gmail.com>
Wed, 25 Jul 2018 12:05:22 -0700
changeset 480859 ee7538f8ddf837b4f75b072e2e2e003451ad1519
parent 480858 fb0705fdbec7f917f10485cfb9f1788952d6f7e8
child 480860 51110614b9b777831db74b7cd342f299925e1066
push id1757
push userffxbld-merge
push dateFri, 24 Aug 2018 17:02:43 +0000
treeherdermozilla-release@736023aebdb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaswan, pascalc
bugs1464938
milestone62.0
Bug 1464938: Stop needlessly waiting for responses to startup messages. r=aswan a=pascalc MozReview-Commit-ID: 328wmW1CZ9L
browser/components/extensions/test/browser/browser_ext_browserAction_popup_preload.js
toolkit/components/extensions/Extension.jsm
--- a/browser/components/extensions/test/browser/browser_ext_browserAction_popup_preload.js
+++ b/browser/components/extensions/test/browser/browser_ext_browserAction_popup_preload.js
@@ -197,15 +197,17 @@ add_task(async function testBrowserActio
   // Make sure the mouse isn't hovering over the browserAction widget.
   EventUtils.synthesizeMouseAtCenter(win.gURLBar, {type: "mouseover"}, win);
 
   await extension.startup();
 
   let widget = getBrowserActionWidget(extension).forWindow(win);
   EventUtils.synthesizeMouseAtCenter(widget.node, {type: "mousedown", button: 0}, win);
 
-  await extension.awaitMessage("tabTitle");
+  await new Promise(resolve => setTimeout(resolve, 100));
 
   EventUtils.synthesizeMouseAtCenter(widget.node, {type: "mouseup", button: 0}, win);
 
+  await extension.awaitMessage("tabTitle");
+
   await extension.unload();
   await BrowserTestUtils.closeWindow(win);
 });
--- a/toolkit/components/extensions/Extension.jsm
+++ b/toolkit/components/extensions/Extension.jsm
@@ -1594,19 +1594,19 @@ class Extension extends ExtensionData {
     // Map of the programmatically registered content script definitions
     // (by string scriptId), used in ext-contentScripts.js to propagate
     // the registered content scripts to the child content processes
     // (e.g. when a new content process starts after a content process crash).
     this.registeredContentScripts = serial.registeredContentScripts;
 
     data["Extension:Extensions"].push(serial);
 
-    return this.broadcast("Extension:Startup", serial).then(() => {
-      return Promise.all(promises);
-    });
+    this.broadcast("Extension:Startup", serial);
+
+    return Promise.all(promises);
   }
 
   /**
    * Call the close() method on the given object when this extension
    * is shut down.  This can happen during browser shutdown, or when
    * an extension is manually disabled or uninstalled.
    *
    * @param {object} obj