Bug 1259729 fix attaching pocket styles on startup, r=jaws
authorShane Caraveo <scaraveo@mozilla.com>
Fri, 01 Apr 2016 08:39:48 -0700
changeset 291458 6f1d7279737d7e3ad4194947f81aeaad4e2c89a4
parent 291457 8e350c4b966f97902ab2d95cd9d70a88d1e70c68
child 291459 fd4ef6fe328cfa2a77c9987b10a7e00b711cfaf6
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