Debian Codegraph @

js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-with-value-abrupt.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: >
6 Rejects promise when retrieving a value of the `assert` object produces an
7 abrupt completion
8 esid: sec-import-call-runtime-semantics-evaluation
9 info: |
10 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] )
11 [...]
12 10. If options is not undefined, then
13 [...]
14 d. If assertionsObj is not undefined,
15 [...]
16 ii. Let keys be EnumerableOwnPropertyNames(assertionsObj, key).
17 iii. IfAbruptRejectPromise(keys, promiseCapability).
18 iv. Let supportedAssertions be ! HostGetSupportedImportAssertions().
19 v. For each String key of keys,
20 1. Let value be Get(assertionsObj, key).
21 2. IfAbruptRejectPromise(value, promiseCapability).
22 [...]
23 features: [dynamic-import, import-attributes]
24 flags: [async]
25 ---*/
26
27 var thrown = new Test262Error();
28
29 import('./2nd-param_FIXTURE.js', {with:{get ''() { throw thrown; }}})
30 .then(function() {
31 throw new Test262Error('Expected promise to be rejected, but it was fulfilled');
32 }, function(error) {
33 assert.sameValue(error, thrown);
34 })
35 .then($DONE, $DONE);