mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 965607 - [Australis] Show FxA doorhangers only for the most recent non-popup browser window r=markh
This commit is contained in:
parent
443a6f5ead
commit
2427791234
@ -22,6 +22,7 @@ let gFxAccounts = {
|
||||
},
|
||||
|
||||
get topics() {
|
||||
// Do all this dance to lazy-load FxAccountsCommon.
|
||||
delete this.topics;
|
||||
return this.topics = [
|
||||
FxAccountsCommon.ONLOGIN_NOTIFICATION,
|
||||
@ -31,13 +32,30 @@ let gFxAccounts = {
|
||||
];
|
||||
},
|
||||
|
||||
// The set of topics that only the active window should handle.
|
||||
get activeWindowTopics() {
|
||||
// Do all this dance to lazy-load FxAccountsCommon.
|
||||
delete this.activeWindowTopics;
|
||||
return this.activeWindowTopics = new Set([
|
||||
"weave:service:sync:start",
|
||||
FxAccountsCommon.ONVERIFIED_NOTIFICATION
|
||||
]);
|
||||
},
|
||||
|
||||
get button() {
|
||||
delete this.button;
|
||||
return this.button = document.getElementById("PanelUI-fxa-status");
|
||||
},
|
||||
|
||||
get isActiveWindow() {
|
||||
let mostRecentNonPopupWindow =
|
||||
RecentWindow.getMostRecentBrowserWindow({allowPopups: false});
|
||||
return window == mostRecentNonPopupWindow;
|
||||
},
|
||||
|
||||
init: function () {
|
||||
if (this._initialized) {
|
||||
// Bail out if we're already initialized and for pop-up windows.
|
||||
if (this._initialized || !window.toolbar.visible) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -69,6 +87,11 @@ let gFxAccounts = {
|
||||
},
|
||||
|
||||
observe: function (subject, topic) {
|
||||
// Ignore certain topics if we're not the active window.
|
||||
if (this.activeWindowTopics.has(topic) && !this.isActiveWindow) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (topic) {
|
||||
case FxAccountsCommon.ONVERIFIED_NOTIFICATION:
|
||||
Services.prefs.setBoolPref(PREF_SYNC_START_DOORHANGER, true);
|
||||
|
Loading…
Reference in New Issue
Block a user