tor-browser

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

instance.js (999B)


      1 // |reftest| shell-option(--enable-shadow-realms) skip-if(!xulRuntime.shell) -- requires shell-options
      2 // Copyright (C) 2021 Rick Waldron. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 /*---
      5 esid: sec-shadowrealm-constructor
      6 description: >
      7  new ShadowRealm() returns a shadow realm instance
      8 info: |
      9  ShadowRealm ( )
     10 
     11  ...
     12  2. Let O be ? OrdinaryCreateFromConstructor(NewTarget, "%ShadowRealm.prototype%",
     13  « [[ShadowRealm]], [[ExecutionContext]] »).
     14  ...
     15  13. Return O.
     16 features: [ShadowRealm]
     17 ---*/
     18 assert.sameValue(
     19  typeof ShadowRealm,
     20  'function',
     21  'This test must fail if ShadowRealm is not a function'
     22 );
     23 
     24 var realm = new ShadowRealm();
     25 
     26 assert(realm instanceof ShadowRealm);
     27 assert.sameValue(
     28  Object.getPrototypeOf(realm),
     29  ShadowRealm.prototype,
     30  '[[Prototype]] is set to %ShadowRealm.prototype%'
     31 );
     32 
     33 var otherRealm = new ShadowRealm();
     34 assert.notSameValue(realm, otherRealm, 'each instance is different');
     35 
     36 reportCompare(0, 0);