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

Unified 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, 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/workers/worker-atomics-wait.html
diff --git a/third_party/WebKit/LayoutTests/fast/workers/worker-atomics-wait.html b/third_party/WebKit/LayoutTests/fast/workers/worker-atomics-wait.html
new file mode 100644
index 0000000000000000000000000000000000000000..bd470361f05f556c164d738ae05ba524456ea8e4
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/workers/worker-atomics-wait.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>Test that Atomics.wait is not allowed on the main thread.</p>
+<div id="result"></div>
+<script type="text/javascript">
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "</br>";
+}
+
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+
+if (window.internals && internals.runtimeFlags.sharedArrayBufferEnabled && window.SharedArrayBuffer) {
+ var view = new Int32Array(new SharedArrayBuffer(4));
+ try {
+ Atomics.wait(view, 0, 0, 0);
+ log("FAIL: Calling Atomics.wait on the main thread did not throw.");
+ } catch (e) {
+ log("PASS: Calling Atomics.wait on the main thread throws.");
+ }
+
+ var worker = new Worker('resources/worker-atomics-wait.js');
+ worker.postMessage(view);
+
+ worker.onmessage = function(e) {
+ log(e.data);
+ if (e.data == 'DONE') {
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }
+ };
+} else {
+ log("SharedArrayBuffers are not enabled -- skipping test.");
+ if (window.testRunner)
+ testRunner.notifyDone();
+}
+
+</script>
+</body>
+</html>
+

Powered by Google App Engine
This is Rietveld 408576698