Bug 1880914 - Move BrowserFullScreen. r=Gijs

Differential Revision: https://phabricator.services.mozilla.com/D206200
This commit is contained in:
Yi Xiong Wong
2024-04-08 17:21:02 +00:00
parent c585b6d660
commit 78b5d3f5fc
12 changed files with 19 additions and 20 deletions

View File

@@ -124,7 +124,7 @@
# in the middle of the fullscreen transition otherwise.
oncommand="
this.closest('panel').hidePopup();
setTimeout(() => BrowserFullScreen(), 0);
setTimeout(() => BrowserCommands.fullScreen(), 0);
"
tooltip="dynamic-shortcut-tooltip">
<observes element="View:FullScreen" attribute="checked"/>

View File

@@ -569,4 +569,8 @@ var BrowserCommands = {
args
);
},
fullScreen() {
window.fullScreen = !window.fullScreen || BrowserHandler.kiosk;
},
};

View File

@@ -42,7 +42,7 @@
<command id="View:AboutProcesses" oncommand="switchToTabHavingURI('about:processes', true)"/>
<command id="View:PageSource" oncommand="BrowserCommands.viewSource(window.gBrowser.selectedBrowser);"/>
<command id="View:PageInfo" oncommand="BrowserCommands.pageInfo();"/>
<command id="View:FullScreen" oncommand="BrowserFullScreen();"/>
<command id="View:FullScreen" oncommand="BrowserCommands.fullScreen();"/>
<command id="View:ReaderView" oncommand="AboutReaderParent.toggleReaderMode(event);"/>
<command id="View:PictureInPicture" oncommand="PictureInPicture.onCommand(event);"/>
<command id="cmd_find" oncommand="gLazyFindCommand('onFindCommand')"/>

View File

@@ -3005,10 +3005,6 @@ function getDefaultHomePage() {
return url;
}
function BrowserFullScreen() {
window.fullScreen = !window.fullScreen || BrowserHandler.kiosk;
}
// TODO: can we pull getPEMString in from pippki.js instead of
// duplicating them here?
function getPEMString(cert) {

View File

@@ -45,7 +45,6 @@
"BrowserOnClick",
"getMeOutOfHere",
"getDefaultHomePage",
"BrowserFullScreen",
"getPEMString",
"browserDragAndDrop",
"homeButtonObserver",

View File

@@ -100,7 +100,7 @@
oncommand="FullScreen.setAutohide();"/>
<menuitem contexttype="fullscreen"
data-lazy-l10n-id="full-screen-exit"
oncommand="BrowserFullScreen();"/>
oncommand="BrowserCommands.fullScreen();"/>
</menupopup>
<!-- bug 415444/582485: event.stopPropagation is here for the cloned version
@@ -363,7 +363,7 @@
oncommand="FullScreen.setAutohide();"/>
<menuitem contexttype="fullscreen"
data-lazy-l10n-id="full-screen-exit"
oncommand="BrowserFullScreen();"/>
oncommand="BrowserCommands.fullScreen();"/>
</menupopup>
<menupopup id="blockedPopupOptions"

View File

@@ -708,7 +708,7 @@ add_task(async function test_mousemove_correcttarget() {
window,
"sizemodechange"
);
BrowserFullScreen();
BrowserCommands.fullScreen();
await sizeModeChanged;
await popupHiddenPromise;
}

View File

@@ -149,7 +149,7 @@ add_task(async function () {
gBrowser.selectedBrowser,
FS_CHANGE_SIZE
);
executeSoon(() => BrowserFullScreen());
executeSoon(() => BrowserCommands.fullScreen());
await fullscreenPromise;
}
});
@@ -195,7 +195,7 @@ add_task(async function () {
// dispatched synchronously, which would cause the event listener
// miss that event and wait infinitely.
fullscreenPromise = waitForFullscreenChanges(browser, FS_CHANGE_SIZE);
executeSoon(() => BrowserFullScreen());
executeSoon(() => BrowserCommands.fullScreen());
contentStates = await fullscreenPromise;
checkState({ inDOMFullscreen: false, inFullscreen: true }, contentStates);
@@ -228,7 +228,7 @@ add_task(async function () {
if (window.fullScreen) {
info("> Cleanup");
fullscreenPromise = waitForFullscreenChanges(browser, FS_CHANGE_SIZE);
executeSoon(() => BrowserFullScreen());
executeSoon(() => BrowserCommands.fullScreen());
await fullscreenPromise;
}
}

View File

@@ -26,14 +26,14 @@ async function test() {
await promiseTabLoadEvent(newBrowser.selectedTab, gHttpTestRoot + TEST_FILE);
// Enter browser fullscreen mode.
newWin.BrowserFullScreen();
newWin.BrowserCommands.fullScreen();
runNextTest();
}
registerCleanupFunction(async function () {
// Exit browser fullscreen mode.
newWin.BrowserFullScreen();
newWin.BrowserCommands.fullScreen();
await BrowserTestUtils.closeWindow(newWin);

View File

@@ -35,7 +35,7 @@ add_task(async function () {
let fullScreenEntered = TestUtils.waitForCondition(
() => document.documentElement.getAttribute("sizemode") == "fullscreen"
);
BrowserFullScreen();
BrowserCommands.fullScreen();
await fullScreenEntered;
tab2.linkedBrowser.focus();
@@ -54,7 +54,7 @@ add_task(async function () {
let fullScreenExited = TestUtils.waitForCondition(
() => document.documentElement.getAttribute("sizemode") != "fullscreen"
);
BrowserFullScreen();
BrowserCommands.fullScreen();
await fullScreenExited;
BrowserTestUtils.removeTab(gBrowser.selectedTab);

View File

@@ -13,7 +13,7 @@
data-l10n-id="browser-window-maximize-button"
/>
<toolbarbutton class="titlebar-button titlebar-restore"
oncommand="window.fullScreen ? BrowserFullScreen() : window.restore();"
oncommand="window.fullScreen ? BrowserCommands.fullScreen() : window.restore();"
data-l10n-id="browser-window-restore-down-button"
/>
<toolbarbutton class="titlebar-button titlebar-close"

View File

@@ -34,7 +34,7 @@ add_task(async function () {
"Should not be in fullscreen sizemode before we enter fullscreen."
);
BrowserFullScreen();
BrowserCommands.fullScreen();
await TestUtils.waitForCondition(() => isFullscreenSizeMode());
ok(
fullscreenButton.checked,
@@ -62,7 +62,7 @@ add_task(async function () {
await endCustomizing();
BrowserFullScreen();
BrowserCommands.fullScreen();
fullscreenButton = document.getElementById("fullscreen-button");
await TestUtils.waitForCondition(() => !isFullscreenSizeMode());
ok(