Bug 1662183, hide fxa button from main menu when identity.fxaccounts.enabled is false r=Gijs,mkaply

Differential Revision: https://phabricator.services.mozilla.com/D88946
This commit is contained in:
Emma Malysz 2020-09-08 14:44:19 +00:00
Родитель c40d948391
Коммит 0b31b064f0
3 изменённых файлов: 37 добавлений и 0 удалений

Просмотреть файл

@ -1594,6 +1594,8 @@ var gSync = {
},
onFxaDisabled() {
document.documentElement.setAttribute("fxadisabled", true);
const toHide = [...document.querySelectorAll(".sync-ui-item")];
for (const item of toHide) {
item.hidden = true;

Просмотреть файл

@ -328,6 +328,37 @@ add_task(async function test_account_settings_state_signedin() {
await closeTabAndMainPanel();
});
add_task(async function test_app_menu_fxa_disabled() {
const newWin = await BrowserTestUtils.openNewBrowserWindow();
Services.prefs.setBoolPref("identity.fxaccounts.enabled", true);
newWin.gSync.onFxaDisabled();
let menuButton = newWin.document.getElementById("PanelUI-menu-button");
menuButton.click();
await BrowserTestUtils.waitForEvent(newWin.PanelUI.mainView, "ViewShown");
ok(
BrowserTestUtils.is_hidden(
newWin.document.getElementById("appMenu-fxa-status")
),
"Fxa status is hidden"
);
[...newWin.document.querySelectorAll(".sync-ui-item")].forEach(
e => (e.hidden = false)
);
let mainView = newWin.document.getElementById("appMenu-mainView");
let hidden = BrowserTestUtils.waitForEvent(
newWin.document,
"popuphidden",
true
);
mainView.closest("panel").hidePopup();
await hidden;
await BrowserTestUtils.closeWindow(newWin);
});
function checkPanelUIStatusBar({ label, fxastatus, syncing }) {
let labelNode = document.getElementById("appMenu-fxa-label");
is(labelNode.getAttribute("label"), label, "fxa label has the right value");

Просмотреть файл

@ -581,6 +581,10 @@ toolbarbutton[constrain-size="true"][cui-areatype="menu-panel"] > .toolbarbutton
-moz-box-align: center;
}
:root[fxadisabled=true] #appMenu-fxa-status {
display: none;
}
#appMenu-fxa-avatar,
#fxa-menu-account-fxa-avatar {
pointer-events: none;