Update Atomics.exchange to allow non-shared buffers

Follow-up for: https://github.com/tc39/test262/pull/2633
This commit is contained in:
André Bargull 2020-06-25 05:41:23 -07:00 committed by Rick Waldron
parent 51e73466ee
commit 836f609b08

View File

@ -4,16 +4,16 @@
/*--- /*---
esid: sec-atomics.exchange esid: sec-atomics.exchange
description: > description: >
Test Atomics.exchange on non-shared integer TypedArrays Atomics.exchange throws when operating on non-sharable integer TypedArrays
includes: [testTypedArray.js] includes: [testTypedArray.js]
features: [ArrayBuffer, Atomics, TypedArray] features: [ArrayBuffer, Atomics, TypedArray]
---*/ ---*/
var buffer = new ArrayBuffer(16); testWithNonAtomicsFriendlyTypedArrayConstructors(TA => {
var views = intArrayConstructors.slice(); const buffer = new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4);
const view = new TA(buffer);
testWithTypedArrayConstructors(function(TA) {
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Atomics.exchange(new TA(buffer), 0, 0); Atomics.exchange(view, 0, 0);
}, '`Atomics.exchange(new TA(buffer), 0, 0)` throws TypeError'); }, `Atomics.exchange(new ${TA.name}(buffer), 0, 0) throws TypeError`);
}, views); });