Bug 1562006 - Update FxA toolbar menu for skyline r=eoger,Gijs,fluent-reviewers,flod

Differential Revision: https://phabricator.services.mozilla.com/D37961
This commit is contained in:
Vijay Budhram
2019-08-02 13:55:19 +00:00
parent 6f58957307
commit f86d68dcc0
24 changed files with 475 additions and 362 deletions

View File

@@ -489,6 +489,26 @@ XPCOMUtils.defineLazyPreferenceGetter(
}
);
XPCOMUtils.defineLazyPreferenceGetter(
this,
"gFxaSendLoginUrl",
"identity.fxaccounts.service.sendLoginUrl",
false,
(aPref, aOldVal, aNewVal) => {
showFxaToolbarMenu(gFxaToolbarEnabled);
}
);
XPCOMUtils.defineLazyPreferenceGetter(
this,
"gFxaMonitorLoginUrl",
"identity.fxaccounts.service.monitorLoginUrl",
false,
(aPref, aOldVal, aNewVal) => {
showFxaToolbarMenu(gFxaToolbarEnabled);
}
);
XPCOMUtils.defineLazyPreferenceGetter(
this,
"gMsgingSystemFxABadge",
@@ -648,6 +668,18 @@ function showFxaToolbarMenu(enable) {
} else {
mainWindowEl.removeAttribute("fxa_avatar_badged");
}
// When the pref for a FxA service is removed, we remove it from
// the FxA toolbar menu as well. This is useful when the service
// might not be available that browser.
document.getElementById(
"PanelUI-fxa-menu-send-button"
).hidden = !gFxaSendLoginUrl;
document.getElementById(
"PanelUI-fxa-menu-monitor-button"
).hidden = !gFxaMonitorLoginUrl;
document.getElementById("fxa-menu-service-separator").hidden =
!gFxaSendLoginUrl && !gFxaMonitorLoginUrl;
} else {
mainWindowEl.removeAttribute("fxatoolbarmenu");
}