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:
- /idle-detection/idle-detection-detached-frame.https.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<body>
<script src=/resources/testdriver.js></script>
<script src=/resources/testdriver-vendor.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
'use strict';
promise_test(async t => {
await new Promise((resolve) => {
window.addEventListener('load', resolve);
});
await test_driver.set_permission({name: 'idle-detection'}, 'granted');
const frame = document.body.appendChild(document.createElement('iframe'));
const frameIdleDetector = frame.contentWindow.IdleDetector;
const frameDOMException = frame.contentWindow.DOMException;
let detector = new frameIdleDetector();
document.body.outerHTML = "";
await promise_rejects_dom(t, 'InvalidStateError', frameDOMException,
frameIdleDetector.requestPermission());
await promise_rejects_dom(t, 'InvalidStateError', frameDOMException, detector.start());
detector = new frameIdleDetector();
await promise_rejects_dom(t, 'InvalidStateError', frameDOMException, detector.start());
}, 'Using an IdleDetector from a detached frame');
</script>