Debian Codegraph @

js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-get-with-error.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: Rejects promise when accessing "assert" property throws an error
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 [...]
20 features: [dynamic-import, import-attributes]
21 flags: [async]
22 ---*/
23
24 var thrown = new Test262Error();
25 var options = {
26 get with() {
27 throw thrown;
28 }
29 };
30
31 import('./2nd-param_FIXTURE.js', options)
32 .then(function() {
33 throw new Test262Error('Expected an error, but observed no error');
34 }, function(caught) {
35 assert.sameValue(thrown, caught);
36 })
37 .then($DONE, $DONE);