diff --git a/src/import-defer/defineOwnProperty.case b/src/import-defer/defineOwnProperty.case new file mode 100644 index 00000000000..53a6e8d290a --- /dev/null +++ b/src/import-defer/defineOwnProperty.case @@ -0,0 +1,20 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-module-namespace-exotic-objects-defineownproperty-p-desc +desc: _ [[DefineOwnProperty]] +info: | + [[DefineOwnProperty]] ( _P_, _Desc_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryDefineOwnProperty(_O_, _Desc_). + 1. Let _current_ be ? _O_.[[GetOwnProperty]](_P_). + 1. NOTE: If _O_.[[Deferred]] is *true*, the step above will ensure that the module is evaluated. + 1. ... + +template: trigger-on-possible-export +---*/ + +//- body +try { + Object.defineProperty(ns, key, { value: "hi" }); +} catch (_) {} diff --git a/src/import-defer/delete.case b/src/import-defer/delete.case new file mode 100644 index 00000000000..7c98eca4e26 --- /dev/null +++ b/src/import-defer/delete.case @@ -0,0 +1,19 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-module-namespace-exotic-objects-delete-p +desc: _ [[Delete]] +info: | + [[Delete]] ( _P_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryDelete(_O_, _P_). + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +template: trigger-on-possible-export +---*/ + +//- body +try { + delete ns[key]; +} catch (_) {} diff --git a/src/import-defer/get.case b/src/import-defer/get.case new file mode 100644 index 00000000000..26ab7d764e7 --- /dev/null +++ b/src/import-defer/get.case @@ -0,0 +1,17 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-module-namespace-exotic-objects-get-p-receiver +desc: _ [[Get]] +info: | + [[Get]] ( _P_, _Receiver_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryGet(_O_, _P_, _Receiver_). + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +template: trigger-on-possible-export +---*/ + +//- body +ns[key]; diff --git a/src/import-defer/getOwnProperty.case b/src/import-defer/getOwnProperty.case new file mode 100644 index 00000000000..835e75b2c9f --- /dev/null +++ b/src/import-defer/getOwnProperty.case @@ -0,0 +1,17 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-module-namespace-exotic-objects-getownproperty-p +desc: _ [[GetOwnProperty]] +info: | + [[GetOwnProperty]] ( _P_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryGetOwnProperty(_O_, _P_). + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +template: trigger-on-possible-export +---*/ + +//- body +Object.getOwnPropertyDescriptor(ns, key); diff --git a/src/import-defer/getPrototypeOf.case b/src/import-defer/getPrototypeOf.case new file mode 100644 index 00000000000..39a403f4df6 --- /dev/null +++ b/src/import-defer/getPrototypeOf.case @@ -0,0 +1,15 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-module-namespace-exotic-objects-getprototypeof +desc: _ [[GetPrototypeOf]] +info: | + [[GetPrototypeOf]] ( ) + 1. Return **null**. + +template: ignore +---*/ + +//- body +Object.getPrototypeOf(ns); diff --git a/src/import-defer/hasProperty.case b/src/import-defer/hasProperty.case new file mode 100644 index 00000000000..44bab78a4b4 --- /dev/null +++ b/src/import-defer/hasProperty.case @@ -0,0 +1,17 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-module-namespace-exotic-objects-hasproperty-p +desc: _ [[HasProperty]] +info: | + [[HasProperty]] ( _P_, _Receiver_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryGet(_O_, _P_, _Receiver_). + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +template: trigger-on-possible-export +---*/ + +//- body +key in ns; diff --git a/src/import-defer/ignore/ignore.template b/src/import-defer/ignore/ignore.template new file mode 100644 index 00000000000..e4ba0904956 --- /dev/null +++ b/src/import-defer/ignore/ignore.template @@ -0,0 +1,21 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/import/import-defer/evaluation-triggers/ignore- +name: does not trigger execution +esid: sec-module-namespace-exotic-objects + +flags: [module] +features: [import-defer] +---*/ + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +/*{ body }*/ + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/src/import-defer/isExtensible.case b/src/import-defer/isExtensible.case new file mode 100644 index 00000000000..429c796ab78 --- /dev/null +++ b/src/import-defer/isExtensible.case @@ -0,0 +1,15 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-module-namespace-exotic-objects-isextensible +desc: _ [[IsExtensible]] +info: | + [[IsExtensible]] ( ) + 1. Return **false**. + +template: ignore +---*/ + +//- body +Object.isExtensible(ns); diff --git a/src/import-defer/ownPropertyKey-names.case b/src/import-defer/ownPropertyKey-names.case new file mode 100644 index 00000000000..a4723edec21 --- /dev/null +++ b/src/import-defer/ownPropertyKey-names.case @@ -0,0 +1,16 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-module-namespace-exotic-objects-ownpropertykeys +desc: _ [[OwnPropertyKeys]] +info: | + [[OwnPropertyKeys]] ( ) + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +template: trigger +---*/ + +//- body +Object.getOwnPropertyNames(ns); diff --git a/src/import-defer/ownPropertyKeys-symbols.case b/src/import-defer/ownPropertyKeys-symbols.case new file mode 100644 index 00000000000..cbf7e39ff7b --- /dev/null +++ b/src/import-defer/ownPropertyKeys-symbols.case @@ -0,0 +1,16 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-module-namespace-exotic-objects-ownpropertykeys +desc: _ [[OwnPropertyKeys]] +info: | + [[OwnPropertyKeys]] ( ) + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +template: trigger +---*/ + +//- body +Object.getOwnPropertySymbols(ns); diff --git a/src/import-defer/ownPropertyKeys.case b/src/import-defer/ownPropertyKeys.case new file mode 100644 index 00000000000..9716b0d8088 --- /dev/null +++ b/src/import-defer/ownPropertyKeys.case @@ -0,0 +1,16 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-module-namespace-exotic-objects-ownpropertykeys +desc: _ [[OwnPropertyKeys]] +info: | + [[OwnPropertyKeys]] ( ) + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +template: trigger +---*/ + +//- body +Reflect.ownKeys(ns); diff --git a/src/import-defer/preventExtensions.case b/src/import-defer/preventExtensions.case new file mode 100644 index 00000000000..66ef7b39ef9 --- /dev/null +++ b/src/import-defer/preventExtensions.case @@ -0,0 +1,15 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-module-namespace-exotic-objects-preventextensions +desc: _ [[IsExtensible]] +info: | + [[IsExtensible]] ( ) + 1. Return **false**. + +template: ignore +---*/ + +//- body +Object.preventExtensions(ns); diff --git a/src/import-defer/set-string-exported.case b/src/import-defer/set-string-exported.case new file mode 100644 index 00000000000..eedfefec7f9 --- /dev/null +++ b/src/import-defer/set-string-exported.case @@ -0,0 +1,17 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-module-namespace-exotic-objects-set-p-v-receiver +desc: _ [[Set]] of a string which is an export name +info: | + [[Set]] ( _P_, _V_, _Receiver_ ) + 1. Return **false**. + +template: ignore +---*/ + +//- body +try { + ns.exported = "hi"; +} catch (_) {} diff --git a/src/import-defer/set-string-not-exported.case b/src/import-defer/set-string-not-exported.case new file mode 100644 index 00000000000..fb92e61d799 --- /dev/null +++ b/src/import-defer/set-string-not-exported.case @@ -0,0 +1,17 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-module-namespace-exotic-objects-set-p-v-receiver +desc: _ [[Set]] of a string which is not an export name +info: | + [[Set]] ( _P_, _V_, _Receiver_ ) + 1. Return **false**. + +template: ignore +---*/ + +//- body +try { + ns.notExported = "hi"; +} catch (_) {} diff --git a/src/import-defer/setPrototypeOf.case b/src/import-defer/setPrototypeOf.case new file mode 100644 index 00000000000..1dd218f590b --- /dev/null +++ b/src/import-defer/setPrototypeOf.case @@ -0,0 +1,16 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-module-namespace-exotic-objects-setprototypeof +desc: _ [[PreventExtensions]] +info: | + [[PreventExtensions]] ( ) + 1. Return **true**. + +template: ignore +---*/ + +//- body +Reflect.setPrototypeOf(ns, null); +Reflect.setPrototypeOf(ns, {}); diff --git a/src/import-defer/trigger-on-possible-export/string-exported.template b/src/import-defer/trigger-on-possible-export/string-exported.template new file mode 100644 index 00000000000..9011006fb74 --- /dev/null +++ b/src/import-defer/trigger-on-possible-export/string-exported.template @@ -0,0 +1,35 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/import/import-defer/evaluation-triggers/trigger-exported-string- +name: of a string that is an exported name, triggers execution +esid: sec-module-namespace-exotic-objects +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + +flags: [module] +features: [import-defer] +---*/ + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = "exported"; + +/*{ body }*/ + +assert(globalThis.evaluations.length > 0, "It triggers evaluation"); diff --git a/src/import-defer/trigger-on-possible-export/string-not-exported.template b/src/import-defer/trigger-on-possible-export/string-not-exported.template new file mode 100644 index 00000000000..323fd59101c --- /dev/null +++ b/src/import-defer/trigger-on-possible-export/string-not-exported.template @@ -0,0 +1,35 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/import/import-defer/evaluation-triggers/trigger-not-exported-string- +name: of a string that is not an exported name, triggers execution +esid: sec-module-namespace-exotic-objects +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + +flags: [module] +features: [import-defer] +---*/ + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = "notExported"; + +/*{ body }*/ + +assert(globalThis.evaluations.length > 0, "It triggers evaluation"); diff --git a/src/import-defer/trigger-on-possible-export/symbol-other.template b/src/import-defer/trigger-on-possible-export/symbol-other.template new file mode 100644 index 00000000000..2f10ccc3890 --- /dev/null +++ b/src/import-defer/trigger-on-possible-export/symbol-other.template @@ -0,0 +1,35 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/import/import-defer/evaluation-triggers/ignore-symbol-other- +name: of a symbol that is not a property of the namespace object, does not trigger execution +esid: sec-module-namespace-exotic-objects +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + +flags: [module] +features: [import-defer] +---*/ + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = Symbol(); + +/*{ body }*/ + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/src/import-defer/trigger-on-possible-export/symbol-toStringTag.template b/src/import-defer/trigger-on-possible-export/symbol-toStringTag.template new file mode 100644 index 00000000000..181e5e0bcfa --- /dev/null +++ b/src/import-defer/trigger-on-possible-export/symbol-toStringTag.template @@ -0,0 +1,35 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/import/import-defer/evaluation-triggers/ignore-symbol-toStringTag- +name: of Symbol.toStringTag, does not trigger execution +esid: sec-module-namespace-exotic-objects +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + +flags: [module] +features: [import-defer] +---*/ + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = Symbol.toStringTag; + +/*{ body }*/ + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/src/import-defer/trigger-on-possible-export/then-exported.template b/src/import-defer/trigger-on-possible-export/then-exported.template new file mode 100644 index 00000000000..d33f7bd12d3 --- /dev/null +++ b/src/import-defer/trigger-on-possible-export/then-exported.template @@ -0,0 +1,35 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/import/import-defer/evaluation-triggers/ignore-exported-then- +name: of 'then' when it is an exported name, does not trigger execution +esid: sec-module-namespace-exotic-objects +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + +flags: [module] +features: [import-defer] +---*/ + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep-then_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = "then"; + +/*{ body }*/ + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/src/import-defer/trigger-on-possible-export/then-not-exported.template b/src/import-defer/trigger-on-possible-export/then-not-exported.template new file mode 100644 index 00000000000..1b8485ec067 --- /dev/null +++ b/src/import-defer/trigger-on-possible-export/then-not-exported.template @@ -0,0 +1,35 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/import/import-defer/evaluation-triggers/ignore-not-exported-then- +name: of 'then' when it is not an exported name, does not trigger execution +esid: sec-module-namespace-exotic-objects +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + +flags: [module] +features: [import-defer] +---*/ + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = "then"; + +/*{ body }*/ + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/src/import-defer/trigger/trigger.template b/src/import-defer/trigger/trigger.template new file mode 100644 index 00000000000..e7fbe80c83d --- /dev/null +++ b/src/import-defer/trigger/trigger.template @@ -0,0 +1,21 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/import/import-defer/evaluation-triggers/trigger- +name: triggers execution +esid: sec-module-namespace-exotic-objects + +flags: [module] +features: [import-defer] +---*/ + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +/*{ body }*/ + +assert(globalThis.evaluations.length > 0, "It triggers evaluation"); diff --git a/test/language/import/import-defer/evaluation-sync/evaluation-ignore-get-symbol.js b/test/language/import/import-defer/evaluation-sync/evaluation-ignore-get-symbol.js deleted file mode 100644 index c7588800e4c..00000000000 --- a/test/language/import/import-defer/evaluation-sync/evaluation-ignore-get-symbol.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (C) 2024 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-module-namespace-exotic-objects-get-p-receiver -description: > - [[Get]] of a symbol does not trigger evaluation of the module -info: | - [[Get]] ( _P_, _Receiver_ ) - 1. If _P_ is a Symbol, then - 1. Return ! OrdinaryGet(_O_, _P_, _Receiver_). - 1. If _O_.[[Deferred]] is **true**, perform ? EnsureDeferredNamespaceEvaluation(_O_). - 1. ... - -flags: [module] -features: [import-defer] ----*/ - -import "./setup_FIXTURE.js"; - -import defer * as ns1 from "./dep-1_FIXTURE.js"; - -assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); - -ns1[Symbol.toStringTag]; -ns1[Symbol()]; - -assert.sameValue(globalThis.evaluations.length, 0, "[[Get]] of a symbol does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-sync/evaluation-ignore-getPrototypeOf.js b/test/language/import/import-defer/evaluation-sync/evaluation-ignore-getPrototypeOf.js deleted file mode 100644 index 4cd7224c55d..00000000000 --- a/test/language/import/import-defer/evaluation-sync/evaluation-ignore-getPrototypeOf.js +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2024 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-module-namespace-exotic-objects-getprototypeof -description: > - [[GetPrototypeOf]] does not trigger evaluation of the module -info: | - [[GetPrototypeOf]] ( ) - 1. Return **null**. - -flags: [module] -features: [import-defer] ----*/ - -import "./setup_FIXTURE.js"; - -import defer * as ns1 from "./dep-1_FIXTURE.js"; - -assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); - -Object.getPrototypeOf(ns1); - -assert.sameValue(globalThis.evaluations.length, 0, "[[GetPrototypeOf]] does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-sync/evaluation-ignore-isExtensible.js b/test/language/import/import-defer/evaluation-sync/evaluation-ignore-isExtensible.js deleted file mode 100644 index 47f441bffa9..00000000000 --- a/test/language/import/import-defer/evaluation-sync/evaluation-ignore-isExtensible.js +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2024 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-module-namespace-exotic-objects-isextensible -description: > - [[IsExtensible]] does not trigger evaluation of the module -info: | - [[IsExtensible]] ( ) - 1. Return **false**. - -flags: [module] -features: [import-defer] ----*/ - -import "./setup_FIXTURE.js"; - -import defer * as ns1 from "./dep-1_FIXTURE.js"; - -assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); - -Object.isExtensible(ns1); - -assert.sameValue(globalThis.evaluations.length, 0, "[[IsExtensible]] does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-sync/evaluation-ignore-preventExtensions.js b/test/language/import/import-defer/evaluation-sync/evaluation-ignore-preventExtensions.js deleted file mode 100644 index e2438de032e..00000000000 --- a/test/language/import/import-defer/evaluation-sync/evaluation-ignore-preventExtensions.js +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2024 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-module-namespace-exotic-objects-preventextensions -description: > - [[PreventExtensions]] does not trigger evaluation of the module -info: | - [[PreventExtensions]] ( ) - 1. Return **true**. - -flags: [module] -features: [import-defer] ----*/ - -import "./setup_FIXTURE.js"; - -import defer * as ns1 from "./dep-1_FIXTURE.js"; - -assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); - -Object.preventExtensions(ns1); - -assert.sameValue(globalThis.evaluations.length, 0, "[[PreventExtensions]] does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-sync/evaluation-ignore-set.js b/test/language/import/import-defer/evaluation-sync/evaluation-ignore-set.js deleted file mode 100644 index e2416db5bbc..00000000000 --- a/test/language/import/import-defer/evaluation-sync/evaluation-ignore-set.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (C) 2024 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-module-namespace-exotic-objects-set-p-v-receiver -description: > - [[Set]] does not trigger evaluation of the module -info: | - [[Set]] ( _P_, _V_, _Receiver_ ) - 1. Return **false**. - -flags: [module] -features: [import-defer] ----*/ - -import "./setup_FIXTURE.js"; - -import defer * as ns1 from "./dep-1_FIXTURE.js"; - -assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); - -try { - ns1.foo = 2; -} catch {} -try { - ns1.ns_1_2 = 3; -} catch {} - -assert.sameValue(globalThis.evaluations.length, 0, "[[Set]] of a symbol does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-sync/evaluation-ignore-setPrototypeOf.js b/test/language/import/import-defer/evaluation-sync/evaluation-ignore-setPrototypeOf.js deleted file mode 100644 index d2b82a7b84d..00000000000 --- a/test/language/import/import-defer/evaluation-sync/evaluation-ignore-setPrototypeOf.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2024 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-module-namespace-exotic-objects-setprototypeof-v -description: > - [[SetPrototypeOf]] does not trigger evaluation of the module -info: | - [[SetPrototypeOf]] ( _V_ ) - 1. Return ! SetImmutablePrototype(_O_, _V_). - -flags: [module] -features: [import-defer] ----*/ - -import "./setup_FIXTURE.js"; - -import defer * as ns1 from "./dep-1_FIXTURE.js"; - -assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); - -Reflect.setPrototypeOf(ns1, null); -Reflect.setPrototypeOf(ns1, {}); - -assert.sameValue(globalThis.evaluations.length, 0, "[[SetPrototypeOf]] does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-sync/evaluation-trigger-get-string.js b/test/language/import/import-defer/evaluation-sync/evaluation-trigger-get-string.js deleted file mode 100644 index 21e82b4182f..00000000000 --- a/test/language/import/import-defer/evaluation-sync/evaluation-trigger-get-string.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2024 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-module-namespace-exotic-objects-get-p-receiver -description: > - [[Get]] of a string triggers evaluation of the module -info: | - [[Get]] ( _P_, _Receiver_ ) - 1. If _P_ is a Symbol, then - 1. Return ! OrdinaryGet(_O_, _P_, _Receiver_). - 1. If _O_.[[Deferred]] is **true**, perform ? EnsureDeferredNamespaceEvaluation(_O_). - 1. ... - -flags: [module] -features: [import-defer] ----*/ - -import "./setup_FIXTURE.js"; - -import defer * as ns1 from "./dep-1_FIXTURE.js"; - -assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); - -ns1.foo; - -assert(globalThis.evaluations.length > 0, "[[Get]] of a string triggers evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/dep-then_FIXTURE.js b/test/language/import/import-defer/evaluation-triggers/dep-then_FIXTURE.js new file mode 100644 index 00000000000..59c7770dcc5 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/dep-then_FIXTURE.js @@ -0,0 +1,6 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +globalThis.evaluations.push("then"); + +export function then(cb) { cb(); } diff --git a/test/language/import/import-defer/evaluation-triggers/dep_FIXTURE.js b/test/language/import/import-defer/evaluation-triggers/dep_FIXTURE.js new file mode 100644 index 00000000000..d6118da264f --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/dep_FIXTURE.js @@ -0,0 +1,6 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +globalThis.evaluations.push("dep"); + +export let exported = 3; diff --git a/test/language/import/import-defer/evaluation-triggers/ignore-exported-then-defineOwnProperty.js b/test/language/import/import-defer/evaluation-triggers/ignore-exported-then-defineOwnProperty.js new file mode 100644 index 00000000000..bea1798d7e0 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/ignore-exported-then-defineOwnProperty.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/defineOwnProperty.case +// - src/import-defer/trigger-on-possible-export/then-exported.template +/*--- +description: _ [[DefineOwnProperty]] (of 'then' when it is an exported name, does not trigger execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + + + [[DefineOwnProperty]] ( _P_, _Desc_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryDefineOwnProperty(_O_, _Desc_). + 1. Let _current_ be ? _O_.[[GetOwnProperty]](_P_). + 1. NOTE: If _O_.[[Deferred]] is *true*, the step above will ensure that the module is evaluated. + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep-then_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = "then"; + +try { + Object.defineProperty(ns, key, { value: "hi" }); +} catch (_) {} + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/ignore-exported-then-delete.js b/test/language/import/import-defer/evaluation-triggers/ignore-exported-then-delete.js new file mode 100644 index 00000000000..b7da01f5f84 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/ignore-exported-then-delete.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/delete.case +// - src/import-defer/trigger-on-possible-export/then-exported.template +/*--- +description: _ [[Delete]] (of 'then' when it is an exported name, does not trigger execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + + + [[Delete]] ( _P_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryDelete(_O_, _P_). + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep-then_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = "then"; + +try { + delete ns[key]; +} catch (_) {} + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/ignore-exported-then-get.js b/test/language/import/import-defer/evaluation-triggers/ignore-exported-then-get.js new file mode 100644 index 00000000000..0f1493d2007 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/ignore-exported-then-get.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/get.case +// - src/import-defer/trigger-on-possible-export/then-exported.template +/*--- +description: _ [[Get]] (of 'then' when it is an exported name, does not trigger execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + + + [[Get]] ( _P_, _Receiver_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryGet(_O_, _P_, _Receiver_). + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep-then_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = "then"; + +ns[key]; + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/ignore-exported-then-getOwnProperty.js b/test/language/import/import-defer/evaluation-triggers/ignore-exported-then-getOwnProperty.js new file mode 100644 index 00000000000..3df622e4c23 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/ignore-exported-then-getOwnProperty.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/getOwnProperty.case +// - src/import-defer/trigger-on-possible-export/then-exported.template +/*--- +description: _ [[GetOwnProperty]] (of 'then' when it is an exported name, does not trigger execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + + + [[GetOwnProperty]] ( _P_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryGetOwnProperty(_O_, _P_). + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep-then_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = "then"; + +Object.getOwnPropertyDescriptor(ns, key); + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/ignore-exported-then-hasProperty.js b/test/language/import/import-defer/evaluation-triggers/ignore-exported-then-hasProperty.js new file mode 100644 index 00000000000..6ea299380e4 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/ignore-exported-then-hasProperty.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/hasProperty.case +// - src/import-defer/trigger-on-possible-export/then-exported.template +/*--- +description: _ [[HasProperty]] (of 'then' when it is an exported name, does not trigger execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + + + [[HasProperty]] ( _P_, _Receiver_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryGet(_O_, _P_, _Receiver_). + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep-then_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = "then"; + +key in ns; + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/ignore-getPrototypeOf.js b/test/language/import/import-defer/evaluation-triggers/ignore-getPrototypeOf.js new file mode 100644 index 00000000000..e99745ca335 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/ignore-getPrototypeOf.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/getPrototypeOf.case +// - src/import-defer/ignore/ignore.template +/*--- +description: _ [[GetPrototypeOf]] (does not trigger execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + [[GetPrototypeOf]] ( ) + 1. Return **null**. + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +Object.getPrototypeOf(ns); + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/ignore-isExtensible.js b/test/language/import/import-defer/evaluation-triggers/ignore-isExtensible.js new file mode 100644 index 00000000000..1a1ff4703b0 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/ignore-isExtensible.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/isExtensible.case +// - src/import-defer/ignore/ignore.template +/*--- +description: _ [[IsExtensible]] (does not trigger execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + [[IsExtensible]] ( ) + 1. Return **false**. + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +Object.isExtensible(ns); + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/ignore-not-exported-then-defineOwnProperty.js b/test/language/import/import-defer/evaluation-triggers/ignore-not-exported-then-defineOwnProperty.js new file mode 100644 index 00000000000..0dbadfea4c8 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/ignore-not-exported-then-defineOwnProperty.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/defineOwnProperty.case +// - src/import-defer/trigger-on-possible-export/then-not-exported.template +/*--- +description: _ [[DefineOwnProperty]] (of 'then' when it is not an exported name, does not trigger execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + + + [[DefineOwnProperty]] ( _P_, _Desc_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryDefineOwnProperty(_O_, _Desc_). + 1. Let _current_ be ? _O_.[[GetOwnProperty]](_P_). + 1. NOTE: If _O_.[[Deferred]] is *true*, the step above will ensure that the module is evaluated. + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = "then"; + +try { + Object.defineProperty(ns, key, { value: "hi" }); +} catch (_) {} + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/ignore-not-exported-then-delete.js b/test/language/import/import-defer/evaluation-triggers/ignore-not-exported-then-delete.js new file mode 100644 index 00000000000..65bef8a25aa --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/ignore-not-exported-then-delete.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/delete.case +// - src/import-defer/trigger-on-possible-export/then-not-exported.template +/*--- +description: _ [[Delete]] (of 'then' when it is not an exported name, does not trigger execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + + + [[Delete]] ( _P_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryDelete(_O_, _P_). + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = "then"; + +try { + delete ns[key]; +} catch (_) {} + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/ignore-not-exported-then-get.js b/test/language/import/import-defer/evaluation-triggers/ignore-not-exported-then-get.js new file mode 100644 index 00000000000..ff0a6a2468b --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/ignore-not-exported-then-get.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/get.case +// - src/import-defer/trigger-on-possible-export/then-not-exported.template +/*--- +description: _ [[Get]] (of 'then' when it is not an exported name, does not trigger execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + + + [[Get]] ( _P_, _Receiver_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryGet(_O_, _P_, _Receiver_). + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = "then"; + +ns[key]; + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/ignore-not-exported-then-getOwnProperty.js b/test/language/import/import-defer/evaluation-triggers/ignore-not-exported-then-getOwnProperty.js new file mode 100644 index 00000000000..c9c4a1426e2 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/ignore-not-exported-then-getOwnProperty.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/getOwnProperty.case +// - src/import-defer/trigger-on-possible-export/then-not-exported.template +/*--- +description: _ [[GetOwnProperty]] (of 'then' when it is not an exported name, does not trigger execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + + + [[GetOwnProperty]] ( _P_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryGetOwnProperty(_O_, _P_). + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = "then"; + +Object.getOwnPropertyDescriptor(ns, key); + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/ignore-not-exported-then-hasProperty.js b/test/language/import/import-defer/evaluation-triggers/ignore-not-exported-then-hasProperty.js new file mode 100644 index 00000000000..c01bb007e3d --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/ignore-not-exported-then-hasProperty.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/hasProperty.case +// - src/import-defer/trigger-on-possible-export/then-not-exported.template +/*--- +description: _ [[HasProperty]] (of 'then' when it is not an exported name, does not trigger execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + + + [[HasProperty]] ( _P_, _Receiver_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryGet(_O_, _P_, _Receiver_). + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = "then"; + +key in ns; + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/ignore-preventExtensions.js b/test/language/import/import-defer/evaluation-triggers/ignore-preventExtensions.js new file mode 100644 index 00000000000..6698dda1729 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/ignore-preventExtensions.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/preventExtensions.case +// - src/import-defer/ignore/ignore.template +/*--- +description: _ [[IsExtensible]] (does not trigger execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + [[IsExtensible]] ( ) + 1. Return **false**. + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +Object.preventExtensions(ns); + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/ignore-set-string-exported.js b/test/language/import/import-defer/evaluation-triggers/ignore-set-string-exported.js new file mode 100644 index 00000000000..9629a6aa787 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/ignore-set-string-exported.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/set-string-exported.case +// - src/import-defer/ignore/ignore.template +/*--- +description: _ [[Set]] of a string which is an export name (does not trigger execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + [[Set]] ( _P_, _V_, _Receiver_ ) + 1. Return **false**. + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +try { + ns.exported = "hi"; +} catch (_) {} + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/ignore-set-string-not-exported.js b/test/language/import/import-defer/evaluation-triggers/ignore-set-string-not-exported.js new file mode 100644 index 00000000000..3c7b71889e4 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/ignore-set-string-not-exported.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/set-string-not-exported.case +// - src/import-defer/ignore/ignore.template +/*--- +description: _ [[Set]] of a string which is not an export name (does not trigger execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + [[Set]] ( _P_, _V_, _Receiver_ ) + 1. Return **false**. + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +try { + ns.notExported = "hi"; +} catch (_) {} + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/ignore-setPrototypeOf.js b/test/language/import/import-defer/evaluation-triggers/ignore-setPrototypeOf.js new file mode 100644 index 00000000000..3b6c6115775 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/ignore-setPrototypeOf.js @@ -0,0 +1,25 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/setPrototypeOf.case +// - src/import-defer/ignore/ignore.template +/*--- +description: _ [[PreventExtensions]] (does not trigger execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + [[PreventExtensions]] ( ) + 1. Return **true**. + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +Reflect.setPrototypeOf(ns, null); +Reflect.setPrototypeOf(ns, {}); + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/ignore-symbol-other-defineOwnProperty.js b/test/language/import/import-defer/evaluation-triggers/ignore-symbol-other-defineOwnProperty.js new file mode 100644 index 00000000000..774e10b36e6 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/ignore-symbol-other-defineOwnProperty.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/defineOwnProperty.case +// - src/import-defer/trigger-on-possible-export/symbol-other.template +/*--- +description: _ [[DefineOwnProperty]] (of a symbol that is not a property of the namespace object, does not trigger execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + + + [[DefineOwnProperty]] ( _P_, _Desc_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryDefineOwnProperty(_O_, _Desc_). + 1. Let _current_ be ? _O_.[[GetOwnProperty]](_P_). + 1. NOTE: If _O_.[[Deferred]] is *true*, the step above will ensure that the module is evaluated. + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = Symbol(); + +try { + Object.defineProperty(ns, key, { value: "hi" }); +} catch (_) {} + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/ignore-symbol-other-delete.js b/test/language/import/import-defer/evaluation-triggers/ignore-symbol-other-delete.js new file mode 100644 index 00000000000..e47b6f8c0e7 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/ignore-symbol-other-delete.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/delete.case +// - src/import-defer/trigger-on-possible-export/symbol-other.template +/*--- +description: _ [[Delete]] (of a symbol that is not a property of the namespace object, does not trigger execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + + + [[Delete]] ( _P_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryDelete(_O_, _P_). + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = Symbol(); + +try { + delete ns[key]; +} catch (_) {} + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/ignore-symbol-other-get.js b/test/language/import/import-defer/evaluation-triggers/ignore-symbol-other-get.js new file mode 100644 index 00000000000..3dcc5228347 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/ignore-symbol-other-get.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/get.case +// - src/import-defer/trigger-on-possible-export/symbol-other.template +/*--- +description: _ [[Get]] (of a symbol that is not a property of the namespace object, does not trigger execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + + + [[Get]] ( _P_, _Receiver_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryGet(_O_, _P_, _Receiver_). + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = Symbol(); + +ns[key]; + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/ignore-symbol-other-getOwnProperty.js b/test/language/import/import-defer/evaluation-triggers/ignore-symbol-other-getOwnProperty.js new file mode 100644 index 00000000000..8e24bfdb964 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/ignore-symbol-other-getOwnProperty.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/getOwnProperty.case +// - src/import-defer/trigger-on-possible-export/symbol-other.template +/*--- +description: _ [[GetOwnProperty]] (of a symbol that is not a property of the namespace object, does not trigger execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + + + [[GetOwnProperty]] ( _P_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryGetOwnProperty(_O_, _P_). + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = Symbol(); + +Object.getOwnPropertyDescriptor(ns, key); + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/ignore-symbol-other-hasProperty.js b/test/language/import/import-defer/evaluation-triggers/ignore-symbol-other-hasProperty.js new file mode 100644 index 00000000000..5e68589fff7 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/ignore-symbol-other-hasProperty.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/hasProperty.case +// - src/import-defer/trigger-on-possible-export/symbol-other.template +/*--- +description: _ [[HasProperty]] (of a symbol that is not a property of the namespace object, does not trigger execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + + + [[HasProperty]] ( _P_, _Receiver_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryGet(_O_, _P_, _Receiver_). + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = Symbol(); + +key in ns; + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/ignore-symbol-toStringTag-defineOwnProperty.js b/test/language/import/import-defer/evaluation-triggers/ignore-symbol-toStringTag-defineOwnProperty.js new file mode 100644 index 00000000000..4b1fd87bdd9 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/ignore-symbol-toStringTag-defineOwnProperty.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/defineOwnProperty.case +// - src/import-defer/trigger-on-possible-export/symbol-toStringTag.template +/*--- +description: _ [[DefineOwnProperty]] (of Symbol.toStringTag, does not trigger execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + + + [[DefineOwnProperty]] ( _P_, _Desc_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryDefineOwnProperty(_O_, _Desc_). + 1. Let _current_ be ? _O_.[[GetOwnProperty]](_P_). + 1. NOTE: If _O_.[[Deferred]] is *true*, the step above will ensure that the module is evaluated. + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = Symbol.toStringTag; + +try { + Object.defineProperty(ns, key, { value: "hi" }); +} catch (_) {} + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/ignore-symbol-toStringTag-delete.js b/test/language/import/import-defer/evaluation-triggers/ignore-symbol-toStringTag-delete.js new file mode 100644 index 00000000000..7a556aca725 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/ignore-symbol-toStringTag-delete.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/delete.case +// - src/import-defer/trigger-on-possible-export/symbol-toStringTag.template +/*--- +description: _ [[Delete]] (of Symbol.toStringTag, does not trigger execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + + + [[Delete]] ( _P_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryDelete(_O_, _P_). + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = Symbol.toStringTag; + +try { + delete ns[key]; +} catch (_) {} + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/ignore-symbol-toStringTag-get.js b/test/language/import/import-defer/evaluation-triggers/ignore-symbol-toStringTag-get.js new file mode 100644 index 00000000000..9d230673327 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/ignore-symbol-toStringTag-get.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/get.case +// - src/import-defer/trigger-on-possible-export/symbol-toStringTag.template +/*--- +description: _ [[Get]] (of Symbol.toStringTag, does not trigger execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + + + [[Get]] ( _P_, _Receiver_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryGet(_O_, _P_, _Receiver_). + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = Symbol.toStringTag; + +ns[key]; + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/ignore-symbol-toStringTag-getOwnProperty.js b/test/language/import/import-defer/evaluation-triggers/ignore-symbol-toStringTag-getOwnProperty.js new file mode 100644 index 00000000000..932924fe033 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/ignore-symbol-toStringTag-getOwnProperty.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/getOwnProperty.case +// - src/import-defer/trigger-on-possible-export/symbol-toStringTag.template +/*--- +description: _ [[GetOwnProperty]] (of Symbol.toStringTag, does not trigger execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + + + [[GetOwnProperty]] ( _P_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryGetOwnProperty(_O_, _P_). + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = Symbol.toStringTag; + +Object.getOwnPropertyDescriptor(ns, key); + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/ignore-symbol-toStringTag-hasProperty.js b/test/language/import/import-defer/evaluation-triggers/ignore-symbol-toStringTag-hasProperty.js new file mode 100644 index 00000000000..5b3ecd085c6 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/ignore-symbol-toStringTag-hasProperty.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/hasProperty.case +// - src/import-defer/trigger-on-possible-export/symbol-toStringTag.template +/*--- +description: _ [[HasProperty]] (of Symbol.toStringTag, does not trigger execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + + + [[HasProperty]] ( _P_, _Receiver_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryGet(_O_, _P_, _Receiver_). + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = Symbol.toStringTag; + +key in ns; + +assert.sameValue(globalThis.evaluations.length, 0, "It does not trigger evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/setup_FIXTURE.js b/test/language/import/import-defer/evaluation-triggers/setup_FIXTURE.js new file mode 100644 index 00000000000..d71b2fa95eb --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/setup_FIXTURE.js @@ -0,0 +1,4 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +globalThis.evaluations = []; diff --git a/test/language/import/import-defer/evaluation-triggers/trigger-exported-string-defineOwnProperty.js b/test/language/import/import-defer/evaluation-triggers/trigger-exported-string-defineOwnProperty.js new file mode 100644 index 00000000000..13854e36022 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/trigger-exported-string-defineOwnProperty.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/defineOwnProperty.case +// - src/import-defer/trigger-on-possible-export/string-exported.template +/*--- +description: _ [[DefineOwnProperty]] (of a string that is an exported name, triggers execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + + + [[DefineOwnProperty]] ( _P_, _Desc_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryDefineOwnProperty(_O_, _Desc_). + 1. Let _current_ be ? _O_.[[GetOwnProperty]](_P_). + 1. NOTE: If _O_.[[Deferred]] is *true*, the step above will ensure that the module is evaluated. + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = "exported"; + +try { + Object.defineProperty(ns, key, { value: "hi" }); +} catch (_) {} + +assert(globalThis.evaluations.length > 0, "It triggers evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/trigger-exported-string-delete.js b/test/language/import/import-defer/evaluation-triggers/trigger-exported-string-delete.js new file mode 100644 index 00000000000..f60b9cb06da --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/trigger-exported-string-delete.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/delete.case +// - src/import-defer/trigger-on-possible-export/string-exported.template +/*--- +description: _ [[Delete]] (of a string that is an exported name, triggers execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + + + [[Delete]] ( _P_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryDelete(_O_, _P_). + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = "exported"; + +try { + delete ns[key]; +} catch (_) {} + +assert(globalThis.evaluations.length > 0, "It triggers evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/trigger-exported-string-get.js b/test/language/import/import-defer/evaluation-triggers/trigger-exported-string-get.js new file mode 100644 index 00000000000..ac1ecec494e --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/trigger-exported-string-get.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/get.case +// - src/import-defer/trigger-on-possible-export/string-exported.template +/*--- +description: _ [[Get]] (of a string that is an exported name, triggers execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + + + [[Get]] ( _P_, _Receiver_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryGet(_O_, _P_, _Receiver_). + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = "exported"; + +ns[key]; + +assert(globalThis.evaluations.length > 0, "It triggers evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/trigger-exported-string-getOwnProperty.js b/test/language/import/import-defer/evaluation-triggers/trigger-exported-string-getOwnProperty.js new file mode 100644 index 00000000000..44c09342569 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/trigger-exported-string-getOwnProperty.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/getOwnProperty.case +// - src/import-defer/trigger-on-possible-export/string-exported.template +/*--- +description: _ [[GetOwnProperty]] (of a string that is an exported name, triggers execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + + + [[GetOwnProperty]] ( _P_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryGetOwnProperty(_O_, _P_). + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = "exported"; + +Object.getOwnPropertyDescriptor(ns, key); + +assert(globalThis.evaluations.length > 0, "It triggers evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/trigger-exported-string-hasProperty.js b/test/language/import/import-defer/evaluation-triggers/trigger-exported-string-hasProperty.js new file mode 100644 index 00000000000..1cb4d5b7d30 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/trigger-exported-string-hasProperty.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/hasProperty.case +// - src/import-defer/trigger-on-possible-export/string-exported.template +/*--- +description: _ [[HasProperty]] (of a string that is an exported name, triggers execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + + + [[HasProperty]] ( _P_, _Receiver_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryGet(_O_, _P_, _Receiver_). + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = "exported"; + +key in ns; + +assert(globalThis.evaluations.length > 0, "It triggers evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/trigger-not-exported-string-defineOwnProperty.js b/test/language/import/import-defer/evaluation-triggers/trigger-not-exported-string-defineOwnProperty.js new file mode 100644 index 00000000000..229e59a7331 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/trigger-not-exported-string-defineOwnProperty.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/defineOwnProperty.case +// - src/import-defer/trigger-on-possible-export/string-not-exported.template +/*--- +description: _ [[DefineOwnProperty]] (of a string that is not an exported name, triggers execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + + + [[DefineOwnProperty]] ( _P_, _Desc_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryDefineOwnProperty(_O_, _Desc_). + 1. Let _current_ be ? _O_.[[GetOwnProperty]](_P_). + 1. NOTE: If _O_.[[Deferred]] is *true*, the step above will ensure that the module is evaluated. + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = "notExported"; + +try { + Object.defineProperty(ns, key, { value: "hi" }); +} catch (_) {} + +assert(globalThis.evaluations.length > 0, "It triggers evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/trigger-not-exported-string-delete.js b/test/language/import/import-defer/evaluation-triggers/trigger-not-exported-string-delete.js new file mode 100644 index 00000000000..af688f51330 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/trigger-not-exported-string-delete.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/delete.case +// - src/import-defer/trigger-on-possible-export/string-not-exported.template +/*--- +description: _ [[Delete]] (of a string that is not an exported name, triggers execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + + + [[Delete]] ( _P_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryDelete(_O_, _P_). + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = "notExported"; + +try { + delete ns[key]; +} catch (_) {} + +assert(globalThis.evaluations.length > 0, "It triggers evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/trigger-not-exported-string-get.js b/test/language/import/import-defer/evaluation-triggers/trigger-not-exported-string-get.js new file mode 100644 index 00000000000..d0d08b5f418 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/trigger-not-exported-string-get.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/get.case +// - src/import-defer/trigger-on-possible-export/string-not-exported.template +/*--- +description: _ [[Get]] (of a string that is not an exported name, triggers execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + + + [[Get]] ( _P_, _Receiver_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryGet(_O_, _P_, _Receiver_). + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = "notExported"; + +ns[key]; + +assert(globalThis.evaluations.length > 0, "It triggers evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/trigger-not-exported-string-getOwnProperty.js b/test/language/import/import-defer/evaluation-triggers/trigger-not-exported-string-getOwnProperty.js new file mode 100644 index 00000000000..7f9ff03f080 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/trigger-not-exported-string-getOwnProperty.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/getOwnProperty.case +// - src/import-defer/trigger-on-possible-export/string-not-exported.template +/*--- +description: _ [[GetOwnProperty]] (of a string that is not an exported name, triggers execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + + + [[GetOwnProperty]] ( _P_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryGetOwnProperty(_O_, _P_). + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = "notExported"; + +Object.getOwnPropertyDescriptor(ns, key); + +assert(globalThis.evaluations.length > 0, "It triggers evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/trigger-not-exported-string-hasProperty.js b/test/language/import/import-defer/evaluation-triggers/trigger-not-exported-string-hasProperty.js new file mode 100644 index 00000000000..db9cabd294f --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/trigger-not-exported-string-hasProperty.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/hasProperty.case +// - src/import-defer/trigger-on-possible-export/string-not-exported.template +/*--- +description: _ [[HasProperty]] (of a string that is not an exported name, triggers execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + IsSymbolLikeNamespaceKey ( _P_, _O_ ) + 1. If _P_ is a Symbol, return *true*. + 1. If _ns_.[[Deferred]] is *true* and _P_ is "then", return *true*. + 1. Return *false*. + + GetModuleExportsList ( _O_ ) + 1. If _O_.[[Deferred]] is *true*, then + 1. Let _m_ be _O_.[[Module]]. + 1. If _m_ is a Cyclic Module Record, _m_.[[Status]] is not ~evaluated~, and ReadyForSyncExecution(_m_) is *false*, throw a *TypeError* exception. + 1. Perform ? EvaluateSync(_m_). + 1. Return _O_.[[Exports]]. + + + [[HasProperty]] ( _P_, _Receiver_ ) + 1. If IsSymbolLikeNamespaceKey(_P_, _O_), return ! OrdinaryGet(_O_, _P_, _Receiver_). + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +var key = "notExported"; + +key in ns; + +assert(globalThis.evaluations.length > 0, "It triggers evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/trigger-ownPropertyKey-names.js b/test/language/import/import-defer/evaluation-triggers/trigger-ownPropertyKey-names.js new file mode 100644 index 00000000000..770dc57c607 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/trigger-ownPropertyKey-names.js @@ -0,0 +1,25 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/ownPropertyKey-names.case +// - src/import-defer/trigger/trigger.template +/*--- +description: _ [[OwnPropertyKeys]] (triggers execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + [[OwnPropertyKeys]] ( ) + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +Object.getOwnPropertyNames(ns); + +assert(globalThis.evaluations.length > 0, "It triggers evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/trigger-ownPropertyKeys-symbols.js b/test/language/import/import-defer/evaluation-triggers/trigger-ownPropertyKeys-symbols.js new file mode 100644 index 00000000000..272e3999f04 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/trigger-ownPropertyKeys-symbols.js @@ -0,0 +1,25 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/ownPropertyKeys-symbols.case +// - src/import-defer/trigger/trigger.template +/*--- +description: _ [[OwnPropertyKeys]] (triggers execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + [[OwnPropertyKeys]] ( ) + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +Object.getOwnPropertySymbols(ns); + +assert(globalThis.evaluations.length > 0, "It triggers evaluation"); diff --git a/test/language/import/import-defer/evaluation-triggers/trigger-ownPropertyKeys.js b/test/language/import/import-defer/evaluation-triggers/trigger-ownPropertyKeys.js new file mode 100644 index 00000000000..e29aefcc7c6 --- /dev/null +++ b/test/language/import/import-defer/evaluation-triggers/trigger-ownPropertyKeys.js @@ -0,0 +1,25 @@ +// This file was procedurally generated from the following sources: +// - src/import-defer/ownPropertyKeys.case +// - src/import-defer/trigger/trigger.template +/*--- +description: _ [[OwnPropertyKeys]] (triggers execution) +esid: sec-module-namespace-exotic-objects +features: [import-defer] +flags: [generated, module] +info: | + [[OwnPropertyKeys]] ( ) + 1. Let _exports_ be ? GetModuleExportsList(_O_). + 1. ... + +---*/ + + +import "./setup_FIXTURE.js"; + +import defer * as ns from "./dep_FIXTURE.js"; + +assert.sameValue(globalThis.evaluations.length, 0, "import defer does not trigger evaluation"); + +Reflect.ownKeys(ns); + +assert(globalThis.evaluations.length > 0, "It triggers evaluation");