Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/workers/worker-atomics-wait.html

Issue 2660423003: Atomics.wait throws when called on the main thread. (Closed)
Patch Set: nit Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698