blob: 9244cf3f21a2d04f74bb02288eb48d2b0f1ecc1d [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>Detached use of navigator.xr</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<iframe sandbox="allow-same-origin" id="subframe"></iframe>
<script>
// This behavior is not in the webxr spec, so this is an internal-only test.
promise_test((t) => {
var nav_xr = window.frames[0].navigator.xr;
const dom_exception = window.frames[0].DOMException;
document.getElementById("subframe").remove();
return promise_rejects_dom(t, "InvalidStateError", dom_exception, nav_xr.supportsSession('inline'))
.then(() => promise_rejects_dom(t, "InvalidStateError", dom_exception, nav_xr.requestSession('inline')));
}, "Check that navigator.xr.supportsSession and navigator.xr.requestSession reject on a detached navigator.");
</script>
</body>
</html>