blob: 5c2562946b774f24c5c64279efb69d2106c87083 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script>
"use strict";
Promise.resolve().then(async () => {
test_driver.set_test_context(window.parent);
await test_driver.set_permission({ name: 'screen-wake-lock' }, 'granted');
try {
const wakeLock = await navigator.wakeLock.request("screen");
window.parent.postMessage({ type: 'availability-result', enabled: true }, "*");
await wakeLock.release();
} catch (e) {
if (e instanceof DOMException && e.name === "NotAllowedError") {
window.parent.postMessage({ type: 'availability-result', enabled: false }, "*");
} else {
throw e;
}
}
});
</script>
|