Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /css/css-view-transitions/transition-in-removed-iframe.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html>
<head>
<title>View transitions: startViewTransition in a removed iframe</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
promise_test(async t => {
assert_implements(document.startViewTransition, "Missing document.startViewTransition");
let iframe = document.createElement("iframe");
document.body.appendChild(iframe);
let doc = iframe.contentDocument;
// Remove the iframe, detaching the document.
iframe.remove();
// startViewTransition should return a valid ViewTransition object, not null.
let transition = doc.startViewTransition(() => {});
assert_not_equals(transition, null, "startViewTransition should not return null");
assert_equals(Object.prototype.toString.call(transition), "[object ViewTransition]", "should return a ViewTransition object");
// ready promise should be a valid promise and reject with AbortError.
try {
await transition.ready;
assert_unreached("ready promise should have rejected");
} catch (e) {
assert_equals(e.name, "AbortError", "ready promise should reject with AbortError");
}
// finished promise should be a valid promise and resolve successfully.
await transition.finished;
}, "A view transition in a removed iframe should return a skipped transition object and not return null");
</script>
</body>
</html>