OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <body> |
| 4 <p>Test that Atomics.wait is not allowed on the main thread.</p> |
| 5 <div id="result"></div> |
| 6 <script type="text/javascript"> |
| 7 function log(message) |
| 8 { |
| 9 document.getElementById("result").innerHTML += message + "</br>"; |
| 10 } |
| 11 |
| 12 if (window.testRunner) { |
| 13 testRunner.dumpAsText(); |
| 14 testRunner.waitUntilDone(); |
| 15 } |
| 16 |
| 17 if (window.internals && internals.runtimeFlags.sharedArrayBufferEnabled && windo
w.SharedArrayBuffer) { |
| 18 var view = new Int32Array(new SharedArrayBuffer(4)); |
| 19 try { |
| 20 Atomics.wait(view, 0, 0, 0); |
| 21 log("FAIL: Calling Atomics.wait on the main thread did not throw."); |
| 22 } catch (e) { |
| 23 log("PASS: Calling Atomics.wait on the main thread throws."); |
| 24 } |
| 25 |
| 26 var worker = new Worker('resources/worker-atomics-wait.js'); |
| 27 worker.postMessage(view); |
| 28 |
| 29 worker.onmessage = function(e) { |
| 30 log(e.data); |
| 31 if (e.data == 'DONE') { |
| 32 if (window.testRunner) |
| 33 testRunner.notifyDone(); |
| 34 } |
| 35 }; |
| 36 } else { |
| 37 log("SharedArrayBuffers are not enabled -- skipping test."); |
| 38 if (window.testRunner) |
| 39 testRunner.notifyDone(); |
| 40 } |
| 41 |
| 42 </script> |
| 43 </body> |
| 44 </html> |
| 45 |
OLD | NEW |