tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

custom-proto-access-throws.js (1244B)


      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.
      3 
      4 /*---
      5 esid: sec-dataview-buffer-byteoffset-bytelength
      6 description: >
      7  Return abrupt from newTarget's custom constructor prototype
      8 info: |
      9  24.2.2.1 DataView (buffer, byteOffset, byteLength )
     10 
     11  ...
     12  12. Let O be ? OrdinaryCreateFromConstructor(NewTarget, "%DataViewPrototype%",
     13  « [[DataView]], [[ViewedArrayBuffer]], [[ByteLength]], [[ByteOffset]] »).
     14  ...
     15  17. Return O.
     16 
     17  9.1.13 OrdinaryCreateFromConstructor ( constructor, intrinsicDefaultProto [ ,
     18  internalSlotsList ] )
     19 
     20  ...
     21  2. Let proto be ? GetPrototypeFromConstructor(constructor,
     22  intrinsicDefaultProto).
     23  3. Return ObjectCreate(proto, internalSlotsList).
     24 
     25  9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto )
     26 
     27  ...
     28  3. Let proto be ? Get(constructor, "prototype").
     29  ...
     30 features: [Reflect.construct]
     31 ---*/
     32 
     33 var buffer = new ArrayBuffer(8);
     34 
     35 var newTarget = function() {}.bind(null);
     36 Object.defineProperty(newTarget, "prototype", {
     37  get() {
     38    throw new Test262Error();
     39  }
     40 });
     41 
     42 assert.throws(Test262Error, function() {
     43  Reflect.construct(DataView, [buffer, 0], newTarget);
     44 });
     45 
     46 reportCompare(0, 0);