2nd-param-with-enumeration-enumerable.js (1832B)
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, json-modules, Symbol, Proxy] 27 flags: [async] 28 ---*/ 29 30 var symbol = Symbol(''); 31 var target = { 32 type: "json" 33 }; 34 var descriptors = { 35 type: {configurable: true, enumerable: true} 36 }; 37 var log = []; 38 39 var options = { 40 with: new Proxy({}, { 41 ownKeys: function() { 42 return ["type"]; 43 }, 44 get(_, name) { 45 log.push(name); 46 return "json"; 47 }, 48 getOwnPropertyDescriptor(target, name) { 49 return {configurable: true, enumerable: true, value: "json"}; 50 }, 51 }) 52 }; 53 54 import('./2nd-param_FIXTURE.json', options) 55 .then(function(module) { 56 assert.sameValue(module.default, 262); 57 }) 58 .then($DONE, $DONE); 59 60 assert.sameValue(log.length, 1); 61 assert.sameValue(log[0], "type")