mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +00:00
Bug 1254104: use docShellIsActive instead of introducing logic that relies on tabbrowser implementation specifics. r=evilpies
This commit is contained in:
parent
5720fe43d8
commit
6a15e2ae79
@ -384,7 +384,7 @@ PopupNotifications.prototype = {
|
||||
let notifications = this._getNotificationsForBrowser(browser);
|
||||
notifications.push(notification);
|
||||
|
||||
let isActiveBrowser = this._isActiveBrowser(browser);
|
||||
let isActiveBrowser = browser.docShellIsActive;
|
||||
let fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
|
||||
let isActiveWindow = fm.activeWindow == this.window;
|
||||
|
||||
@ -460,7 +460,7 @@ PopupNotifications.prototype = {
|
||||
|
||||
this._setNotificationsForBrowser(aBrowser, notifications);
|
||||
|
||||
if (this._isActiveBrowser(aBrowser)) {
|
||||
if (aBrowser.docShellIsActive) {
|
||||
// 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.
|
||||
@ -477,7 +477,7 @@ PopupNotifications.prototype = {
|
||||
remove: function PopupNotifications_remove(notification) {
|
||||
this._remove(notification);
|
||||
|
||||
if (this._isActiveBrowser(notification.browser)) {
|
||||
if (notification.browser.docShellIsActive) {
|
||||
let notifications = this._getNotificationsForBrowser(notification.browser);
|
||||
this._update(notifications);
|
||||
}
|
||||
@ -535,7 +535,7 @@ PopupNotifications.prototype = {
|
||||
if (index == -1)
|
||||
return;
|
||||
|
||||
if (this._isActiveBrowser(notification.browser))
|
||||
if (notification.browser.docShellIsActive)
|
||||
notification.anchorElement.removeAttribute(ICON_ATTRIBUTE_SHOWING);
|
||||
|
||||
// remove the notification
|
||||
@ -941,14 +941,6 @@ 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;
|
||||
|
Loading…
Reference in New Issue
Block a user