distinct-for-each-module.js (1319B)
1 // |reftest| module 2 // Copyright (C) 2018 André Bargull. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-meta-properties-runtime-semantics-evaluation 7 description: > 8 The import.meta object is not shared across modules. 9 info: | 10 Runtime Semantics: Evaluation 11 12 ImportMeta : import.meta 13 14 1. Let module be GetActiveScriptOrModule(). 15 ... 16 3. Let importMeta be module.[[ImportMeta]]. 17 4. If importMeta is undefined. 18 ... 19 f. Set module.[[ImportMeta]] to importMeta. 20 g. Return importMeta. 21 ... 22 flags: [module] 23 features: [import.meta] 24 ---*/ 25 26 import {meta as fixture_meta, getMeta} from "./distinct-for-each-module_FIXTURE.js"; 27 28 // The imported module has a distinct import.meta object. 29 assert.notSameValue(import.meta, fixture_meta, 30 "foreign import.meta accessed via import binding"); 31 assert.notSameValue(import.meta, getMeta(), 32 "foreign import.meta accessed via function call"); 33 34 // Calling a function which returns import.meta returns the import.meta object 35 // from the module in which the function is declared. 36 assert.sameValue(fixture_meta, getMeta(), 37 "import.meta accessed via import binding is identical to the one accessed via call"); 38 39 reportCompare(0, 0);