From bad456c8e3079f403b520908e71b16e714481751 Mon Sep 17 00:00:00 2001 From: Mike Conley Date: Mon, 31 Oct 2016 16:12:51 -0400 Subject: [PATCH] Backed out changeset 30e050c04c4e r=mconley MozReview-Commit-ID: HLTpejFKnY9 --HG-- extra : rebase_source : 698964b8d471a353066bcdedf23bf9512cb71b23 --- toolkit/modules/PopupNotifications.jsm | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/toolkit/modules/PopupNotifications.jsm b/toolkit/modules/PopupNotifications.jsm index 766965869175..681037d45d8d 100644 --- a/toolkit/modules/PopupNotifications.jsm +++ b/toolkit/modules/PopupNotifications.jsm @@ -419,7 +419,7 @@ PopupNotifications.prototype = { let notifications = this._getNotificationsForBrowser(browser); notifications.push(notification); - let isActiveBrowser = browser.docShellIsActive; + let isActiveBrowser = this._isActiveBrowser(browser); let fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager); let isActiveWindow = fm.activeWindow == this.window; @@ -495,7 +495,7 @@ PopupNotifications.prototype = { this._setNotificationsForBrowser(aBrowser, notifications); - if (aBrowser.docShellIsActive) { + if (this._isActiveBrowser(aBrowser)) { // get the anchor element if the browser has defined one so it will // _update will handle both the tabs iconBox and non-tab permission // anchors. @@ -512,7 +512,7 @@ PopupNotifications.prototype = { remove: function PopupNotifications_remove(notification) { this._remove(notification); - if (notification.browser.docShellIsActive) { + if (this._isActiveBrowser(notification.browser)) { let notifications = this._getNotificationsForBrowser(notification.browser); this._update(notifications); } @@ -570,7 +570,7 @@ PopupNotifications.prototype = { if (index == -1) return; - if (notification.browser.docShellIsActive) + if (this._isActiveBrowser(notification.browser)) notification.anchorElement.removeAttribute(ICON_ATTRIBUTE_SHOWING); // remove the notification @@ -1053,6 +1053,14 @@ PopupNotifications.prototype = { return anchors; }, + _isActiveBrowser: function (browser) { + // Note: This helper only exists, because in e10s builds, + // we can't access the docShell of a browser from chrome. + return browser.docShell + ? browser.docShell.isActive + : (this.window.gBrowser.selectedBrowser == browser); + }, + _onIconBoxCommand: function PopupNotifications_onIconBoxCommand(event) { // Left click, space or enter only let type = event.type;