tor-browser

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

promise-then-ns-delete-non-exported-strict-strict.js (4759B)


      1 // |reftest| async
      2 'use strict';
      3 // This file was procedurally generated from the following sources:
      4 // - src/dynamic-import/ns-delete-non-exported-strict.case
      5 // - src/dynamic-import/namespace/promise.template
      6 /*---
      7 description: The [[Delete]] behavior for a key that does not describe an exported binding (value from promise then)
      8 esid: sec-finishdynamicimport
      9 features: [dynamic-import]
     10 flags: [generated, onlyStrict, async]
     11 info: |
     12    Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion )
     13 
     14        1. If completion is an abrupt completion, ...
     15        2. Otherwise,
     16            ...
     17            d. Let namespace be GetModuleNamespace(moduleRecord).
     18            e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »).
     19            f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »).
     20 
     21    Runtime Semantics: GetModuleNamespace ( module )
     22 
     23        ...
     24        3. Let namespace be module.[[Namespace]].
     25        4. If namespace is undefined, then
     26            a. Let exportedNames be ? module.GetExportedNames(« »).
     27            b. Let unambiguousNames be a new empty List.
     28            c. For each name that is an element of exportedNames, do
     29                i. Let resolution be ? module.ResolveExport(name, « »).
     30                ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames.
     31            d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames).
     32        5. Return namespace.
     33 
     34    ModuleNamespaceCreate ( module, exports )
     35 
     36        ...
     37        4. Let M be a newly created object.
     38        5. Set M's essential internal methods to the definitions specified in 9.4.6.
     39        7. Let sortedExports be a new List containing the same values as the list exports where the
     40        values are ordered as if an Array of the same values had been sorted using Array.prototype.sort
     41        using undefined as comparefn.
     42        8. Set M.[[Exports]] to sortedExports.
     43        9. Create own properties of M corresponding to the definitions in 26.3.
     44        10. Set module.[[Namespace]] to M.
     45        11. Return M.
     46 
     47    26.3 Module Namespace Objects
     48 
     49        A Module Namespace Object is a module namespace exotic object that provides runtime
     50        property-based access to a module's exported bindings. There is no constructor function for
     51        Module Namespace Objects. Instead, such an object is created for each module that is imported
     52        by an ImportDeclaration that includes a NameSpaceImport.
     53 
     54        In addition to the properties specified in 9.4.6 each Module Namespace Object has the
     55        following own property:
     56 
     57    26.3.1 @@toStringTag
     58 
     59        The initial value of the @@toStringTag property is the String value "Module".
     60 
     61        This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
     62 
     63    Module Namespace Exotic Objects
     64 
     65        A module namespace object is an exotic object that exposes the bindings exported from an
     66        ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed
     67        own properties of a module namespace exotic object and the binding names exported by the
     68        Module. The exported bindings include any bindings that are indirectly exported using export *
     69        export items. Each String-valued own property key is the StringValue of the corresponding
     70        exported binding name. These are the only String-keyed properties of a module namespace exotic
     71        object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true,
     72        [[Configurable]]: false }. Module namespace objects are not extensible.
     73 
     74 
     75    [...]
     76    2. If Type(P) is Symbol, then
     77        a. Return ? OrdinaryDelete(O, P).
     78    3. Let exports be O.[[Exports]].
     79    4. If P is an element of exports, return false.
     80    5. Return true.
     81 
     82 ---*/
     83 
     84 import('./empty_FIXTURE.js').then(ns => {
     85 
     86    assert(delete ns.undef, 'delete: undef');
     87    assert(Reflect.deleteProperty(ns, 'undef'), 'Reflect.deleteProperty: undef');
     88 
     89    assert(delete ns.default, 'delete: default');
     90    assert(
     91      Reflect.deleteProperty(ns, 'default'), 'Reflect.deleteProperty: default'
     92    );
     93 
     94    assert.sameValue(
     95        Reflect.deleteProperty(ns, Symbol.toStringTag), false,
     96        'Reflect.deleteProperty: Symbol.toStringTag'
     97      );
     98    assert.throws(TypeError, function() { delete ns[Symbol.toStringTag]; }, 'delete: Symbol.toStringTag');
     99 
    100    var sym = Symbol('test262');
    101    assert(delete ns[sym], 'delete: symbol');
    102    assert(Reflect.deleteProperty(ns, sym), 'Reflect.deleteProperty: symbol');
    103 
    104 }).then($DONE, $DONE).catch($DONE);