tor-browser

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

identity.js (1826B)


      1 // |reftest| skip module -- import-defer is not supported
      2 // Copyright (C) 2024 Igalia, S.L. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 
      5 /*---
      6 esid: sec-getmodulenamespace
      7 description: >
      8  Deferred namespace objects are created and cached appropriately
      9 info: |
     10  GetModuleNamespace ( _module_, _phase_ )
     11    1. ...
     12    1. If _phase_ is ~defer~, let _namespace_ be _module_.[[DeferredNamespace]], otherwise let _namespace_ be _module_.[[Namespace]].
     13    1. If _namespace_ is ~empty~, then
     14      1. ...
     15      1. Set _namespace_ to ModuleNamespaceCreate(_module_, _unambiguousNames_, _phase_).
     16    1. Return _namespace_.
     17 
     18  ModuleNamespaceCreate ( _module_, _exports_, _phase_ )
     19    1. ...
     20    1. Let _M_ be MakeBasicObject(_internalSlotsList_).
     21    1. ...
     22    1. If _phase_ is ~defer~, then
     23      1. Set _module_.[[DeferredNamespace]] to _M_.
     24      1. ...
     25    1. Else,
     26      1. Set _module_.[[Namespace]] to _M_.
     27      1. ...
     28    1. Return _M_.
     29 
     30 flags: [module]
     31 features: [import-defer]
     32 ---*/
     33 
     34 import * as nsEager from "./dep_FIXTURE.js";
     35 
     36 import defer * as nsDeferred1 from "./dep_FIXTURE.js";
     37 import defer * as nsDeferred2 from "./dep_FIXTURE.js";
     38 import { depDeferredNamespace as nsDeferred3 } from "./dep-defer-ns_FIXTURE.js";
     39 const nsDeferred4 = await import.defer("./dep_FIXTURE.js");
     40 
     41 assert.sameValue(nsDeferred1, nsDeferred2, "Deferred import of the same module twice gives the same object");
     42 assert.sameValue(nsDeferred1, nsDeferred3, "Deferred import of the same module twice from different files gives the same object");
     43 assert.sameValue(nsDeferred1, nsDeferred4, "Static and dynamic deferred import of the same module gives the same object");
     44 assert.notSameValue(nsDeferred1, nsEager, "Deferred namespaces are distinct from eager namespaces");
     45 
     46 reportCompare(0, 0);