forked from mirrors/gecko-dev
Bug 1827202: Make a fullscreen test await focus before requesting fullscreen. r=edgar
This ensures that the browsing context is active before the fullscreen request, which prevents a common reason for promise rejection. It also changes the parameter order for the click count check function. This makes the failure message make sense, since the "expected" value is the second parameter. Differential Revision: https://phabricator.services.mozilla.com/D182379
This commit is contained in:
parent
b0541db065
commit
9e6f0307fb
1 changed files with 5 additions and 3 deletions
|
|
@ -25,15 +25,17 @@ button.addEventListener("click", function(e) {
|
|||
clickCount++;
|
||||
if (shouldEnterFullscreen) {
|
||||
const fullscreenElement = document.getElementById("fullscreen");
|
||||
fullscreenElement.focus();
|
||||
lastFullscreenPromise = fullscreenElement.requestFullscreen();
|
||||
lastFullscreenPromise = SimpleTest.promiseFocus().then(() => {
|
||||
fullscreenElement.focus();
|
||||
return fullscreenElement.requestFullscreen();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function clickButton(expectEvent) {
|
||||
let lastClickCount = clickCount;
|
||||
synthesizeMouseAtCenter(button, {});
|
||||
(expectEvent ? isnot : is)(lastClickCount, clickCount, `Should've ${expectEvent ? "" : "not "}been able to click`);
|
||||
(expectEvent ? isnot : is)(clickCount, lastClickCount, `Should've ${expectEvent ? "" : "not "}been able to click`);
|
||||
}
|
||||
|
||||
function enterFullscreen() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue