Bug 1531838 - Ensure we don't set up twice on any window. r=johannh
☠☠ backed out by 917d4b516ba9 ☠ ☠
authorNihanth Subramanya <nhnt11@gmail.com>
Tue, 09 Apr 2019 14:15:14 +0000
changeset 468567 5c20b75a9e32bbd62d1709eb42d3323ddfbe1d28
parent 468566 1badfbad01fb4ec5278cd0dbde44f165665491e9
child 468568 f09e9d011ba193397c2f0035ab74b3120355b99d
push id35843
push usernbeleuzu@mozilla.com
push dateTue, 09 Apr 2019 22:08:13 +0000
treeherdermozilla-central@a31032a16330 [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");