blob: 50a8a3b822e295b523794140cfbbb23cf280f625 [file] [edit]
<!DOCTYPE html>
<html>
<body>
<p>This tests acquiring a web lock in blob URL. You should see PASS below</p>
<div id="result">Running</div>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
setTimeout(() => testRunner.notifyDone(), 3000);
}
onmessage = (message) => {
result.textContent = message.data;
if (window.testRunner)
testRunner.notifyDone();
}
const blob = new Blob([`<!DOCTYPE html><script>
navigator.locks.request('abc', {mode: 'shared'}, () => {
top.postMessage('PASS', '*');
});
<` + '/script>'], {type: "text/html"});
const iframe = document.createElement('iframe');
document.body.appendChild(iframe);
iframe.src = URL.createObjectURL(blob);
</script>
</body>
</html>