blob: 08b49130c46efcb5ee5a0bc36edfe8e669b2edd1 [file] [edit]
<!DOCTYPE html>
<html>
<body>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
setTimeout(() => testRunner.notifyDone(), 3000);
}
onmessage = () => {
result.textContent = 'PASS';
if (window.testRunner)
testRunner.notifyDone();
}
</script>
<p>This tests acquiring a web lock in srcdoc with sandbox attribute. You should see PASS below</p>
<div id="result">Running</div>
<iframe sandbox="allow-scripts" srcdoc="
<!DOCTYPE html>
<script>
navigator.locks.request('abc', {mode: 'shared'}, () => {
top.postMessage('FAIL - Lock acquired', '*');
}).then(
() => top.postMessage('FAIL - Promise resolved', '*'),
() => top.postMessage('PASS', '*'))
</script>"></iframe>
</body>
</html>