Debian Codegraph @

js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-with-undefined.js

raw
1 // |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) async -- 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: Accepts undefined for the `assert` property of the second argument
6 esid: sec-import-call-runtime-semantics-evaluation
7 info: |
8 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] )
9 [...]
10 6. Let promiseCapability be ! NewPromiseCapability(%Promise%).
11 7. Let specifierString be ToString(specifier).
12 8. IfAbruptRejectPromise(specifierString, promiseCapability).
13 9. Let assertions be a new empty List.
14 10. If options is not undefined, then
15 a. If Type(options) is not Object,
16 [...]
17 b. Let assertionsObj be Get(options, "assert").
18 c. IfAbruptRejectPromise(assertionsObj, promiseCapability).
19 d. If assertionsObj is not undefined,
20 i. If Type(assertionsObj) is not Object,
21 1. Perform ! Call(promiseCapability.[[Reject]], undefined, « a
22 newly created TypeError object »).
23 2. Return promiseCapability.[[Promise]].
24 [...]
25 features: [dynamic-import, import-attributes, Symbol, BigInt]
26 flags: [async]
27 ---*/
28
29 Promise.all([
30 import('./2nd-param_FIXTURE.js', {}),
31 import('./2nd-param_FIXTURE.js', {with:undefined}),
32 ])
33 .then(function(values) {
34 assert.sameValue(values[0].default, 262);
35 assert.sameValue(values[1].default, 262);
36 })
37 .then($DONE, $DONE);