tor-browser

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

regular-subclassing.js (866B)


      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 es6id: 24.2.2
      5 description: Subclassing the DataView object
      6 info: |
      7  24.2.2 The DataView Constructor
      8 
      9  ...
     10 
     11  The DataView constructor is designed to be subclassable. It may be used as the
     12  value of an extends clause of a class definition. Subclass constructors that
     13  intend to inherit the specified DataView behaviour must include a super call
     14  to the DataView constructor to create and initialize subclass instances with
     15  the internal state necessary to support the DataView.prototype built-in
     16  methods.
     17 ---*/
     18 
     19 class DV extends DataView {}
     20 
     21 var buffer = new ArrayBuffer(1);
     22 
     23 var dv = new DV(buffer);
     24 assert.sameValue(dv.buffer, buffer);
     25 
     26 assert.throws(TypeError, function() {
     27  new DV();
     28 });
     29 
     30 reportCompare(0, 0);