tor-browser

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

poisoned-underscore-proto.js (697B)


      1 // Copyright (C) 2019 Alexey Shvayka. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 esid: prod-ClassExpression
      5 description: >
      6  ClassExpression should directly set [[Prototype]] internal slot.
      7 info: |
      8  ClassDefinitionEvaluation
      9 
     10  [...]
     11  7. Let proto be ObjectCreate(protoParent).
     12 
     13  ObjectCreate ( proto [ , internalSlotsList ] )
     14 
     15  [...]
     16  4. Set obj.[[Prototype]] to proto.
     17 features: [class, __proto__]
     18 ---*/
     19 
     20 Object.defineProperty(Object.prototype, '__proto__', {
     21  set: function() {
     22    throw new Test262Error('should not be called');
     23  },
     24 });
     25 
     26 var A = class extends Array {};
     27 
     28 assert.sameValue(new A(1).length, 1);
     29 
     30 reportCompare(0, 0);