options-non-object.js (1449B)
1 // |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally 2 // Copyright (C) 2021 the V8 project authors. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 /*--- 5 esid: sec-sharedarraybuffer-constructor 6 description: Invoked with a non-object value for options 7 info: | 8 SharedArrayBuffer( length [ , options ] ) 9 10 1. If NewTarget is undefined, throw a TypeError exception. 11 2. Let byteLength be ? ToIndex(length). 12 3. Let requestedMaxByteLength be ? GetArrayBufferMaxByteLengthOption(options). 13 4. If requestedMaxByteLength is empty, then 14 a. Return ? AllocateArrayBuffer(NewTarget, byteLength). 15 16 1.1.5 GetArrayBufferMaxByteLengthOption ( options ) 17 18 1. If Type(options) is not Object, return empty. 19 features: [BigInt, SharedArrayBuffer, Symbol, resizable-arraybuffer] 20 ---*/ 21 22 assert.sameValue(new SharedArrayBuffer(0, null).growable, false, 'null'); 23 assert.sameValue(new SharedArrayBuffer(0, true).growable, false, 'boolean'); 24 assert.sameValue(new SharedArrayBuffer(0, Symbol(3)).growable, false, 'symbol'); 25 assert.sameValue(new SharedArrayBuffer(0, 1n).growable, false, 'bigint'); 26 assert.sameValue(new SharedArrayBuffer(0, 'string').growable, false, 'string'); 27 assert.sameValue(new SharedArrayBuffer(0, 9).growable, false, 'number'); 28 assert.sameValue(new SharedArrayBuffer(0, undefined).growable, false, 'undefined'); 29 30 reportCompare(0, 0);