Bug 1231984 - Add a shim for gBrowserInit.delayedStartupFinished to keep the Add-on SDK happy (domWindow.gBrowserInit is undefined) r=Neil a=IanN for comm-beta
authorPhilip Chee <philip.chee@gmail.com>
Fri, 01 Jan 2016 23:32:01 +0800
changeset 26567 6286686b0b1c5ea6e96ccf43cc9f044b1552094f
parent 26566 bd946322edbdf07bcba844b2c4ef9eb1c876ca7e
child 26568 e3fc44ad5e2225a3d50de48d35fa08078a3bb540
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNeil, IanN
bugs1231984
Bug 1231984 - Add a shim for gBrowserInit.delayedStartupFinished to keep the Add-on SDK happy (domWindow.gBrowserInit is undefined) r=Neil a=IanN for comm-beta
suite/browser/navigator.js
--- a/suite/browser/navigator.js
+++ b/suite/browser/navigator.js
@@ -674,18 +674,32 @@ function Startup()
 
     // initialize the sync UI
     gSyncUI.init();
 
     // initialize the session-restore service
     setTimeout(InitSessionStoreCallback, 0);
   }
 
+  window.addEventListener("MozAfterPaint", DelayedStartup, false);
+}
+
+// Minimal gBrowserInit shim to keep the Addon-SDK happy.
+var gBrowserInit = {
+  delayedStartupFinished: false,
+}
+
+function DelayedStartup() {
+  window.removeEventListener("MozAfterPaint", DelayedStartup);
+
   // Bug 778855 - Perf regression if we do this here. To be addressed in bug 779008.
   setTimeout(function() { SafeBrowsing.init(); }, 2000);
+
+  gBrowserInit.delayedStartupFinished = true;
+  Services.obs.notifyObservers(window, "browser-delayed-startup-finished", "");
 }
 
 function UpdateNavBar()
 {
   var elements = getNavToolbox().getElementsByClassName("nav-bar-class");
   for (var i = 0; i < elements.length; i++) {
     var element = elements[i];
     element.classList.remove("nav-bar-last");