summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/portals/resources/open-blank-host.js
diff options
context:
space:
mode:
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;
+}