summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/speculation-rules/prerender/resources/presentation-request.html
blob: 62829556bb438c1396a0f17c7e3b45456f2bdad9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>

assert_true(document.prerendering);

async function startPresentationRequest() {
  const bc = new PrerenderChannel('prerender-channel');
  const presentationRequest = new PresentationRequest(
      'https://example.com/presentation.html');

  try {
    const _ = await presentationRequest.start();
    bc.postMessage('unexpected success');
  } catch (err) {
    bc.postMessage('request failed');
  } finally {
    bc.close();
  }
}

startPresentationRequest();

</script>