tor-browser

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

proto-from-ctor-realm.js (924B)


      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 esid: sec-set-iterable
      5 description: Default [[Prototype]] value derived from realm of the newTarget
      6 info: |
      7    [...]
      8    2. Let set be ? OrdinaryCreateFromConstructor(NewTarget, "%SetPrototype%",
      9       « [[SetData]] »).
     10    [...]
     11 
     12    9.1.14 GetPrototypeFromConstructor
     13 
     14    [...]
     15    3. Let proto be ? Get(constructor, "prototype").
     16    4. If Type(proto) is not Object, then
     17       a. Let realm be ? GetFunctionRealm(constructor).
     18       b. Let proto be realm's intrinsic object named intrinsicDefaultProto.
     19    [...]
     20 features: [cross-realm, Reflect]
     21 ---*/
     22 
     23 var other = $262.createRealm().global;
     24 var C = new other.Function();
     25 C.prototype = null;
     26 
     27 var o = Reflect.construct(Set, [], C);
     28 
     29 assert.sameValue(Object.getPrototypeOf(o), other.Set.prototype);
     30 
     31 reportCompare(0, 0);