2018-05-21 20:55:47 +02:00
|
|
|
// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
|
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
|
|
|
|
/*---
|
2018-06-28 22:13:01 +02:00
|
|
|
esid: sec-atomics.notify
|
2018-05-21 20:55:47 +02:00
|
|
|
description: >
|
2018-06-28 22:15:01 +02:00
|
|
|
Test Atomics.notify on non-shared integer TypedArrays
|
2018-05-21 20:55:47 +02:00
|
|
|
features: [Atomics, SharedArrayBuffer, TypedArray]
|
|
|
|
---*/
|
|
|
|
|
2018-06-26 20:40:00 +02:00
|
|
|
const sab = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4);
|
2018-05-21 20:55:47 +02:00
|
|
|
|
|
|
|
const poisoned = {
|
|
|
|
valueOf: function() {
|
|
|
|
throw new Test262Error('should not evaluate this code');
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
assert.throws(TypeError, function() {
|
2018-06-28 22:15:01 +02:00
|
|
|
Atomics.notify(new Int16Array(sab), poisoned, poisoned);
|
|
|
|
}, '`Atomics.notify(new Int16Array(sab), poisoned, poisoned)` throws TypeError');
|
2018-05-21 20:55:47 +02:00
|
|
|
|
|
|
|
assert.throws(TypeError, function() {
|
2018-06-28 22:15:01 +02:00
|
|
|
Atomics.notify(new Int8Array(sab), poisoned, poisoned);
|
|
|
|
}, '`Atomics.notify(new Int8Array(sab), poisoned, poisoned)` throws TypeError');
|
2018-05-21 20:55:47 +02:00
|
|
|
|
|
|
|
assert.throws(TypeError, function() {
|
2018-06-28 22:15:01 +02:00
|
|
|
Atomics.notify(new Uint32Array(sab), poisoned, poisoned);
|
|
|
|
}, '`Atomics.notify(new Uint32Array(sab), poisoned, poisoned)` throws TypeError');
|
2018-05-21 20:55:47 +02:00
|
|
|
|
|
|
|
assert.throws(TypeError, function() {
|
2018-06-28 22:15:01 +02:00
|
|
|
Atomics.notify(new Uint16Array(sab), poisoned, poisoned);
|
|
|
|
}, '`Atomics.notify(new Uint16Array(sab), poisoned, poisoned)` throws TypeError');
|
2018-05-21 20:55:47 +02:00
|
|
|
|
|
|
|
assert.throws(TypeError, function() {
|
2018-06-28 22:15:01 +02:00
|
|
|
Atomics.notify(new Uint8Array(sab), poisoned, poisoned);
|
|
|
|
}, '`Atomics.notify(new Uint8Array(sab), poisoned, poisoned)` throws TypeError');
|
2018-05-21 20:55:47 +02:00
|
|
|
|
|
|
|
assert.throws(TypeError, function() {
|
2018-06-28 22:15:01 +02:00
|
|
|
Atomics.notify(new Uint8ClampedArray(sab), poisoned, poisoned);
|
|
|
|
}, '`Atomics.notify(new Uint8ClampedArray(sab), poisoned, poisoned)` throws TypeError');
|