undefined-newtarget-throws.js (811B)
1 // |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally 2 // Copyright (C) 2015 André Bargull. All rights reserved. 3 // Copyright (C) 2017 Mozilla Corporation. All rights reserved. 4 // This code is governed by the BSD license found in the LICENSE file. 5 6 /*--- 7 esid: sec-sharedarraybuffer-length 8 description: > 9 Throws a TypeError if SharedArrayBuffer is called as a function. 10 info: | 11 SharedArrayBuffer( length ) 12 13 SharedArrayBuffer called with argument length performs the following steps: 14 15 1. If NewTarget is undefined, throw a TypeError exception. 16 ... 17 features: [SharedArrayBuffer] 18 ---*/ 19 20 assert.throws(TypeError, function() { 21 SharedArrayBuffer(); 22 }); 23 24 assert.throws(TypeError, function() { 25 SharedArrayBuffer(10); 26 }); 27 28 reportCompare(0, 0);