2nd-param-with-enumeration.js (1823B)
1 // |reftest| async 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 Follows the semantics of the EnumerableOwnPropertyNames abstract operation 7 during attributes enumeration 8 esid: sec-import-call-runtime-semantics-evaluation 9 info: | 10 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) 11 [...] 12 6. Let promiseCapability be ! NewPromiseCapability(%Promise%). 13 7. Let specifierString be ToString(specifier). 14 8. IfAbruptRejectPromise(specifierString, promiseCapability). 15 9. Let assertions be a new empty List. 16 10. If options is not undefined, then 17 a. If Type(options) is not Object, 18 [...] 19 b. Let assertionsObj be Get(options, "assert"). 20 c. IfAbruptRejectPromise(assertionsObj, promiseCapability). 21 d. If assertionsObj is not undefined, 22 i. If Type(assertionsObj) is not Object, 23 [...] 24 ii. Let keys be EnumerableOwnPropertyNames(assertionsObj, key). 25 [...] 26 features: [dynamic-import, import-attributes, Symbol, Proxy] 27 flags: [async] 28 ---*/ 29 30 var symbol = Symbol(''); 31 var target = { 32 [symbol]: '', 33 unreported: '', 34 nonEnumerable: '' 35 }; 36 var descriptors = { 37 [symbol]: {configurable: true, enumerable: true}, 38 nonEnumerable: {configurable: true, enumerable: false} 39 }; 40 41 var options = { 42 with: new Proxy({}, { 43 ownKeys: function() { 44 return [symbol, 'nonEnumerable', 'absent']; 45 }, 46 get() { 47 throw new Error("Should not be called"); 48 }, 49 getOwnPropertyDescriptor(target, name) { 50 return descriptors[name]; 51 } 52 }) 53 }; 54 55 import('./2nd-param_FIXTURE.js', options) 56 .then(function(module) { 57 assert.sameValue(module.default, 262); 58 }) 59 .then($DONE, $DONE);