Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/export-defer/defineOwnProperty.case
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (C) 2026 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 _P_ is a Symbol, return OrdinaryDefineOwnProperty(_O_, _P_, _Desc_).
1. Let _current_ be ? _O_.[[GetOwnProperty]](_P_).
1. If _current_ is *undefined*, return *false*.
1. ...

template: trigger-on-exported
---*/

//- body
try {
Object.defineProperty(ns, key, { value: "hi" });
} catch (_) {}
20 changes: 20 additions & 0 deletions src/export-defer/delete.case
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (C) 2026 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 _P_ is a Symbol, return OrdinaryDelete(_O_, _P_).
1. Let _exports_ be _O_.[[Exports]].
1. If _exports_ contains _P_, return *false*.
1. Return *true*.

template: no-trigger-on-exported
---*/

//- body
try {
delete ns[key];
} catch (_) {}
19 changes: 19 additions & 0 deletions src/export-defer/get-in-prototype.case
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (C) 2026 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]] when namespace object is in the prototype chain
info: |
[[Get]] ( _P_, _Receiver_ )
1. If _P_ is a Symbol, return OrdinaryGet(_O_, _P_, _Receiver_).
1. Let _exports_ be _O_.[[Exports]].
1. If _exports_ does not contain _P_, return *undefined*.
1. ...

template: trigger-on-exported
---*/

//- body
const obj = Object.create(ns);
obj[key];
18 changes: 18 additions & 0 deletions src/export-defer/get.case
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (C) 2026 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 _P_ is a Symbol, return OrdinaryGet(_O_, _P_, _Receiver_).
1. Let _exports_ be _O_.[[Exports]].
1. If _exports_ does not contain _P_, return *undefined*.
1. ...

template: trigger-on-exported
---*/

//- body
ns[key];
19 changes: 19 additions & 0 deletions src/export-defer/getOwnProperty.case
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (C) 2026 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 _P_ is a Symbol, return OrdinaryGetOwnProperty(_O_, _P_).
1. Let _exports_ be _O_.[[Exports]].
1. If _exports_ does not contain _P_, return *undefined*.
1. Let value be ? _O_.[[Get]](_P_, _O_).
1. Return PropertyDescriptor { [[Value]]: _value_, [[Writable]]: *true*, [[Enumerable]]: *true*, [[Configurable]]: *false* }.

template: trigger-on-exported
---*/

//- body
Object.getOwnPropertyDescriptor(ns, key);
19 changes: 19 additions & 0 deletions src/export-defer/hasProperty-in-prototype.case
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (C) 2026 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]] when namespace object is in the prototype chain
info: |
[[HasProperty]] ( _P_ )
1. If _P_ is a Symbol, return OrdinaryHasProperty(_O_, _P_).
1. Let _exports_ be _O_.[[Exports]].
1. If _exports_ contains _P_, return *true*.
1. Return *false*.

template: no-trigger-on-exported
---*/

//- body
const obj = Object.create(ns);
key in obj;
18 changes: 18 additions & 0 deletions src/export-defer/hasProperty.case
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (C) 2026 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_ )
1. If _P_ is a Symbol, return OrdinaryHasProperty(_O_, _P_).
1. Let _exports_ be _O_.[[Exports]].
1. If _exports_ contains _P_, return *true*.
1. Return *false*.

template: no-trigger-on-exported
---*/

//- body
key in ns;
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright (C) 2026 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
path: language/export/export-defer/evaluation-triggers/ignore-exported-string-
name: of a string that is a deferred-reexported name, does not trigger evaluation
esid: sec-module-namespace-exotic-objects
info: |
EvaluateModuleSync is only inserted into [[Get]] by this proposal.
Operations that do not route through [[Get]] do not reach it,
even for a deferred-reexported name.

flags: [module]
features: [export-defer]
includes: [compareArray.js]
---*/

import "./setup_FIXTURE.js";

import * as ns from "./barrel_FIXTURE.js";

assert.compareArray(globalThis.evaluations, ["barrel"],
"barrel evaluated eagerly; deferred source not yet evaluated");

var key = "exported";

/*{ body }*/

assert.compareArray(globalThis.evaluations, ["barrel"],
"operation does not route through [[Get]], so deferred source is not evaluated");
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright (C) 2026 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
path: language/export/export-defer/evaluation-triggers/ignore-not-exported-string-
name: of a string that is not a deferred-reexported name, does not trigger evaluation
esid: sec-module-namespace-exotic-objects
info: |
EvaluateModuleSync is only inserted into [[Get]] by this proposal.
Operations that do not route through [[Get]] do not reach it,
even for a deferred-reexported name.

flags: [module]
features: [export-defer]
includes: [compareArray.js]
---*/

import "./setup_FIXTURE.js";

