From 7a4a478cb813bda768414c5aa9b438958c8a30fb Mon Sep 17 00:00:00 2001 From: Mike Conley Date: Mon, 31 Oct 2016 16:12:51 -0400 Subject: [PATCH 01/71] Backed out changeset 30e050c04c4e r=mconley MozReview-Commit-ID: HLTpejFKnY9 --HG-- extra : rebase_source : a028531bffa63e5b83da92296efd0a6e11d2de72 --- 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; From 51616cb9be664a38619f0d5d7872717203840284 Mon Sep 17 00:00:00 2001 From: Mike Conley Date: Mon, 31 Oct 2016 17:02:33 -0400 Subject: [PATCH 02/71] Bug 1314125 - Make PopupNotifications use tabbrowser's selectedBrowser frameLoader instead of docShellIsActive to determine the currently selected tab. r=mikedeboer See inline documentation for why I'm using the frameLoader instead of just directly comparing the selectedBrowser to the browser requesting the prompt. MozReview-Commit-ID: D9ahuth6eLC --HG-- extra : rebase_source : 6fe207cf23d71fa6702ea55e3096920761e2f83a --- toolkit/modules/PopupNotifications.jsm | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/toolkit/modules/PopupNotifications.jsm b/toolkit/modules/PopupNotifications.jsm index 681037d45d8d..8656316094de 100644 --- a/toolkit/modules/PopupNotifications.jsm +++ b/toolkit/modules/PopupNotifications.jsm @@ -1054,11 +1054,22 @@ PopupNotifications.prototype = { }, _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); + // We compare on frameLoader instead of just comparing the + // selectedBrowser and browser directly because browser tabs in + // Responsive Design Mode put the actual web content into a + // mozbrowser iframe and proxy property read/write and method + // calls from the tab to that iframe. This is so that attempts + // to reload the tab end up reloading the content in + // Responsive Design Mode, and not the Responsive Design Mode + // viewer itself. + // + // This means that PopupNotifications can come up from a browser + // in Responsive Design Mode, but the selectedBrowser will not match + // the browser being passed into this function, despite the browser + // actually being within the selected tab. We workaround this by + // comparing frameLoader instead, which is proxied from the outer + // to the inner mozbrowser