Bug 1636229 - Do not force-show menubar/tabs in popup. r=dao

Differential Revision: https://phabricator.services.mozilla.com/D74871
This commit is contained in:
Tooru Fujisawa 2020-05-18 16:16:15 +00:00
Родитель c1cca03e21
Коммит c7b158e9ee
2 изменённых файлов: 50 добавлений и 2 удалений

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

@ -142,3 +142,51 @@ add_task(async function titlebar_buttons_visibility() {
Services.prefs.clearUserPref("browser.tabs.drawInTitlebar");
Services.prefs.clearUserPref("browser.link.open_newwindow");
});
// Test only `visibility` rule here, to verify bug 1636229 fix.
// Other styles and ancestors can be different for each OS.
function isVisible(element) {
const style = element.ownerGlobal.getComputedStyle(element);
return style.visibility == "visible";
}
async function testTabBarVisibility() {
SpecialPowers.pushPrefEnv({ set: [["dom.disable_open_during_load", false]] });
const popupOpened = BrowserTestUtils.waitForNewWindow({ url: "about:blank" });
BrowserTestUtils.openNewForegroundTab(
gBrowser,
"data:text/html,<html><script>popup=open('about:blank','','width=300,height=200')</script>"
);
const win = await popupOpened;
const doc = win.document;
ok(
!isVisible(doc.getElementById("TabsToolbar")),
"tabbar should be hidden for popup"
);
const closedPopupPromise = BrowserTestUtils.windowClosed(win);
win.close();
await closedPopupPromise;
gBrowser.removeCurrentTab();
}
add_task(async function tabbar_visibility() {
await testTabBarVisibility();
});
add_task(async function tabbar_visibility_with_theme() {
const extension = ExtensionTestUtils.loadExtension({
manifest: {
theme: {},
},
});
await extension.startup();
await testTabBarVisibility();
await extension.unload();
});

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

@ -271,8 +271,8 @@
:root:not([inDOMFullscreen]) #titlebar:-moz-lwtheme {
visibility: hidden;
}
:root:not([inDOMFullscreen]) #toolbar-menubar:-moz-lwtheme,
:root:not([inDOMFullscreen]) #TabsToolbar:-moz-lwtheme {
:root:not([inDOMFullscreen]):not([chromehidden~="menubar"]) #toolbar-menubar:-moz-lwtheme,
:root:not([inDOMFullscreen]):not([chromehidden~="toolbar"]) #TabsToolbar:-moz-lwtheme {
visibility: visible;
}
}