<!DOCTYPE html>
<title>navigator.subApp API test</title>
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/utils.js"></script>
<script src="/speculation-rules/prerender/resources/utils.js"></script>
<body>
<script>
promise_test(async () => {
const uid = token();
const bc = new PrerenderChannel('prerender-channel', uid);
const gotMessage = new Promise(resolve => {
bc.addEventListener('message', e => {
resolve(e.data);
}, {
once: true
});
});
startPrerendering(`resources/subapp.html?uid=${uid}`);
const result = await gotMessage;
assert_equals(result, 'TypeError');
}, 'prerendering pages should not be able to access subapp API.');
</script>