summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/portals/resources/open-blank-host.js
blob: f7580bd15212234c36b55a368efa0c729bd64e5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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;
}