Bug 1901826 - prevent tab preview from triggering fullscreen toolbar autohide. r=dao,jswinarton

Differential Revision: https://phabricator.services.mozilla.com/D218432
This commit is contained in:
DJ 2024-09-09 14:51:43 +00:00
Родитель 5a85faba21
Коммит 15f5422184
3 изменённых файлов: 83 добавлений и 1 удалений

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

@ -798,7 +798,7 @@ var FullScreen = {
// e.g. we wouldn't want the autoscroll icon firing this event, so when the user
// toggles chrome when moving mouse to the top, it doesn't go away again.
let target = aEvent.originalTarget;
if (target.localName == "tooltip") {
if (target.localName == "tooltip" || target.id == "tab-preview-panel") {
return;
}
if (

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

@ -49,6 +49,8 @@ skip-if = [
["browser_fullscreen_newwindow.js"]
["browser_fullscreen_tab_preview.js"]
["browser_fullscreen_permissions_prompt.js"]
["browser_fullscreen_warning.js"]

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

@ -0,0 +1,80 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// This test ensures dismissing a tab preview does not hide the nav toolbox
// when browser.fullscreen.autohide is true.
add_setup(async () => {
await SpecialPowers.pushPrefEnv({
set: [
["browser.fullscreen.autohide", true],
["browser.tabs.hoverPreview.enabled", true],
["ui.tooltip.delay_ms", 0],
],
});
});
add_task(async function testTabPreview() {
let tab = BrowserTestUtils.addTab(gBrowser, "about:blank");
let onFullscreen = Promise.all([
BrowserTestUtils.waitForEvent(window, "fullscreen"),
BrowserTestUtils.waitForEvent(
window,
"sizemodechange",
false,
() => window.fullScreen
),
]);
document.getElementById("View:FullScreen").doCommand();
await onFullscreen;
// make sure the toolbox is visible if it's autohidden
FullScreen.showNavToolbox();
let tabPreviewPanel = document.getElementById("tab-preview-panel");
// open tab preview
const previewShown = BrowserTestUtils.waitForPopupEvent(
tabPreviewPanel,
"shown"
);
EventUtils.synthesizeMouse(
tab,
1,
1,
{
type: "mouseover",
},
window
);
await previewShown;
// close tab preview
const previewHidden = BrowserTestUtils.waitForPopupEvent(
tabPreviewPanel,
"hidden"
);
EventUtils.synthesizeMouse(
document.getElementById("tabs-newtab-button"),
1,
1,
{ type: "mouseover" }
);
await previewHidden;
// navtoolbox should still be visible
Assert.ok(
!FullScreen._isChromeCollapsed,
"Toolbar remains visible after tab preview is hidden"
);
BrowserTestUtils.removeTab(tab);
let onExitFullscreen = Promise.all([
BrowserTestUtils.waitForEvent(window, "fullscreen"),
BrowserTestUtils.waitForEvent(
window,
"sizemodechange",
false,
() => !window.fullScreen
),
]);
document.getElementById("View:FullScreen").doCommand();
await onExitFullscreen;
});