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 Throws a TypeError if key has a numeric index and object has a detached
7 buffer (honoring the Realm of the current execution context)
9 9.4.5.5 [[Set]] ( P, V, Receiver)
12 2. If Type(P) is String, then
13 a. Let numericIndex be ! CanonicalNumericIndexString(P).
14 b. If numericIndex is not undefined, then
15 i. Perform ? IntegerIndexedElementSet(O, numericIndex, V).
19 IntegerIndexedElementSet ( O, index, value )
21 Assert: O is an Integer-Indexed exotic object.
22 Assert: Type(index) is Number.
23 If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value).
24 Otherwise, let numValue be ? ToNumber(value).
25 Let buffer be O.[[ViewedArrayBuffer]].
26 If IsDetachedBuffer(buffer) is true, return false.
28 includes: [testTypedArray.js, detachArrayBuffer.js]
29 features: [align-detached-buffer-semantics-with-web-reality, cross-realm, TypedArray]
32 let other = $262.createRealm().global;
33 testWithTypedArrayConstructors(function(TA) {
34 let OtherTA = other[TA.name];
35 let sample = new OtherTA(1);
36 $DETACHBUFFER(sample.buffer);
38 assert.sameValue(sample[0], undefined, '`sample[0]` is undefined');