| 1 |
// |reftest| skip module -- import-defer is not supported |
| 2 |
// This file was procedurally generated from the following sources: |
| 3 |
// - src/import-defer/defineOwnProperty.case |
| 4 |
// - src/import-defer/trigger-on-possible-export/string-exported.template |
| 5 |
/*--- |
| 6 |
description: _ [[DefineOwnProperty]] (of a string that is an exported name, triggers execution) |
| 7 |
esid: sec-module-namespace-exotic-objects |
| 8 |
features: [import-defer] |
| 9 |
flags: [generated, module] |
| 10 |
info: | |
| 11 |
IsSymbolLikeNamespaceKey ( _P_, _O_ ) |
| 12 |
1. If _P_ is a Symbol, return *true*. |
| 13 |
1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. |
| 14 |
1. Return *false*. |
| 15 |
|
| 16 |
GetModuleExportsList ( _O_ ) |
| 17 |
1. If _O_.[[Deferred]] is *true*, then |
| 18 |
1. Let _m_ be _O_.[[Module]]. |
| 19 |
1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. |
| 20 |
1. Perform ? EvaluateSync(_m_). |
| 21 |
1. Return _O_.[[Exports]]. |
| 22 |
|
| 23 |
|
| 24 |
[[DefineOwnProperty]] ( _P_, _Desc_ ) |
| 25 |
1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryDefineOwnProperty(_O_, _Desc_). |
| 26 |
1. Let _current_ be ? _O_.[[GetOwnProperty]](_P_). |
| 27 |
1. NOTE: If _O_.[[Deferred]] is *true*, the step above will ensure that the module is evaluated. |
| 28 |
1. ... |
| 29 |
|
| 30 |
---*/ |
| 31 |
|
| 32 |
|
| 33 |
import "./setup_FIXTURE.js"; |
| 34 |
|
| 35 |
import defer * as ns from "./dep_FIXTURE.js"; |
| 36 |
|
| 37 |
assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); |
| 38 |
|
| 39 |
var key = "exported"; |
| 40 |
|
| 41 |
try { |
| 42 |
Object.defineProperty(ns, key, { value: "hi" }); |
| 43 |
} catch (_) {} |
| 44 |
|
| 45 |
assert(globalThis.evaluations.length > 0, "It triggers evaluation"); |
| 46 |
|
| 47 |
reportCompare(0, 0); |