Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /screen-wake-lock/wakelock-released.https.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<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>
promise_test(async t => {
await test_driver.set_permission({ name: 'screen-wake-lock' }, 'granted');
const lock = await navigator.wakeLock.request("screen");
assert_false(lock.released, "lock.released must be false on creation");
lock.onrelease = t.step_func(() => {
assert_true(lock.released, "WakeLockSentinel.released is true in an onrelease event handler");
});
await lock.release();
assert_true(lock.released, "WakeLockSentinel.released remains true outside the event handler");
}, "The released attribute inside an event handler");
</script>