Bug 1531838 - Ensure we don't set up twice on any window. r=johannh
☠☠ backed out by 236d2bc601b0 ☠ ☠
authorNihanth Subramanya <nhnt11@gmail.com>
Wed, 10 Apr 2019 22:12:09 +0000
changeset 469108 24d7fb7fd3afbc15a4018d926fa091f1c5ad4fc6
parent 469107 3e538caf5af2417e46ba5232e2c9ab51f6b69c6c
child 469109 7e886806ae987d8008486c878921a8a33329c55b
push id35856
push usercsabou@mozilla.com
push dateFri, 12 Apr 2019 03:19:48 +0000
treeherdermozilla-central@940684cd1065 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1531838
milestone68.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 1531838 - Ensure we don't set up twice on any window. r=johannh Differential Revision: https://phabricator.services.mozilla.com/D26701
browser/extensions/fxmonitor/privileged/FirefoxMonitor.jsm
--- a/browser/extensions/fxmonitor/privileged/FirefoxMonitor.jsm
+++ b/browser/extensions/fxmonitor/privileged/FirefoxMonitor.jsm
@@ -236,23 +236,28 @@ this.FirefoxMonitor = {
       return;
     }
 
     await this.delayedInit();
 
     EveryWindow.registerCallback(
       this.kNotificationID,
       (win) => {
+        if (this.notificationsByWindow.has(win)) {
+          // We've already set up this window.
+          return;
+        }
+
+        this.notificationsByWindow.set(win, new Set());
+
         // Inject our stylesheet.
         let DOMWindowUtils = win.windowUtils;
         DOMWindowUtils.loadSheetUsingURIString(this.getURL("privileged/FirefoxMonitor.css"),
                                                DOMWindowUtils.AUTHOR_SHEET);
 
-        this.notificationsByWindow.set(win, new Set());
-
         // Setup the popup notification stuff. First, the URL bar icon:
         let doc = win.document;
         let notificationBox = doc.getElementById("notification-popup-box");
         // We create a box to use as the anchor, and put an icon image
         // inside it. This way, when we animate the icon, its scale change
         // does not cause the popup notification to bounce due to the anchor
         // point moving.
         let anchorBox = doc.createElementNS(XUL_NS, "box");