summaryrefslogtreecommitdiffstats
path: root/layout/base/tests/browser_visual_viewport_iframe.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /layout/base/tests/browser_visual_viewport_iframe.js
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/base/tests/browser_visual_viewport_iframe.js')
-rw-r--r--layout/base/tests/browser_visual_viewport_iframe.js59
1 files changed, 59 insertions, 0 deletions
diff --git a/layout/base/tests/browser_visual_viewport_iframe.js b/layout/base/tests/browser_visual_viewport_iframe.js
new file mode 100644
index 0000000000..849ab53caa
--- /dev/null
+++ b/layout/base/tests/browser_visual_viewport_iframe.js
@@ -0,0 +1,59 @@
+"use strict";
+
+add_task(async () => {
+ function httpURL(filename, host = "https://example.com/") {
+ let root = getRootDirectory(gTestPath).replace(
+ "chrome://mochitests/content/",
+ 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",
+ "http://mochi.test:8888/"
+ );
+ 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);
+ }
+});