summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/portals/resources/open-blank-host.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 /testing/web-platform/tests/portals/resources/open-blank-host.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 'testing/web-platform/tests/portals/resources/open-blank-host.js')
-rw-r--r--testing/web-platform/tests/portals/resources/open-blank-host.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/testing/web-platform/tests/portals/resources/open-blank-host.js b/testing/web-platform/tests/portals/resources/open-blank-host.js
new file mode 100644
index 0000000000..f7580bd152
--- /dev/null
+++ b/testing/web-platform/tests/portals/resources/open-blank-host.js
@@ -0,0 +1,14 @@
+// Portal tests often need to create portals in a context other than the one
+// in which the tests are running. This is because the host context may be
+// discarded during the course of the test.
+
+// Opens a blank page for use as a portal host.
+// Tests cannot simply use window.open() without a URL as about:blank may not
+// host a portal.
+async function openBlankPortalHost() {
+ let hostWindow = window.open('/portals/resources/blank-host.html');
+ await new Promise((resolve) => {
+ hostWindow.addEventListener('load', resolve, {once: true});
+ });
+ return hostWindow;
+}