Bug 1531838 - Ensure we don't set up twice on any window. r=johannh

Differential Revision: https://phabricator.services.mozilla.com/D26701

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nihanth Subramanya 2019-04-14 17:49:57 +00:00
Родитель 0ba1f6de8b
Коммит 3b06eee462
1 изменённых файлов: 7 добавлений и 2 удалений

Просмотреть файл

@ -241,13 +241,18 @@ this.FirefoxMonitor = {
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");