blob: 43c92b170abf2f6b7ff7b3b69ab76d1e483bf433 [file] [log] [blame]
<!doctype HTML>
<!--
Runs an acquire(), then update(), then removes the element, and calls commit.
Update promise should reject.
-->
<style>
#container {
contain: style layout;
width: 100px;
height: 100px;
background: lightblue;
}
</style>
<div id="log"></div>
<script>
// TODO(vmpstr): In WPT this needs to be replaced with reftest-wait.
if (window.testRunner)
window.testRunner.waitUntilDone();
function finishTest(status_string) {
if (document.getElementById("log").innerHTML === "")
document.getElementById("log").innerHTML = status_string;
if (window.testRunner)
window.testRunner.notifyDone();
}
function runTest() {
let container = document.createElement("div");
container.id = "container";
container.displayLock.acquire({ timeout: Infinity }).then(() => {
document.body.appendChild(container);
container.displayLock.update().then(
() => { finishTest("FAIL"); },
(e) => {
document.body.appendChild(container);
finishTest("PASS " + e.message);
});
container.remove();
container.displayLock.commit();
});
}
window.onload = runTest;
</script>