tor-browser

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

prop-poisoned-underscore-proto.js (874B)


      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-SuperProperty
      5 description: >
      6  SuperProperty should directly call [[GetPrototypeOf]] internal method.
      7 info: |
      8  MakeSuperPropertyReference ( actualThis, propertyKey, strict )
      9 
     10  [...]
     11  3. Let baseValue be ? env.GetSuperBase().
     12 
     13  GetSuperBase ( )
     14 
     15  [...]
     16  5. Return ? home.[[GetPrototypeOf]]().
     17 ---*/
     18 
     19 Object.defineProperty(Object.prototype, '__proto__', {
     20  get: function() {
     21    throw new Test262Error('should not be called');
     22  },
     23 });
     24 
     25 var obj = {
     26  superExpression() {
     27    return super['CONSTRUCTOR'.toLowerCase()];
     28  },
     29  superIdentifierName() {
     30    return super.toString();
     31  },
     32 };
     33 
     34 assert.sameValue(obj.superExpression(), Object);
     35 assert.sameValue(obj.superIdentifierName(), '[object Object]');
     36 
     37 reportCompare(0, 0);