browser_toolbox_fullscreen.js (1250B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 var { Toolbox } = require("resource://devtools/client/framework/toolbox.js"); 7 8 // Test that a fullscreen page allows DevTools to be seen. 9 10 const URL = "data:text/html;charset=utf-8,Fullscreen me"; 11 12 add_task(async function test_fullscreen_docked_toolbox() { 13 const tab = await addTab(URL); 14 15 ok(!window.fullScreen, "Should not be fullscreen"); 16 17 await new Promise(r => { 18 window.addEventListener("fullscreenchange", r, { once: true }); 19 SpecialPowers.spawn(tab.linkedBrowser, [], () => { 20 content.document.documentElement.requestFullscreen(); 21 }); 22 }); 23 24 ok(window.fullScreen, "Should be fullscreen"); 25 26 const toolbox = await gDevTools.showToolboxForTab(tab); 27 isnot( 28 toolbox.hostType, 29 Toolbox.HostType.WINDOW, 30 "Toolbox is docked in the main window" 31 ); 32 33 const tabRect = tab.linkedBrowser.getBoundingClientRect(); 34 const devToolsRect = 35 toolbox.win.browsingContext.embedderElement.getBoundingClientRect(); 36 37 Assert.lessOrEqual( 38 tabRect.bottom, 39 devToolsRect.top, 40 "DevTools shouldn't intersect the browser" 41 ); 42 43 await toolbox.destroy(); 44 45 gBrowser.removeCurrentTab(); 46 });