import * as ns from "./barrel_FIXTURE.js";

assert.compareArray(globalThis.evaluations, ["barrel"],
"barrel evaluated eagerly; deferred source not yet evaluated");

var key = "notExported";

/*{ body }*/

assert.compareArray(globalThis.evaluations, ["barrel"],
"operation does not route through [[Get]], so deferred source is not evaluated");
30 changes: 30 additions & 0 deletions src/export-defer/no-trigger-on-exported/then-exported.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright (C) 2026 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
path: language/export/export-defer/evaluation-triggers/ignore-exported-then-
name: of "then" when it is a deferred-reexported name, does not trigger evaluation
esid: sec-module-namespace-exotic-objects
info: |
EvaluateModuleSync is only inserted into [[Get]] by this proposal.
Operations that do not route through [[Get]] do not reach it,
even for a deferred-reexported name.

flags: [module]
features: [export-defer]
includes: [compareArray.js]
---*/

import "./setup_FIXTURE.js";

import * as ns from "./barrel-then_FIXTURE.js";

assert.compareArray(globalThis.evaluations, ["barrel"],
"barrel evaluated eagerly; deferred source not yet evaluated");

var key = "then";

/*{ body }*/

assert.compareArray(globalThis.evaluations, ["barrel"],
"operation does not route through [[Get]], so deferred source is not evaluated");
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright (C) 2026 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
path: language/export/export-defer/evaluation-triggers/ignore-not-exported-then-
name: of "then" when it is not a deferred-reexported name, does not trigger evaluation
esid: sec-module-namespace-exotic-objects
info: |
EvaluateModuleSync is only inserted into [[Get]] by this proposal.
Operations that do not route through [[Get]] do not reach it,
even for a deferred-reexported name.

flags: [module]
features: [export-defer]
includes: [compareArray.js]
---*/

import "./setup_FIXTURE.js";

import * as ns from "./barrel_FIXTURE.js";

assert.compareArray(globalThis.evaluations, ["barrel"],
"barrel evaluated eagerly; deferred source not yet evaluated");

var key = "then";

/*{ body }*/

assert.compareArray(globalThis.evaluations, ["barrel"],
"operation does not route through [[Get]], so deferred source is not evaluated");
28 changes: 28 additions & 0 deletions src/export-defer/no-trigger/no-trigger.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright (C) 2026 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
path: language/export/export-defer/evaluation-triggers/ignore-
name: does not trigger evaluation
esid: sec-module-namespace-exotic-objects
info: |
EvaluateModuleSync is only inserted into [[Get]] by this proposal.
Operations that do not route through [[Get]] do not reach it,
even for a deferred-reexported name.

flags: [module]
features: [export-defer]
includes: [compareArray.js]
---*/

import "./setup_FIXTURE.js";

import * as ns from "./barrel_FIXTURE.js";

assert.compareArray(globalThis.evaluations, ["barrel"],
"barrel evaluated eagerly; deferred source not yet evaluated");

/*{ body }*/

assert.compareArray(globalThis.evaluations, ["barrel"],
"operation does not route through [[Get]], so deferred source is not evaluated");
17 changes: 17 additions & 0 deletions src/export-defer/ownPropertyKey-names.case
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (C) 2026 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 _O_.[[Exports]].
1. Let _symbolKeys_ be OrdinaryOwnPropertyKeys(_O_).
1. Return the list-concatenation of _exports_ and _symbolKeys_.

template: no-trigger
---*/

//- body
Object.getOwnPropertyNames(ns);
17 changes: 17 additions & 0 deletions src/export-defer/ownPropertyKeys-symbols.case
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (C) 2026 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 _O_.[[Exports]].
1. Let _symbolKeys_ be OrdinaryOwnPropertyKeys(_O_).
1. Return the list-concatenation of _exports_ and _symbolKeys_.

template: no-trigger
---*/

//- body
Object.getOwnPropertySymbols(ns);
17 changes: 17 additions & 0 deletions src/export-defer/ownPropertyKeys.case
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (C) 2026 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 _O_.[[Exports]].
1. Let _symbolKeys_ be OrdinaryOwnPropertyKeys(_O_).
1. Return the list-concatenation of _exports_ and _symbolKeys_.

template: no-trigger
---*/

//- body
Reflect.ownKeys(ns);
17 changes: 17 additions & 0 deletions src/export-defer/set-string-exported.case
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (C) 2026 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: no-trigger
---*/

//- body
try {
ns.exported = "hi";
} catch (_) {}
17 changes: 17 additions & 0 deletions src/export-defer/set-string-not-exported.case
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (C) 2026 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: no-trigger
---*/

//- body
try {
ns.notExported = "hi";
} catch (_) {}
Loading
Loading