tor-browser

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

nested-block-import-then-eval-gtbndng-indirect-update.js (2032B)


      1 // |reftest| async
      2 // This file was procedurally generated from the following sources:
      3 // - src/dynamic-import/eval-gtbndng-indirect-update.case
      4 // - src/dynamic-import/default/nested-block.template
      5 /*---
      6 description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested block)
      7 esid: sec-import-call-runtime-semantics-evaluation
      8 features: [dynamic-import]
      9 flags: [generated, async]
     10 includes: [fnGlobalObject.js]
     11 info: |
     12    ImportCall :
     13        import( AssignmentExpression )
     14 
     15    1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
     16    2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
     17    3. Let argRef be the result of evaluating AssignmentExpression.
     18    4. Let specifier be ? GetValue(argRef).
     19    5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
     20    6. Let specifierString be ToString(specifier).
     21    7. IfAbruptRejectPromise(specifierString, promiseCapability).
     22    8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
     23    9. Return promiseCapability.[[Promise]].
     24 
     25 
     26    GetBindingValue (N, S)
     27 
     28    [...]
     29    3. If the binding for N is an indirect binding, then
     30       a. Let M and N2 be the indirection values provided when this binding for
     31          N was created.
     32       b. Let targetEnv be M.[[Environment]].
     33       c. If targetEnv is undefined, throw a ReferenceError exception.
     34       d. Let targetER be targetEnv's EnvironmentRecord.
     35       e. Return ? targetER.GetBindingValue(N2, S).
     36 
     37 ---*/
     38 
     39 {
     40  import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => {
     41 
     42    assert.sameValue(imported.x, 1);
     43 
     44    // This function is exposed on the global scope (instead of as an exported
     45    // binding) in order to avoid possible false positives from assuming correct
     46    // behavior of the semantics under test.
     47    fnGlobalObject().test262update();
     48 
     49    assert.sameValue(imported.x, 2);
     50 
     51 
     52  }).then($DONE, $DONE).catch($DONE);
     53 };