mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1801168, only expect the full screen exited event when the inDOMFullscreen attribute is set and select the url only in this case, r=dao
Differential Revision: https://phabricator.services.mozilla.com/D162857
This commit is contained in:
parent
a5837fc8fa
commit
6f0485ce50
@ -1412,20 +1412,22 @@
|
||||
}
|
||||
};
|
||||
|
||||
if (!window.fullScreen) {
|
||||
selectURL();
|
||||
return;
|
||||
}
|
||||
|
||||
if (newTab.isEmpty) {
|
||||
// Wait until fullscreen has exited since it will
|
||||
// change the selection.
|
||||
// This inDOMFullscreen attribute indicates that the page has something
|
||||
// such as a video in fullscreen mode. Opening a new tab will cancel
|
||||
// fullscreen mode, so we need to wait for that to happen and then
|
||||
// select the url field.
|
||||
if (window.document.documentElement.hasAttribute("inDOMFullscreen")) {
|
||||
window.addEventListener("MozDOMFullscreen:Exited", selectURL, {
|
||||
once: true,
|
||||
wantsUntrusted: false,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (!window.fullScreen || newTab.isEmpty) {
|
||||
selectURL();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Focus the find bar if it was previously focused for that tab.
|
||||
|
@ -30,6 +30,34 @@ add_task(async function() {
|
||||
is(gURLBar.selectionStart, 0, "url is selected");
|
||||
is(gURLBar.selectionEnd, 22, "url is selected");
|
||||
|
||||
// Now check that the url bar is focused when a new tab is opened while in fullscreen.
|
||||
|
||||
let fullScreenEntered = TestUtils.waitForCondition(
|
||||
() => document.documentElement.getAttribute("sizemode") == "fullscreen"
|
||||
);
|
||||
BrowserFullScreen();
|
||||
await fullScreenEntered;
|
||||
|
||||
tab2.linkedBrowser.focus();
|
||||
|
||||
// Open a new tab
|
||||
focusPromise = BrowserTestUtils.waitForEvent(
|
||||
gURLBar.inputField,
|
||||
"focus",
|
||||
true
|
||||
);
|
||||
EventUtils.synthesizeKey("T", { accelKey: true });
|
||||
await focusPromise;
|
||||
|
||||
is(document.activeElement, gURLBar.inputField, "urlbar is focused");
|
||||
|
||||
let fullScreenExited = TestUtils.waitForCondition(
|
||||
() => document.documentElement.getAttribute("sizemode") != "fullscreen"
|
||||
);
|
||||
BrowserFullScreen();
|
||||
await fullScreenExited;
|
||||
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
BrowserTestUtils.removeTab(tab1);
|
||||
BrowserTestUtils.removeTab(tab2);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user