nested-async-function-file-does-not-exist.js (1440B)
1 // |reftest| async 2 // This file was procedurally generated from the following sources: 3 // - src/dynamic-import/file-does-not-exist.case 4 // - src/dynamic-import/catch/nested-async-function.template 5 /*--- 6 description: Non existent file can't resolve to a Script or Module Record (nested in async function) 7 esid: sec-import-call-runtime-semantics-evaluation 8 features: [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 If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, 26 specifier does not exist or cannot be created, an exception must be thrown. 27 28 ---*/ 29 30 async function f() { 31 import('./THIS_FILE_DOES_NOT_EXIST.js').catch(error => { 32 33 assert.notSameValue(typeof error, 'undefined'); 34 35 }).then($DONE, $DONE); 36 } 37 38 f();