Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 3 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /subapps/list-error.tentative.https.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>Sub Apps: Error cases for list()</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="resources/subapps-helpers.js"></script>
<body></body>
<script>
promise_test(async t => {
const iframe = document.createElement('iframe');
document.body.appendChild(iframe);
const subApps = iframe.contentWindow.subApps;
const DOMException_constructor = iframe.contentWindow.DOMException;
iframe.remove();
// At this point the iframe is detached and unloaded, and its execution
// context is gone.
await promise_rejects_dom(t, 'OperationError', DOMException_constructor, subApps.list());
}, "The object is no longer associated to a document.");
promise_test(async t => {
const iframe = document.createElement('iframe');
document.body.appendChild(iframe);
const iframeDOMException = iframe.contentWindow.DOMException;
t.add_cleanup(() => iframe.remove());
await promise_rejects_dom(t, 'NotSupportedError', iframeDOMException, iframe.contentWindow.subApps.list());
}, "API is only supported in top-level browsing contexts.");
</script>