Files
sousa-gecko/devtools/client/framework/test/browser_toolbox_fullscreen.js
T
Emilio Cobos Álvarez 238e669967 Bug 1954956 - Statically position fullscreen browsers. r=devtools-reviewers,dshin,nchevobbe
I guess if we wanted we could conditionally push to the top layer here:

  https://searchfox.org/mozilla-central/rev/be3db2aef8d3916c891527794a2d5e2f2dc9fab1/dom/base/Document.cpp#15233

But that would also change the .fullscreenElement DOM accessor and so
on... For now this restores the previous behavior.

Differential Revision: https://phabricator.services.mozilla.com/D242146
2025-03-20 14:16:07 +00:00

47 lines
1.2 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
var { Toolbox } = require("resource://devtools/client/framework/toolbox.js");
// Test that a fullscreen page allows DevTools to be seen.
const URL = "data:text/html;charset=utf-8,Fullscreen me";
add_task(async function test_fullscreen_docked_toolbox() {
const tab = await addTab(URL);
ok(!window.fullScreen, "Should not be fullscreen");
await new Promise(r => {
window.addEventListener("fullscreenchange", r, { once: true });
SpecialPowers.spawn(tab.linkedBrowser, [], () => {
content.document.documentElement.requestFullscreen();
});
});
ok(window.fullScreen, "Should be fullscreen");
const toolbox = await gDevTools.showToolboxForTab(tab);
isnot(
toolbox.hostType,
Toolbox.HostType.WINDOW,
"Toolbox is docked in the main window"
);
const tabRect = tab.linkedBrowser.getBoundingClientRect();
const devToolsRect =
toolbox.win.browsingContext.embedderElement.getBoundingClientRect();
Assert.lessOrEqual(
tabRect.bottom,
devToolsRect.top,
"DevTools shouldn't intersect the browser"
);
await toolbox.destroy();
gBrowser.removeCurrentTab();
});