tor-browser

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

nested-do-while-import-source-source-text-module.js (2499B)


      1 // |reftest| skip async -- source-phase-imports is not supported
      2 // This file was procedurally generated from the following sources:
      3 // - src/dynamic-import/import-source-source-text-module.case
      4 // - src/dynamic-import/catch/nested-do-while.template
      5 /*---
      6 description: GetModuleSource of SourceTextModule always returns an abrupt completion. (nested do while syntax)
      7 esid: sec-import-call-runtime-semantics-evaluation
      8 features: [source-phase-imports, dynamic-import]
      9 flags: [generated, async]
     10 info: |
     11    ImportCall :
     12        import( AssignmentExpression )
     13 
     14    1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
     15    2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null).
     16    3. Let argRef be the result of evaluating AssignmentExpression.
     17    4. Let specifier be ? GetValue(argRef).
     18    5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
     19    6. Let specifierString be ToString(specifier).
     20    7. IfAbruptRejectPromise(specifierString, promiseCapability).
     21    8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
     22    9. Return promiseCapability.[[Promise]].
     23 
     24 
     25    16.2.1.7.2 GetModuleSource ( )
     26    Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.
     27    1. Throw a SyntaxError exception.
     28 
     29    Import Calls
     30 
     31    Runtime Semantics: Evaluation
     32 
     33    ImportCall : import . source ( AssignmentExpression )
     34    1. Return ? EvaluateImportCall(AssignmentExpression, source).
     35 
     36    13.3.10.1.1 EvaluateImportCall ( specifierExpression, phase )
     37    1. Let referrer be GetActiveScriptOrModule().
     38    2. If referrer is null, set referrer to the current Realm Record.
     39    3. Let specifierRef be ? Evaluation of specifierExpression.
     40    4. Let specifier be ? GetValue(specifierRef).
     41    5. Let promiseCapability be ! NewPromiseCapability(%Promise%).
     42    6. Let specifierString be Completion(ToString(specifier)).
     43    7. IfAbruptRejectPromise(specifierString, promiseCapability).
     44    8. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase }.
     45    9. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
     46    10. Return promiseCapability.[[Promise]].
     47 
     48 ---*/
     49 
     50 do {
     51  import.source('./empty_FIXTURE.js').catch(error => {
     52 
     53    assert.sameValue(error.name, 'SyntaxError');
     54 
     55  }).then($DONE, $DONE);
     56 } while (false);