summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/portals/no-portal-in-sandboxed-popup.html
blob: b26b836467a31ea5e4720559e8081b4a0c39c9e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!DOCTYPE html>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>

promise_test(async t => {
  let sandboxFlags = 'allow-scripts allow-same-origin';
  let w = window.open(`resources/attempt-portal-load.html?pipe=header(Content-Security-Policy,sandbox ${sandboxFlags})`);
  await new Promise((resolve, reject) => w.addEventListener('load', resolve));
  let result = await Promise.race([
      w.portalLoaded.then(() => 'loaded'),
      new Promise(resolve => t.step_timeout(() => resolve('timed out'), 5000))]);
  assert_equals(result, 'timed out', 'expected portal not to load due to sandbox flags');
});
</script>
</body>