Backed out 4 changesets (bug 1531838) for assertion failures on ClientLayerManager.cpp.
authorCosmin Sabou <csabou@mozilla.com>
Tue, 09 Apr 2019 18:14:10 +0300
changeset 468582 917d4b516ba958539d8145c13fab63a5344e953d
parent 468581 e217cf252bb06d2c4f4e61b49ccd1e77614a54df
child 468583 bfaec0e9d5d8de54f678094b26e4b7cd61a807ad
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)
bugs1531838
milestone68.0a1
backs out5c20b75a9e32bbd62d1709eb42d3323ddfbe1d28
1badfbad01fb4ec5278cd0dbde44f165665491e9
f54fe4e4822f7a1587e655de17487540a2e86544
712bd9022cc297ce0ffc6074f797d259f31835d8
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
Backed out 4 changesets (bug 1531838) for assertion failures on ClientLayerManager.cpp. Backed out changeset 5c20b75a9e32 (bug 1531838) Backed out changeset 1badfbad01fb (bug 1531838) Backed out changeset f54fe4e4822f (bug 1531838) Backed out changeset 712bd9022cc2 (bug 1531838)
browser/base/content/test/plugins/browser_private_clicktoplay.js
browser/extensions/fxmonitor/moz.build
browser/extensions/fxmonitor/privileged/FirefoxMonitor.jsm
browser/extensions/fxmonitor/privileged/subscripts/PanelUI.jsm
--- a/browser/base/content/test/plugins/browser_private_clicktoplay.js
+++ b/browser/base/content/test/plugins/browser_private_clicktoplay.js
@@ -105,19 +105,17 @@ add_task(async function test2a() {
   });
 });
 
 add_task(async function test2c() {
   let topicObserved = TestUtils.topicObserved("PopupNotifications-updateNotShowing");
   await createPrivateWindow(gHttpTestRoot + "plugin_test.html");
   await topicObserved;
 
-  let popupNotification = await TestUtils.waitForCondition(() => {
-    return gPrivateWindow.PopupNotifications.getNotification("click-to-play-plugins", gPrivateBrowser);
-  }, "Waiting for click-to-play-plugins notification in the private window");
+  let popupNotification = gPrivateWindow.PopupNotifications.getNotification("click-to-play-plugins", gPrivateBrowser);
   ok(popupNotification, "Test 2c, Should have a click-to-play notification");
 
   await ContentTask.spawn(gPrivateBrowser, null, function() {
     let plugin = content.document.getElementById("test");
     let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
     ok(objLoadingContent.activated, "Test 2c, Plugin should be activated");
   });
 
@@ -169,19 +167,17 @@ add_task(async function test3a() {
   });
 });
 
 add_task(async function test3c() {
   let topicObserved = TestUtils.topicObserved("PopupNotifications-updateNotShowing");
   await createPrivateWindow(gHttpTestRoot + "plugin_test.html");
   await topicObserved;
 
-  let popupNotification = await TestUtils.waitForCondition(() => {
-    return gPrivateWindow.PopupNotifications.getNotification("click-to-play-plugins", gPrivateBrowser);
-  }, "Waiting for click-to-play-plugins notification in the private window");
+  let popupNotification = gPrivateWindow.PopupNotifications.getNotification("click-to-play-plugins", gPrivateBrowser);
   ok(popupNotification, "Test 3c, Should have a click-to-play notification");
 
   // Check the button status
   let promiseShown = BrowserTestUtils.waitForEvent(gPrivateWindow.PopupNotifications.panel,
                                                    "Shown");
   popupNotification.reshow();
   await promiseShown;
   is(gPrivateWindow.PopupNotifications.panel.firstElementChild.secondaryButton.hidden, true,
--- a/browser/extensions/fxmonitor/moz.build
+++ b/browser/extensions/fxmonitor/moz.build
@@ -23,13 +23,14 @@ FINAL_TARGET_FILES.features['fxmonitor@m
   'privileged/api.js',
   'privileged/FirefoxMonitor.css',
   'privileged/FirefoxMonitor.jsm',
   'privileged/schema.json'
 ]
 
 FINAL_TARGET_FILES.features['fxmonitor@mozilla.org']['privileged']['subscripts'] += [
   'privileged/subscripts/EveryWindow.jsm',
-  'privileged/subscripts/Globals.jsm'
+  'privileged/subscripts/Globals.jsm',
+  'privileged/subscripts/PanelUI.jsm'
 ]
 
 with Files('**'):
   BUG_COMPONENT = ('Firefox', 'Firefox Monitor')
--- a/browser/extensions/fxmonitor/privileged/FirefoxMonitor.jsm
+++ b/browser/extensions/fxmonitor/privileged/FirefoxMonitor.jsm
@@ -68,17 +68,17 @@ this.FirefoxMonitor = {
   getFormattedString(aKey, args) {
     return this.strings.formatStringFromName(aKey, args, args.length);
   },
 
   init(aExtension) {
     this.extension = aExtension;
 
     XPCOMUtils.defineLazyPreferenceGetter(
-      this, "enabled", this.kEnabledPref, true,
+      this, "enabled", this.kEnabledPref, false,
       (pref, oldVal, newVal) => {
         if (newVal) {
           this.startObserving();
         } else {
           this.stopObserving();
         }
       }
     );
@@ -99,16 +99,20 @@ this.FirefoxMonitor = {
     /* globals Preferences, RemoteSettings, fetch, btoa, XUL_NS */
     Services.scriptloader.loadSubScript(
       this.getURL("privileged/subscripts/Globals.jsm"));
 
     /* globals EveryWindow */
     Services.scriptloader.loadSubScript(
       this.getURL("privileged/subscripts/EveryWindow.jsm"));
 
+    /* globals PanelUI */
+    Services.scriptloader.loadSubScript(
+      this.getURL("privileged/subscripts/PanelUI.jsm"));
+
     // Expire our telemetry on November 1, at which time
     // we should redo data-review.
     let telemetryExpiryDate = new Date(2019, 10, 1); // Month is zero-index
     let today = new Date();
     let expired = today.getTime() > telemetryExpiryDate.getTime();
 
     Services.telemetry.registerEvents("fxmonitor", {
       "interaction": {
@@ -223,41 +227,52 @@ this.FirefoxMonitor = {
       // If we can't get the host for the URL, it's not one we
       // care about for breach alerts anyway.
       return;
     }
 
     this.warnIfNeeded(aBrowser, host);
   },
 
-  notificationsByWindow: new WeakMap(),
-  panelUIsByWindow: new WeakMap(),
-
   async startObserving() {
     if (this.observerAdded) {
       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);
 
+        // Set up some helper functions on the window object
+        // for the popup notification to use.
+        win.FirefoxMonitorUtils = {
+          // Keeps track of all notifications currently shown,
+          // so that we can clear them out properly if we get
+          // disabled.
+          notifications: new Set(),
+          disable: () => {
+            this.disable();
+          },
+          getString: (aKey) => {
+            return this.getString(aKey);
+          },
+          getFormattedString: (aKey, args) => {
+            return this.getFormattedString(aKey, args);
+          },
+          getFirefoxMonitorURL: (aSiteName) => {
+            return `${this.FirefoxMonitorURL}/?breach=${encodeURIComponent(aSiteName)}&utm_source=firefox&utm_medium=popup`;
+          },
+        };
+
         // 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");
@@ -278,41 +293,46 @@ this.FirefoxMonitor = {
         let pn = doc.createElementNS(XUL_NS, "popupnotification");
         let pnContent = doc.createElementNS(XUL_NS, "popupnotificationcontent");
         let panelUI = new PanelUI(doc);
         pnContent.appendChild(panelUI.box);
         pn.appendChild(pnContent);
         pn.setAttribute("id", `${this.kNotificationID}-notification`);
         pn.setAttribute("hidden", "true");
         parentElt.appendChild(pn);
-        this.panelUIsByWindow.set(win, panelUI);
+        win.FirefoxMonitorPanelUI = panelUI;
 
         // Start listening across all tabs!
         win.gBrowser.addTabsProgressListener(this);
       },
       (win) => {
         // If the window is being destroyed and gBrowser no longer exists,
         // don't bother doing anything.
         if (!win.gBrowser) {
           return;
         }
 
         let DOMWindowUtils = win.windowUtils;
+        if (!DOMWindowUtils) {
+          // win.windowUtils was added in 63, fallback if it's not available.
+          DOMWindowUtils = win.QueryInterface(Ci.nsIInterfaceRequestor)
+                              .getInterface(Ci.nsIDOMWindowUtils);
+        }
         DOMWindowUtils.removeSheetUsingURIString(this.getURL("privileged/FirefoxMonitor.css"),
                                                  DOMWindowUtils.AUTHOR_SHEET);
 
-        this.notificationsByWindow.get(win).forEach(n => {
+        win.FirefoxMonitorUtils.notifications.forEach(n => {
           n.remove();
         });
-        this.notificationsByWindow.delete(win);
+        delete win.FirefoxMonitorUtils;
 
         let doc = win.document;
         doc.getElementById(`${this.kNotificationID}-notification-anchor`).remove();
         doc.getElementById(`${this.kNotificationID}-notification`).remove();
-        this.panelUIsByWindow.delete(win);
+        delete win.FirefoxMonitorPanelUI;
 
         win.gBrowser.removeTabsProgressListener(this);
       },
     );
 
     this.observerAdded = true;
   },
 
@@ -349,17 +369,17 @@ this.FirefoxMonitor = {
       Preferences.set(this.kFirstAlertShownPref, true);
     }
 
     this.warnedHostsSet.add(host);
     Preferences.set(this.kWarnedHostsPref, JSON.stringify([...this.warnedHostsSet]));
 
     let doc = browser.ownerDocument;
     let win = doc.defaultView;
-    let panelUI = this.panelUIsByWindow.get(win);
+    let panelUI = doc.defaultView.FirefoxMonitorPanelUI;
 
     let animatedOnce = false;
     let populatePanel = (event) => {
       switch (event) {
         case "showing":
           panelUI.refresh(site);
           if (animatedOnce) {
             // If we've already animated once for this site, don't animate again.
@@ -375,17 +395,17 @@ this.FirefoxMonitor = {
              .removeAttribute("fxmonitoranimationdone");
           doc.getElementById(`${this.kNotificationID}-notification-anchor`)
              .removeAttribute("fxmonitoranimationdone");
           break;
         case "shown":
           animatedOnce = true;
           break;
         case "removed":
-          this.notificationsByWindow.get(win).delete(
+          win.FirefoxMonitorUtils.notifications.delete(
             win.PopupNotifications.getNotification(this.kNotificationID, browser));
           Services.telemetry.recordEvent("fxmonitor", "interaction", "doorhanger_removed");
           break;
       }
     };
 
     let n = win.PopupNotifications.show(
       browser, this.kNotificationID, "",
@@ -395,123 +415,11 @@ this.FirefoxMonitor = {
         hideClose: true,
         eventCallback: populatePanel,
         popupIconURL: this.getURL("assets/monitor32.svg"),
       }
     );
 
     Services.telemetry.recordEvent("fxmonitor", "interaction", "doorhanger_shown");
 
-    this.notificationsByWindow.get(win).add(n);
+    win.FirefoxMonitorUtils.notifications.add(n);
   },
 };
-
-/* globals PluralForm */
-
-function PanelUI(doc) {
-  this.site = null;
-  this.doc = doc;
-
-  let box = doc.createElementNS(XUL_NS, "vbox");
-
-  let elt = doc.createElementNS(XUL_NS, "description");
-  elt.textContent = this.getString("fxmonitor.popupHeader");
-  elt.classList.add("headerText");
-  box.appendChild(elt);
-
-  elt = doc.createElementNS(XUL_NS, "description");
-  elt.classList.add("popupText");
-  box.appendChild(elt);
-
-  this.box = box;
-}
-
-PanelUI.prototype = {
-  getString(aKey) {
-    return FirefoxMonitor.getString(aKey);
-  },
-
-  getFormattedString(aKey, args) {
-    return FirefoxMonitor.getFormattedString(aKey, args);
-  },
-
-  get brandString() {
-    if (this._brandString) {
-      return this._brandString;
-    }
-    return this._brandString = this.getString("fxmonitor.brandName");
-  },
-
-  getFirefoxMonitorURL: (aSiteName) => {
-    return `${FirefoxMonitor.FirefoxMonitorURL}/?breach=${encodeURIComponent(aSiteName)}&utm_source=firefox&utm_medium=popup`;
-  },
-
-  get primaryAction() {
-    if (this._primaryAction) {
-      return this._primaryAction;
-    }
-    return this._primaryAction = {
-      label: this.getFormattedString("fxmonitor.checkButton.label", [this.brandString]),
-      accessKey: this.getString("fxmonitor.checkButton.accessKey"),
-      callback: () => {
-        let win = this.doc.defaultView;
-        win.openTrustedLinkIn(
-          this.getFirefoxMonitorURL(this.site.Name), "tab", { });
-
-        Services.telemetry.recordEvent("fxmonitor", "interaction", "check_btn");
-      },
-    };
-  },
-
-  get secondaryActions() {
-    if (this._secondaryActions) {
-      return this._secondaryActions;
-    }
-    return this._secondaryActions = [
-      {
-        label: this.getString("fxmonitor.dismissButton.label"),
-        accessKey: this.getString("fxmonitor.dismissButton.accessKey"),
-        callback: () => {
-          Services.telemetry.recordEvent("fxmonitor", "interaction", "dismiss_btn");
-        },
-      }, {
-        label: this.getFormattedString("fxmonitor.neverShowButton.label", [this.brandString]),
-        accessKey: this.getString("fxmonitor.neverShowButton.accessKey"),
-        callback: () => {
-          FirefoxMonitor.disable();
-          Services.telemetry.recordEvent("fxmonitor", "interaction", "never_show_btn");
-        },
-      },
-    ];
-  },
-
-  refresh(site) {
-    this.site = site;
-
-    let elt = this.box.querySelector(".popupText");
-
-    // If > 100k, the PwnCount is rounded down to the most significant
-    // digit and prefixed with "More than".
-    // Ex.: 12,345 -> 12,345
-    //      234,567 -> More than 200,000
-    //      345,678,901 -> More than 300,000,000
-    //      4,567,890,123 -> More than 4,000,000,000
-    let k100k = 100000;
-    let pwnCount = site.PwnCount;
-    let stringName = "fxmonitor.popupText";
-    if (pwnCount > k100k) {
-      let multiplier = 1;
-      while (pwnCount >= 10) {
-        pwnCount /= 10;
-        multiplier *= 10;
-      }
-      pwnCount = Math.floor(pwnCount) * multiplier;
-      stringName = "fxmonitor.popupTextRounded";
-    }
-
-    elt.textContent =
-      PluralForm.get(pwnCount, this.getString(stringName))
-                .replace("#1", pwnCount.toLocaleString())
-                .replace("#2", site.Name)
-                .replace("#3", site.Year)
-                .replace("#4", this.brandString);
-  },
-};
new file mode 100644
--- /dev/null
+++ b/browser/extensions/fxmonitor/privileged/subscripts/PanelUI.jsm
@@ -0,0 +1,117 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/* globals XUL_NS, Services, PluralForm */
+
+function PanelUI(doc) {
+  this.site = null;
+  this.doc = doc;
+
+  let box = doc.createElementNS(XUL_NS, "vbox");
+
+  let elt = doc.createElementNS(XUL_NS, "description");
+  elt.textContent = this.getString("fxmonitor.popupHeader");
+  elt.classList.add("headerText");
+  box.appendChild(elt);
+
+  elt = doc.createElementNS(XUL_NS, "description");
+  elt.classList.add("popupText");
+  box.appendChild(elt);
+
+  this.box = box;
+}
+
+PanelUI.prototype = {
+  get FirefoxMonitorUtils() {
+    // Set on every window by FirefoxMonitor.jsm for PanelUI to use.
+    // Because sharing is caring.
+    return this.doc.defaultView.FirefoxMonitorUtils;
+  },
+
+  getString(aKey) {
+    return this.FirefoxMonitorUtils.getString(aKey);
+  },
+
+  getFormattedString(aKey, args) {
+    return this.FirefoxMonitorUtils.getFormattedString(aKey, args);
+  },
+
+  get brandString() {
+    if (this._brandString) {
+      return this._brandString;
+    }
+    return this._brandString = this.getString("fxmonitor.brandName");
+  },
+
+  get primaryAction() {
+    if (this._primaryAction) {
+      return this._primaryAction;
+    }
+    return this._primaryAction = {
+      label: this.getFormattedString("fxmonitor.checkButton.label", [this.brandString]),
+      accessKey: this.getString("fxmonitor.checkButton.accessKey"),
+      callback: () => {
+        let win = this.doc.defaultView;
+        win.openTrustedLinkIn(
+          win.FirefoxMonitorUtils.getFirefoxMonitorURL(this.site.Name), "tab", { });
+
+        Services.telemetry.recordEvent("fxmonitor", "interaction", "check_btn");
+      },
+    };
+  },
+
+  get secondaryActions() {
+    if (this._secondaryActions) {
+      return this._secondaryActions;
+    }
+    return this._secondaryActions = [
+      {
+        label: this.getString("fxmonitor.dismissButton.label"),
+        accessKey: this.getString("fxmonitor.dismissButton.accessKey"),
+        callback: () => {
+          Services.telemetry.recordEvent("fxmonitor", "interaction", "dismiss_btn");
+        },
+      }, {
+        label: this.getFormattedString("fxmonitor.neverShowButton.label", [this.brandString]),
+        accessKey: this.getString("fxmonitor.neverShowButton.accessKey"),
+        callback: () => {
+          this.FirefoxMonitorUtils.disable();
+          Services.telemetry.recordEvent("fxmonitor", "interaction", "never_show_btn");
+        },
+      },
+    ];
+  },
+
+  refresh(site) {
+    this.site = site;
+
+    let elt = this.box.querySelector(".popupText");
+
+    // If > 100k, the PwnCount is rounded down to the most significant
+    // digit and prefixed with "More than".
+    // Ex.: 12,345 -> 12,345
+    //      234,567 -> More than 200,000
+    //      345,678,901 -> More than 300,000,000
+    //      4,567,890,123 -> More than 4,000,000,000
+    let k100k = 100000;
+    let pwnCount = site.PwnCount;
+    let stringName = "fxmonitor.popupText";
+    if (pwnCount > k100k) {
+      let multiplier = 1;
+      while (pwnCount >= 10) {
+        pwnCount /= 10;
+        multiplier *= 10;
+      }
+      pwnCount = Math.floor(pwnCount) * multiplier;
+      stringName = "fxmonitor.popupTextRounded";
+    }
+
+    elt.textContent =
+      PluralForm.get(pwnCount, this.getString(stringName))
+                .replace("#1", pwnCount.toLocaleString())
+                .replace("#2", site.Name)
+                .replace("#3", site.Year)
+                .replace("#4", this.brandString);
+  },
+};