blob: 5a90f59addccc793ad23066178ae0503246f7ea0 [file] [log] [blame]
<!doctype HTML>
<!--
Runs an acquireDisplayLock, the callback throws.
-->
<style>
#container {
contain: content;
width: 100px;
height: 100px;
background: lightblue;
}
</style>
<div id="log"></div>
<script>
if (window.testRunner)
window.testRunner.waitUntilDone();
function throwingFunction(context) {
throw "Expected Exception";
}
function finishTest(status_string, to_remove) {
if (document.getElementById("log").innerHTML === "")
document.getElementById("log").innerHTML = status_string;
if (to_remove)
to_remove.remove();
if (window.testRunner)
window.testRunner.notifyDone();
}
function acquire() {
let container = document.createElement("div");
container.id = "container";
container.acquireDisplayLock(throwingFunction).then(
() => { finishTest("FAIL"); },
() => { finishTest("PASS", container); });
document.body.appendChild(container);
}
window.onload = acquire;
</script>