зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1832195 - Update browser_fullscreen_exit_on_external_protocol.js. r=edgar
Due to previous fix, I need to update `browser_fullscreen_exit_on_external_protocol.js` since internal fullscreen event isn't dispatched before request is canceled. Also, I add one more test for cancelling fullscreen during transition. Differential Revision: https://phabricator.services.mozilla.com/D181955
This commit is contained in:
Родитель
f372e65bca
Коммит
ebe1fb9eac
|
@ -97,7 +97,8 @@ function setupMailHandler() {
|
|||
|
||||
add_task(setupMailHandler);
|
||||
|
||||
add_task(async function OpenExternalProtocolOnPendingFullscreen() {
|
||||
// Fullscreen is canceled during fullscreen transition
|
||||
add_task(async function OpenExternalProtocolOnPendingLaterFullscreen() {
|
||||
for (const useClick of [true, false]) {
|
||||
await BrowserTestUtils.withNewTab(CONTENT, async browser => {
|
||||
const leavelFullscreen = waitForFullscreenState(document, false, true);
|
||||
|
@ -108,17 +109,23 @@ add_task(async function OpenExternalProtocolOnPendingFullscreen() {
|
|||
const button = content.document.querySelector("button");
|
||||
|
||||
const clickDone = new Promise(r => {
|
||||
button.addEventListener("click", function () {
|
||||
content.document.documentElement.requestFullscreen();
|
||||
// When anchor.click() is called, the fullscreen request
|
||||
// is probably still pending.
|
||||
if (shouldClick) {
|
||||
content.document.querySelector("a").click();
|
||||
} else {
|
||||
content.document.location = "mailto:test@example.com";
|
||||
}
|
||||
r();
|
||||
});
|
||||
button.addEventListener(
|
||||
"click",
|
||||
function () {
|
||||
content.document.documentElement.requestFullscreen();
|
||||
// When anchor.click() is called, the fullscreen request
|
||||
// is probably still pending.
|
||||
content.setTimeout(() => {
|
||||
if (shouldClick) {
|
||||
content.document.querySelector("a").click();
|
||||
} else {
|
||||
content.document.location = "mailto:test@example.com";
|
||||
}
|
||||
r();
|
||||
}, 0);
|
||||
},
|
||||
{ once: true }
|
||||
);
|
||||
});
|
||||
button.click();
|
||||
await clickDone;
|
||||
|
@ -131,6 +138,50 @@ add_task(async function OpenExternalProtocolOnPendingFullscreen() {
|
|||
}
|
||||
});
|
||||
|
||||
// Fullscreen is canceled immediately.
|
||||
add_task(async function OpenExternalProtocolOnPendingFullscreen() {
|
||||
for (const useClick of [true, false]) {
|
||||
await BrowserTestUtils.withNewTab(CONTENT, async browser => {
|
||||
await SpecialPowers.spawn(
|
||||
browser,
|
||||
[useClick],
|
||||
async function (shouldClick) {
|
||||
const button = content.document.querySelector("button");
|
||||
|
||||
const clickDone = new Promise(r => {
|
||||
button.addEventListener(
|
||||
"click",
|
||||
function () {
|
||||
content.document.documentElement
|
||||
.requestFullscreen()
|
||||
.then(() => {
|
||||
ok(false, "Don't enter fullscreen");
|
||||
})
|
||||
.catch(() => {
|
||||
ok(true, "Cancel entering fullscreen");
|
||||
r();
|
||||
});
|
||||
// When anchor.click() is called, the fullscreen request
|
||||
// is probably still pending.
|
||||
if (shouldClick) {
|
||||
content.document.querySelector("a").click();
|
||||
} else {
|
||||
content.document.location = "mailto:test@example.com";
|
||||
}
|
||||
},
|
||||
{ once: true }
|
||||
);
|
||||
});
|
||||
button.click();
|
||||
await clickDone;
|
||||
}
|
||||
);
|
||||
|
||||
ok(true, "Fullscreen should be exited");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
add_task(async function OpenExternalProtocolOnFullscreen() {
|
||||
for (const useClick of [true, false]) {
|
||||
await BrowserTestUtils.withNewTab(CONTENT, async browser => {
|
||||
|
|
Загрузка…
Ссылка в новой задаче