tor-browser

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

class-definition-parent-proto-null.js (592B)


      1 // Copyright (C) 2016 Kevin Gibbons. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 esid: sec-runtime-semantics-classdefinitionevaluation
      5 description: A class which extends a constructor with null .prototype is a derived class.
      6 ---*/
      7 
      8 var invoked = false;
      9 var instance, savedArg;
     10 
     11 function A(arg) {
     12  invoked = true;
     13  savedArg = arg;
     14  this.prop = 0;
     15 }
     16 A.prototype = null;
     17 
     18 class C extends A {}
     19 
     20 instance = new C(1);
     21 
     22 assert.sameValue(invoked, true);
     23 assert.sameValue(savedArg, 1);
     24 assert.sameValue(instance.prop, 0);
     25 
     26 reportCompare(0, 0);