Bug 1259729 fix attaching pocket styles on startup, r=jaws
☠☠ backed out by 543ba2e092d2 ☠ ☠
authorShane Caraveo <scaraveo@mozilla.com>
Fri, 01 Apr 2016 08:39:48 -0700
changeset 291398 9b5113e833ff005d4845e88d8de1041985a8c5c7
parent 291397 24134582d0ce49abdb224820c95e5ae5dae60174
child 291399 a1df259b9ea322baaff78eeafa3bbf7b5f366e8b
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1259729
milestone48.0a1
Bug 1259729 fix attaching pocket styles on startup, r=jaws
browser/extensions/pocket/bootstrap.js
--- a/browser/extensions/pocket/bootstrap.js
+++ b/browser/extensions/pocket/bootstrap.js
@@ -378,22 +378,18 @@ var PocketOverlay = {
                                                        this._sheetType);
     AboutSaved.register();
     AboutSignup.register();
     PocketReader.startup();
     CustomizableUI.addListener(this);
     CreatePocketWidget(reason);
     PocketContextMenu.init();
 
-    if (reason != APP_STARTUP) {
-      for (let win of allBrowserWindows()) {
-        this.setWindowScripts(win);
-        this.addStyles(win);
-        this.updateWindow(win);
-      }
+    for (let win of allBrowserWindows()) {
+      this.onWindowOpened(win);
     }
   },
   shutdown: function(reason) {
     AboutSaved.unregister();
     AboutSignup.unregister();
     CustomizableUI.removeListener(this);
     for (let window of allBrowserWindows()) {
       for (let id of ["panelMenu_pocket", "menu_pocket", "BMB_pocket",
@@ -409,16 +405,18 @@ var PocketOverlay = {
       delete window.pktUI;
       delete window.pktUIMessaging;
     }
     CustomizableUI.destroyWidget("pocket-button");
     PocketContextMenu.shutdown();
     PocketReader.shutdown();
   },
   onWindowOpened: function(window) {
+    if (window.hasOwnProperty("pktUI"))
+      return;
     this.setWindowScripts(window);
     this.addStyles(window);
     this.updateWindow(window);
   },
   setWindowScripts: function(window) {
     XPCOMUtils.defineLazyModuleGetter(window, "Pocket",
                                       "chrome://pocket/content/Pocket.jsm");
     // Can't use XPCOMUtils for these because the scripts try to define the variables