Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Errors

"use strict";
add_task(async () => {
function httpURL(filename, host = "https://example.com/") {
let root = getRootDirectory(gTestPath).replace(
host
);
return root + filename;
}
await SpecialPowers.pushPrefEnv({
set: [["dom.meta-viewport.enabled", true]],
});
const fissionWindow = await BrowserTestUtils.openNewBrowserWindow({
fission: true,
});
const url = httpURL(
"test_visual_viewport_in_oopif.html",
);
const crossOriginIframeUrl = httpURL("visual_viewport_in_child.html");
try {
await BrowserTestUtils.withNewTab(
{ gBrowser: fissionWindow.gBrowser, url },
async browser => {
await SpecialPowers.spawn(
browser,
[crossOriginIframeUrl],
async iframeUrl => {
const iframe = content.document.getElementById("iframe");
iframe.setAttribute("src", iframeUrl);
let { width, height } = await new Promise(resolve => {
content.window.addEventListener("message", msg => {
resolve(msg.data);
});
});
is(
width,
300,
"visualViewport.width shouldn't be affected in out-of-process iframes"
);
is(
height,
300,
"visualViewport.height shouldn't be affected in out-of-process iframes"
);
}
);
}
);
} finally {
await BrowserTestUtils.closeWindow(fissionWindow);
}
});