Debian Codegraph @

js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-evaluation-abrupt-throw.js

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