1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
4 esid: sec-integer-indexed-exotic-objects-set-p-v-receiver
6 Returns false if key has a numeric index and object has a detached buffer
8 [[Set]] ( P, V, Receiver)
11 If Type(P) is String, then
12 Let numericIndex be ! CanonicalNumericIndexString(P).
13 If numericIndex is not undefined, then
14 Return ? IntegerIndexedElementSet(O, numericIndex, V).
17 IntegerIndexedElementSet ( O, index, value )
19 Assert: O is an Integer-Indexed exotic object.
20 Assert: Type(index) is Number.
21 If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value).
22 Otherwise, let numValue be ? ToNumber(value).
23 Let buffer be O.[[ViewedArrayBuffer]].
24 If IsDetachedBuffer(buffer) is true, return false.
26 includes: [testTypedArray.js, detachArrayBuffer.js]
27 features: [align-detached-buffer-semantics-with-web-reality, TypedArray]
29 testWithTypedArrayConstructors(function(TA) {
30 let sample = new TA([42]);
31 $DETACHBUFFER(sample.buffer);
34 assert.sameValue(sample[0], undefined, '`sample[0] = 1` is undefined');
36 assert.sameValue(sample['1.1'], undefined, '`sample[\'1.1\'] = 1` is undefined');
38 assert.sameValue(sample['-0'], undefined, '`sample[\'-0\'] = 1` is undefined');
40 assert.sameValue(sample['-1'], undefined, '`sample[\'-1\'] = 1` is undefined');
42 assert.sameValue(sample['1'], undefined, '`sample[\'1\'] = 1` is undefined');
44 assert.sameValue(sample['2'], undefined, '`sample[\'2\'] = 1` is undefined');
48 throw new Test262Error();
52 assert.throws(Test262Error, function() {