custom-proto-access-throws-sab.js (1449B)
1 // |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally 2 // Copyright (C) 2016 the V8 project authors. 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-dataview-buffer-byteoffset-bytelength 8 description: > 9 Return abrupt from newTarget's custom constructor prototype 10 info: | 11 24.2.2.1 DataView (buffer, byteOffset, byteLength ) 12 13 ... 14 12. Let O be ? OrdinaryCreateFromConstructor(NewTarget, "%DataViewPrototype%", 15 « [[DataView]], [[ViewedArrayBuffer]], [[ByteLength]], [[ByteOffset]] »). 16 ... 17 17. Return O. 18 19 9.1.13 OrdinaryCreateFromConstructor ( constructor, intrinsicDefaultProto [ , 20 internalSlotsList ] ) 21 22 ... 23 2. Let proto be ? GetPrototypeFromConstructor(constructor, 24 intrinsicDefaultProto). 25 3. Return ObjectCreate(proto, internalSlotsList). 26 27 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto ) 28 29 ... 30 3. Let proto be ? Get(constructor, "prototype"). 31 ... 32 features: [Reflect.construct, SharedArrayBuffer] 33 ---*/ 34 35 var buffer = new SharedArrayBuffer(8); 36 37 var newTarget = function() {}.bind(null); 38 Object.defineProperty(newTarget, "prototype", { 39 get() { 40 throw new Test262Error(); 41 } 42 }); 43 44 assert.throws(Test262Error, function() { 45 Reflect.construct(DataView, [buffer, 0], newTarget); 46 }); 47 48 reportCompare(0, 0);