diff --git a/src/import-defer/evaluation-triggers/defineOwnProperty.case b/src/import-defer/evaluation-triggers/defineOwnProperty.case new file mode 100644 index 0000000000..53a6e8d290 --- /dev/null +++ b/src/import-defer/evaluation-triggers/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/evaluation-triggers/delete.case b/src/import-defer/evaluation-triggers/delete.case new file mode 100644 index 0000000000..7c98eca4e2 --- /dev/null +++ b/src/import-defer/evaluation-triggers/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/evaluation-triggers/get.case b/src/import-defer/evaluation-triggers/get.case new file mode 100644 index 0000000000..26ab7d764e --- /dev/null +++ b/src/import-defer/evaluation-triggers/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/evaluation-triggers/getOwnProperty.case b/src/import-defer/evaluation-triggers/getOwnProperty.case new file mode 100644 index 0000000000..835e75b2c9 --- /dev/null +++ b/src/import-defer/evaluation-triggers/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/evaluation-triggers/getPrototypeOf.case b/src/import-defer/evaluation-triggers/getPrototypeOf.case new file mode 100644 index 0000000000..39a403f4df --- /dev/null +++ b/src/import-defer/evaluation-triggers/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/evaluation-triggers/hasProperty.case b/src/import-defer/evaluation-triggers/hasProperty.case new file mode 100644 index 0000000000..44bab78a4b --- /dev/null +++ b/src/import-defer/evaluation-triggers/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/evaluation-triggers/ignore/ignore.template b/src/import-defer/evaluation-triggers/ignore/ignore.template new file mode 100644 index 0000000000..e4ba090495 --- /dev/null +++ b/src/import-defer/evaluation-triggers/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/evaluation-triggers/isExtensible.case b/src/import-defer/evaluation-triggers/isExtensible.case new file mode 100644 index 0000000000..429c796ab7 --- /dev/null +++ b/src/import-defer/evaluation-triggers/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/evaluation-triggers/ownPropertyKey-names.case b/src/import-defer/evaluation-triggers/ownPropertyKey-names.case new file mode 100644 index 0000000000..a4723edec2 --- /dev/null +++ b/src/import-defer/evaluation-triggers/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/evaluation-triggers/ownPropertyKeys-symbols.case b/src/import-defer/evaluation-triggers/ownPropertyKeys-symbols.case new file mode 100644 index 0000000000..cbf7e39ff7 --- /dev/null +++ b/src/import-defer/evaluation-triggers/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/evaluation-triggers/ownPropertyKeys.case b/src/import-defer/evaluation-triggers/ownPropertyKeys.case new file mode 100644 index 0000000000..9716b0d808 --- /dev/null +++ b/src/import-defer/evaluation-triggers/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/evaluation-triggers/preventExtensions.case b/src/import-defer/evaluation-triggers/preventExtensions.case new file mode 100644 index 0000000000..66ef7b39ef --- /dev/null +++ b/src/import-defer/evaluation-triggers/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/evaluation-triggers/set-string-exported.case b/src/import-defer/evaluation-triggers/set-string-exported.case new file mode 100644 index 0000000000..eedfefec7f --- /dev/null +++ b/src/import-defer/evaluation-triggers/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/evaluation-triggers/set-string-not-exported.case b/src/import-defer/evaluation-triggers/set-string-not-exported.case new file mode 100644 index 0000000000..fb92e61d79 --- /dev/null +++ b/src/import-defer/evaluation-triggers/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/evaluation-triggers/setPrototypeOf.case b/src/import-defer/evaluation-triggers/setPrototypeOf.case new file mode 100644 index 0000000000..1dd218f590 --- /dev/null +++ b/src/import-defer/evaluation-triggers/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/evaluation-triggers/trigger-on-possible-export/string-exported.template b/src/import-defer/evaluation-triggers/trigger-on-possible-export/string-exported.template new file mode 100644 index 0000000000..9011006fb7 --- /dev/null +++ b/src/import-defer/evaluation-triggers/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/evaluation-triggers/trigger-on-possible-export/string-not-exported.template b/src/import-defer/evaluation-triggers/trigger-on-possible-export/string-not-exported.template new file mode 100644 index 0000000000..323fd59101 --- /dev/null +++ b/src/import-defer/evaluation-triggers/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/evaluation-triggers/trigger-on-possible-export/symbol-other.template b/src/import-defer/evaluation-triggers/trigger-on-possible-export/symbol-other.template new file mode 100644 index 0000000000..2f10ccc389 --- /dev/null +++ b/src/import-defer/evaluation-triggers/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/evaluation-triggers/trigger-on-possible-export/symbol-toStringTag.template b/src/import-defer/evaluation-triggers/trigger-on-possible-export/symbol-toStringTag.template new file mode 100644 index 0000000000..181e5e0bcf --- /dev/null +++ b/src/import-defer/evaluation-triggers/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/evaluation-triggers/trigger-on-possible-export/then-exported.template b/src/import-defer/evaluation-triggers/trigger-on-possible-export/then-exported.template new file mode 100644 index 0000000000..d33f7bd12d --- /dev/null +++ b/src/import-defer/evaluation-triggers/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/evaluation-triggers/trigger-on-possible-export/then-not-exported.template b/src/import-defer/evaluation-triggers/trigger-on-possible-export/then-not-exported.template new file mode 100644 index 0000000000..1b8485ec06 --- /dev/null +++ b/src/import-defer/evaluation-triggers/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/evaluation-triggers/trigger/trigger.template b/src/import-defer/evaluation-triggers/trigger/trigger.template new file mode 100644 index 0000000000..e7fbe80c83 --- /dev/null +++ b/src/import-defer/evaluation-triggers/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 c7588800e4..0000000000 --- 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 4cd7224c55..0000000000 --- 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 47f441bffa..0000000000 --- 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 e2438de032..0000000000 --- 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 e2416db5bb..0000000000 --- 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 d2b82a7b84..0000000000 --- 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 21e82b4182..0000000000 --- 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 0000000000..59c7770dcc --- /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 0000000000..d6118da264 --- /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 0000000000..36f2947eaf --- /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/evaluation-triggers/defineOwnProperty.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..bebdade6a9 --- /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/evaluation-triggers/delete.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..09e56bd24b --- /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/evaluation-triggers/get.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..67d8345e75 --- /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/evaluation-triggers/getOwnProperty.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..1b93cb88e0 --- /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/evaluation-triggers/hasProperty.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..2dee455823 --- /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/evaluation-triggers/getPrototypeOf.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..2e196619a8 --- /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/evaluation-triggers/isExtensible.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..f2ab01089c --- /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/evaluation-triggers/defineOwnProperty.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..4338472cf3 --- /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/evaluation-triggers/delete.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..57906a99b2 --- /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/evaluation-triggers/get.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..163952c777 --- /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/evaluation-triggers/getOwnProperty.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..86bd884769 --- /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/evaluation-triggers/hasProperty.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..6defd03890 --- /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/evaluation-triggers/preventExtensions.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..bd525cebc2 --- /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/evaluation-triggers/set-string-exported.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..0f22ab440a --- /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/evaluation-triggers/set-string-not-exported.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..9f6d3af68d --- /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/evaluation-triggers/setPrototypeOf.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..010a1387bc --- /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/evaluation-triggers/defineOwnProperty.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..5ae8148bf8 --- /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/evaluation-triggers/delete.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..1fbcd94277 --- /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/evaluation-triggers/get.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..ee894da4da --- /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/evaluation-triggers/getOwnProperty.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..6098311fff --- /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/evaluation-triggers/hasProperty.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..f0e16b2dcb --- /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/evaluation-triggers/defineOwnProperty.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..625e441f9d --- /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/evaluation-triggers/delete.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..57d67a78c3 --- /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/evaluation-triggers/get.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..a33d58edfa --- /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/evaluation-triggers/getOwnProperty.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..c2cc499b7c --- /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/evaluation-triggers/hasProperty.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..d71b2fa95e --- /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 0000000000..53b7af9cd8 --- /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/evaluation-triggers/defineOwnProperty.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..9b75739017 --- /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/evaluation-triggers/delete.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..2b45be6a73 --- /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/evaluation-triggers/get.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..3d1b055d1a --- /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/evaluation-triggers/getOwnProperty.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..8adcc995c2 --- /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/evaluation-triggers/hasProperty.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..f916d1ea3c --- /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/evaluation-triggers/defineOwnProperty.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..8f33c4d72d --- /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/evaluation-triggers/delete.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..7b29d74300 --- /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/evaluation-triggers/get.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..892a0695bd --- /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/evaluation-triggers/getOwnProperty.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..0b5af8c00f --- /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/evaluation-triggers/hasProperty.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..f232522f6e --- /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/evaluation-triggers/ownPropertyKey-names.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..8054f7c4b6 --- /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/evaluation-triggers/ownPropertyKeys-symbols.case +// - ./src/import-defer/evaluation-triggers/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 0000000000..cade15da44 --- /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/evaluation-triggers/ownPropertyKeys.case +// - ./src/import-defer/evaluation-triggers/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");