2nd-param-evaluation-abrupt-throw.js (1069B)
1 // Copyright (C) 2021 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 description: Forwards "throw" completion when evaluating second parameter 5 esid: sec-import-call-runtime-semantics-evaluation 6 info: | 7 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) 8 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). 9 2. Let specifierRef be the result of evaluating specifierExpression. 10 3. Let specifier be ? GetValue(specifierRef). 11 4. If optionsExpression is present, then 12 a. Let optionsRef be the result of evaluating optionsExpression. 13 b. Let options be ? GetValue(optionsRef). 14 [...] 15 features: [dynamic-import, import-attributes] 16 ---*/ 17 18 var beforeCount = 0; 19 var afterCount = 0; 20 function throwError() { 21 throw new Test262Error(); 22 } 23 24 assert.throws(Test262Error, function() { 25 beforeCount += 1, import('', throwError()), afterCount += 1; 26 }); 27 28 assert.sameValue(beforeCount, 1); 29 assert.sameValue(afterCount, 0); 30 31 reportCompare(0, 0);