Bug 1356826: Part 6 - Wait for delayed startup before checking for side-loads. r=aswan
authorKris Maglione <maglione.k@gmail.com>
Sat, 15 Apr 2017 14:09:41 -0700
changeset 406388 79fbcdee024b43ba86b6d24dd7b8b2a74018fa78
parent 406387 4584ea301bd2897007d0ffcd6512e19dc61f00a0
child 406389 d771366888273fc96056c05a7294755f69235a01
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaswan
bugs1356826
milestone55.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 1356826: Part 6 - Wait for delayed startup before checking for side-loads. r=aswan MozReview-Commit-ID: IpuRNbdUXmE
browser/base/content/browser.js
browser/modules/ExtensionsUI.jsm
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -1138,16 +1138,21 @@ addEventListener("DOMContentLoaded", fun
     if (tabToOpen instanceof XULElement && tabToOpen.hasAttribute("usercontextid")) {
       initBrowser.setAttribute("usercontextid", tabToOpen.getAttribute("usercontextid"));
     }
   }
 
   gBrowser.updateBrowserRemoteness(initBrowser, gMultiProcessBrowser);
 });
 
+let _resolveDelayedStartup;
+var delayedStartupPromise = new Promise(resolve => {
+  _resolveDelayedStartup = resolve;
+});
+
 var gBrowserInit = {
   delayedStartupFinished: false,
 
   onLoad() {
     gBrowser.addEventListener("DOMUpdatePageReport", gPopupBlockerObserver);
 
     Services.obs.addObserver(gPluginHandler.NPAPIPluginCrashed, "plugin-crashed");
 
@@ -1600,16 +1605,17 @@ var gBrowserInit = {
         }
       }
     });
 
     gPageActionButton.init();
 
     this.delayedStartupFinished = true;
 
+    _resolveDelayedStartup();
     Services.obs.notifyObservers(window, "browser-delayed-startup-finished");
     TelemetryTimestamps.add("delayedStartupFinished");
   },
 
   // Returns the URI(s) to load at startup.
   _getUriToLoad() {
     // window.arguments[0]: URI to load (string), or an nsIArray of
     //                      nsISupportsStrings to load, or a xul:tab of
--- a/browser/modules/ExtensionsUI.jsm
+++ b/browser/modules/ExtensionsUI.jsm
@@ -30,24 +30,26 @@ const BRAND_PROPERTIES = "chrome://brand
 const HTML_NS = "http://www.w3.org/1999/xhtml";
 
 this.ExtensionsUI = {
   sideloaded: new Set(),
   updates: new Set(),
   sideloadListener: null,
   histogram: null,
 
-  init() {
+  async init() {
     this.histogram = Services.telemetry.getHistogramById("EXTENSION_INSTALL_PROMPT_RESULT");
 
     Services.obs.addObserver(this, "webextension-permission-prompt");
     Services.obs.addObserver(this, "webextension-update-permissions");
     Services.obs.addObserver(this, "webextension-install-notify");
     Services.obs.addObserver(this, "webextension-optional-permission-prompt");
 
+    await RecentWindow.getMostRecentBrowserWindow().delayedStartupPromise;
+
     this._checkForSideloaded();
   },
 
   _checkForSideloaded() {
     AddonManager.getAllAddons(addons => {
       // Check for any side-loaded addons that the user is allowed
       // to enable.
       let sideloaded = addons.filter(