| <!doctype HTML> |
| |
| <!-- |
| Runs an acquireDisplayLock, which suspends the context and schedules |
| a continuation, which should never run. |
| --> |
| |
| <style> |
| #container { |
| contain: content; |
| width: 150px; |
| height: 150px; |
| background: lightblue; |
| } |
| #child { |
| width: 50px; |
| height: 50px; |
| background: red; |
| } |
| </style> |
| |
| <div id="log"></div> |
| |
| <script> |
| if (window.testRunner) |
| window.testRunner.waitUntilDone(); |
| |
| function modifyDom(context) { |
| let child = document.createElement("div"); |
| child.id = "child"; |
| // Append to body directly so it's clear whether this runs or not. |
| document.body.appendChild(child); |
| } |
| |
| function finishTest(status_string) { |
| if (document.getElementById("log").innerHTML === "") |
| document.getElementById("log").innerHTML = status_string; |
| if (window.testRunner) |
| window.testRunner.notifyDone(); |
| } |
| |
| function acquire() { |
| let container = document.createElement("div"); |
| container.id = "container"; |
| container.acquireDisplayLock( |
| (context) => { |
| context.schedule(modifyDom); |
| context.suspend(); |
| }).then( |
| () => { finishTest("FAIL"); }, |
| () => { finishTest("FAIL"); }); |
| document.body.appendChild(container); |
| setTimeout(() => { finishTest("PASS"); }, 50); |
| } |
| |
| window.onload = acquire; |
| </script> |
| |