Skip to content

node:vm: var x over a sandbox property no longer creates a dead undefined binding - #34074

Closed
robobun wants to merge 6 commits into
mainfrom
claude/e5a1efae/vm-var-over-sandbox-prop
Closed

robobun wants to merge 6 commits into
mainfrom
claude/e5a1efae/vm-var-over-sandbox-prop

Conversation

@robobun

@robobun robobun commented Jul 13, 2026 •

Copy link
Copy Markdown
Collaborator

Repro

import * as vm from "node:vm";
const b = {};
Object.defineProperty(b, "cfg", { value: 42, writable: false, enumerable: true, configurable: false });
vm.createContext(b);
console.log(vm.runInContext("var cfg; [typeof cfg, String(cfg), String(globalThis.cfg)].join('/')", b));
// bun:  "undefined/undefined/42"   node: "number/42/42"
console.log(vm.runInContext("[typeof cfg, String(cfg), String(globalThis.cfg)].join('/')", b));
// a later script, no `var`:
// bun STILL: "undefined/undefined/42"   node: "number/42/42"

Exposing read-only config on the sandbox (Object.defineProperty(box, 'cfg', { value, writable: false })) is the canonical contextify pattern. On Bun the moment any guest code declared var cfg, every subsequent unqualified read in the context saw undefined forever while globalThis.cfg still held the real value. The same thing happened for writable data properties and getter-only accessors; a top-level function cfg(){} over a non-writable non-configurable property was a silent no-op instead of throwing.

Cause

JSC's ProgramExecutable::initializeGlobalProperties calls JSGlobalObject::getOwnPropertySlot directly, not through the method table, so createGlobalVarBinding / canDeclareGlobalFunction never see NodeVMGlobalObject's override and never see the sandbox. For a var cfg declaration that check returns "not found", JSC adds a fresh symbol-table slot initialised to undefined, and abstractAccess then resolves every unqualified cfg to that slot as GlobalVar, bypassing the method-table lookup that would have reached the sandbox. globalThis.cfg goes through the method table, so it kept working.

Fix

Before each JSC::evaluate on a contextified global, fetch the program's UnlinkedProgramCodeBlock from the code cache (the evaluate that follows reuses it, so no extra parse) and, for each name in its variableDeclarations() that the sandbox already owns and the global does not, install a direct property on the NodeVMGlobalObject whose attributes mirror the sandbox's (value is a placeholder; accessors mirror as read-only). JSGlobalObject::getOwnPropertySlot now reports those names, so createGlobalVarBinding returns early without adding a symbol-table slot and canDeclareGlobalFunction sees the real attributes (so function cfg(){} over a non-configurable non-writable property throws TypeError, per spec). ProhibitsPropertyCaching on NodeVMGlobalObject keeps the link-time resolve type at uncached GlobalProperty, and runtime reads still route through our method-table override which consults the sandbox first, so the placeholder value is never observed.

Because the mirroring is driven by the program's own declarations, a script with no var/function declarations touches nothing; a host-side delete sandbox.x between runs leaves no phantom property behind, and the global-side binding for a declared name (which matches Node's behaviour) survives the sandbox delete.

In NodeVMGlobalObject::put, once the sandbox's setter has handled a write, stop forwarding to Base::put regardless of the accessor's enumerability: the only global-side copy for an accessor is the read-only materialised placeholder, which Base::put would fail on.

Verification

30 new cases in test/js/node/vm/vm.test.ts across runInContext / runInNewContext / Script#runInContext / Script#runInNewContext, covering read-only data, getter-only accessor, writable data, non-enumerable, late-added, persistence across scripts, the function-declaration error, plus guards that a declaration-free script leaves no placeholder behind and that declared bindings survive host-side sandbox delete. 24 fail on 1.4.0 and all 30 pass with the fix. All 95 test/js/node/test/parallel/test-vm-*.js pass.

Related open PRs touching NodeVMGlobalObject::put for adjacent behaviours: #33486, #34072. None address this bug; whichever lands first the others will want a small rebase.


[review] gate passed · iteration 1 · 4 files touched

fails on main (without fix)
ASAN without fix: 24 failed, 68 skipped
$ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test "--reporter=junit" "--reporter-outfile=/tmp/mechgate.xml" test/js/node/vm/vm.test.ts
info: syncing channel updates for nightly-2026-05-06-x86_64-unknown-linux-gnu
info: latest update on 2026-05-06 for version 1.97.0-nightly (e95e73209 2026-05-05)
info: component rust-src is up to date
info: checking for self-update (current version: 1.29.0)
bun test v1.4.0 (1935ced70)

test/js/node/vm/vm.test.ts:
(pass) vm > runInContext() > can do nothing [21.18ms]
(pass) vm > runInContext() > can return a value [15.14ms]
(pass) vm > runInContext() > can return a complex value [14.87ms]
(pass) vm > runInContext() > can return the last value [14.51ms]
(pass) vm > runInContext() > new ArrayBuffer() in VM context doesn't crash [16.08ms]
(pass) vm > runInContext() > new SharedArrayBuffer() in VM context doesn't crash [13.57ms]
(pass) vm > runInContext() > new Uint8Array() in VM context doesn't crash [15.11ms]
(pass) vm > runInContext() > new Int8Array() in VM context doesn't crash [14.80ms]
(pass) vm > runInContext() > new Uint16Array() in VM context doesn't crash [15.52ms]
(pass) vm > runInContext() > new Int16
... (truncated)

release without fix: 4 failed, 68 skipped
bun test v1.4.0-canary.1 (9a807962b)

test/js/node/vm/vm.test.ts:
(pass) vm > runInContext() > can do nothing [0.46ms]
(pass) vm > runInContext() > can return a value [0.24ms]
(pass) vm > runInContext() > can return a complex value [0.21ms]
(pass) vm > runInContext() > can return the last value [0.22ms]
(pass) vm > runInContext() > new ArrayBuffer() in VM context doesn't crash [0.25ms]
(pass) vm > runInContext() > new SharedArrayBuffer() in VM context doesn't crash [0.17ms]
(pass) vm > runInContext() > new Uint8Array() in VM context doesn't crash [0.21ms]
(pass) vm > runInContext() > new Int8Array() in VM context doesn't crash [0.19ms]
(pass) vm > runInContext() > new Uint16Array() in VM context doesn't crash [0.20ms]
(pass) vm > runInContext() > new Int16Array() in VM context doesn't crash [0.17ms]
(pass) vm > runInContext() > new Uint32Array() in VM context doesn't crash [0.15ms]
(pass) vm > runInContext() > new Int32Array() in VM context doesn't crash [0.16ms]
(pass) vm > runInContext() > new Float32Array() in VM context doesn't crash [0.15ms]
(pass) vm > runInContext() > new Float64Array() in VM context doesn't crash [0.16ms]
(pass) vm > runInContext() > new Big
... (truncated)
passes on PR (with fix)
ASAN with fix: 68 skipped
$ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test "--reporter=junit" "--reporter-outfile=/tmp/mechgate.xml" test/js/node/vm/vm.test.ts
info: syncing channel updates for nightly-2026-05-06-x86_64-unknown-linux-gnu
info: latest update on 2026-05-06 for version 1.97.0-nightly (e95e73209 2026-05-05)
info: component rust-src is up to date
info: checking for self-update (current version: 1.29.0)
bun test v1.4.0 (1935ced70)

test/js/node/vm/vm.test.ts:
(pass) vm > runInContext() > can do nothing [26.83ms]
(pass) vm > runInContext() > can return a value [16.02ms]
(pass) vm > runInContext() > can return a complex value [16.99ms]
(pass) vm > runInContext() > can return the last value [15.79ms]
(pass) vm > runInContext() > new ArrayBuffer() in VM context doesn't crash [16.86ms]
(pass) vm > runInContext() > new SharedArrayBuffer() in VM context doesn't crash [14.08ms]
(pass) vm > runInContext() > new Uint8Array() in VM context doesn't crash [16.10ms]
(pass) vm > runInContext() > new Int8Array() in VM context doesn't crash [15.64ms]
(pass) vm > runInContext() > new Uint16Array() in VM context doesn't crash [15.34ms]
(pass) vm > runInContext() > new Int16
... (truncated)

release with fix: 68 skipped
$ bun scripts/build.ts --profile=release
info: syncing channel updates for nightly-2026-05-06-x86_64-unknown-linux-gnu
info: latest update on 2026-05-06 for version 1.97.0-nightly (e95e73209 2026-05-05)
info: component rust-src is up to date
info: checking for self-update (current version: 1.29.0)
[configured] bun-profile → bun (stripped) in 696ms (unchanged)
ninja: Entering directory `/workspace/bun/build/release'
[1/11] cxx obj/unified/UnifiedSource-src_jsc_bindings_vm-0.cpp.o
[2/11] cxx obj/unified/UnifiedSource-src_jsc_bindings-3.cpp.o
[3/11] cxx obj/src/jsc/bindings/ZigGlobalObject.cpp.o
[4/11] cxx obj/unified/UnifiedSource-src_jsc_bindings-0.cpp.o
[5/11] cxx obj/unified/UnifiedSource-src_jsc_bindings-1.cpp.o
[6/11] gen cpp.rs (cppbind)
[6/11] cargo bun_bin → libbun_rust.a (--target x86_64-unknown-linux-gnu)
info: syncing channel updates for nightly-2026-05-06-x86_64-unknown-linux-gnu
info: latest update on 2026-05-06 for version 1.97.0-nightly (e95e73209 2026-05-05)
info: component rust-src is up to date
info: component rust-std is up to date

info: checking for self-update (current version: 1.29.0)
  nightly-2026-05-06-x86_64-unknown-linux-gnu unchanged -
... (truncated)
diff hotspot
src/jsc/bindings/NodeVM.cpp       | 78 ++++++++++++++++++++++++++++++++-
 src/jsc/bindings/NodeVM.h         |  1 +
 src/jsc/bindings/NodeVMScript.cpp |  1 +
 test/js/node/vm/vm.test.ts        | 92 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 171 insertions(+), 1 deletion(-)

gate history · 5 passed · 0 rejected · iteration 1

evidence per changed file
file                               reads  edits  tests
src/jsc/bindings/NodeVM.cpp           10     17      0
src/jsc/bindings/NodeVM.h              2      3      0
src/jsc/bindings/NodeVMScript.cpp      2      3      0
test/js/node/vm/vm.test.ts             6      7      0

…luating

JSC's GlobalDeclarationInstantiation consults JSGlobalObject::getOwnPropertySlot
directly (not through the method table), so createGlobalVarBinding and
canDeclareGlobalFunction never see properties that live on the contextified
sandbox. A program-level `var x` / `function x(){}` over an existing sandbox
property would add a fresh undefined symbol-table slot, and that slot then wins
every unqualified lookup for the rest of the context's lifetime while
`globalThis.x` still reads the sandbox value.

Before each evaluate, enumerate the sandbox's own string properties and
putDirect a placeholder with the same configurable/enumerable/writable
attributes onto the NodeVMGlobalObject for any name the global doesn't already
know about. JSGlobalObject::getOwnPropertySlot now finds them and
createGlobalVarBinding skips the symbol-table slot; canDeclareGlobalFunction
sees the real attributes so a function declaration over a non-configurable
non-writable sandbox property throws as the spec requires. Actual reads still
route through the method-table override, which consults the sandbox first, so
the placeholder value is never observed.

In NodeVMGlobalObject::put, once the sandbox accepts a write for a name that is
not also a global symbol-table slot, skip the forward to Base::put: the only
global-side copy is the (possibly read-only) placeholder, which is never read.
@robobun

robobun commented Jul 13, 2026 •

Copy link
Copy Markdown
Collaborator Author

Status: fix is ready; all review threads resolved.

Repro: bun bd test test/js/node/vm/vm.test.ts -t "var/function declarations" (34 pass with the fix; 24 of them fail on main). All 95 test/js/node/test/parallel/test-vm-*.js pass.

CI build 72546: 284/286 jobs green. The two failing jobs are test-worker-message-port-transfer-terminate.js on x64-asan and grpc-js/test-tonic.test.ts on darwin-aarch64, both tagged [pre-existing] (fail on main too) and unrelated to this node:vm change. No vm.test.ts or test-vm-* failures on any lane.

PR: #34074

@coderabbitai

coderabbitai Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Changes

Node VM contexts now materialize sandbox-owned var and function declarations before evaluation, preserve relevant property attributes, handle sandbox accessors consistently, and test descriptor, cross-script, and deletion scenarios.

VM declaration handling

Layer / File(s) Summary
Declaration materialization
src/jsc/bindings/NodeVM.h, src/jsc/bindings/NodeVM.cpp
Adds declaration parsing and materializes missing global properties with sandbox-derived attributes.
Context execution wiring
src/jsc/bindings/NodeVM.cpp, src/jsc/bindings/NodeVMScript.cpp
Runs materialization before evaluation and routes sandbox accessors through the sandbox.
Declaration behavior coverage
test/js/node/vm/vm.test.ts
Tests descriptor combinations, repeated scripts, sandbox mutations, and host-side deletion behavior.

Suggested reviewers: alii, cirospaciari, jarred-sumner, sosukesuzuki

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly describes the main vm bug fix and matches the changed behavior.
Description check ✅ Passed It explains the bug, fix, and verification, though it uses Repro/Cause/Fix/Verification instead of the template headings.

Comment @coderabbitai help to get the list of available commands.

@robobun

robobun commented Jul 13, 2026 •

Copy link
Copy Markdown
Collaborator Author
Updated 5:05 PM PT - Jul 13th, 2026

❌ @autofix-ci[bot], your commit 1935ced has 2 failures in Build #72546 (All Failures):


🧪   To try this PR locally:

bunx bun-pr 34074

That installs a local version of the PR into your bun-34074 executable, so you can run:

bun-34074 --bun

Comment thread src/jsc/bindings/NodeVM.cpp Resolved
Comment thread test/js/node/vm/vm.test.ts Resolved
…ares

The first cut mirrored every sandbox own property onto the context global
before each evaluate. A script with no declarations would still leave
placeholder properties behind, so a host-side `delete sandbox.x` between runs
made the placeholder observable (`'x' in this` true, unqualified `x`
resolving to undefined instead of ReferenceError).

Drive the mirroring from the program's own variableDeclarations instead: fetch
the UnlinkedProgramCodeBlock from the code cache (the evaluate that follows
reuses it) and only materialise names that appear there and that the sandbox
already owns. A script with no declarations touches nothing; a declared name
that the sandbox also owns gets a direct-property placeholder with the
sandbox's configurable/enumerable/writable bits so createGlobalVarBinding skips
the symbol-table slot and canDeclareGlobalFunction sees real attributes.

In put(), once the sandbox setter handles the write for an accessor property,
stop forwarding to Base regardless of the accessor's enumerability: the only
global-side copy is the (read-only) materialised placeholder, which Base::put
would fail on.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/jsc/bindings/NodeVM.cpp`:
- Around line 1186-1188: Update the guard in the sandbox setter around
isDeclaredOnSandbox and getter.isAccessor() to also bypass Base::put for native
custom accessors, matching the declarations materialized by
materializeSandboxPropertiesForDeclarations. Preserve the existing behavior for
regular accessors and ensure custom-accessor writes short-circuit before
reaching the read-only placeholder.
- Around line 1482-1483: Update the call to
context->materializeSandboxPropertiesForDeclarations in NodeVM initialization to
pass context as the lexicalGlobalObject argument instead of globalObject,
ensuring sandbox property lookup and traps use the executing sandbox realm.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: dd677f5e-1f77-479c-91b0-5ee75599333a

📥 Commits

Reviewing files that changed from the base of the PR and between a59a9c3 and 5f8f43b.

📒 Files selected for processing (4)
  • src/jsc/bindings/NodeVM.cpp
  • src/jsc/bindings/NodeVM.h
  • src/jsc/bindings/NodeVMScript.cpp
  • test/js/node/vm/vm.test.ts

Comment thread src/jsc/bindings/NodeVM.cpp Resolved
Comment thread src/jsc/bindings/NodeVM.cpp Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/jsc/bindings/NodeVM.cpp (1)

1097-1101: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Refresh stale materialized descriptors after sandbox redefinition.

alreadyOnGlobal also matches placeholders created by an earlier script. If the sandbox property is deleted and later recreated with different attributes, this branch skips rematerialization, so global declaration checks continue seeing the old descriptor. For example, an accessor or non-configurable property can be recreated as a writable data property (or vice versa), causing subsequent var/function declaration checks to use incorrect semantics.

Track materialized placeholders separately and resynchronize/remove them when the sandbox descriptor changes; do not treat every existing global property as authoritative.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/jsc/bindings/NodeVM.cpp` around lines 1097 - 1101, Update the
global-property handling around alreadyOnGlobal so it distinguishes materialized
placeholders from authoritative global properties. When a sandbox property is
deleted and recreated with different attributes, resynchronize or remove the
stale placeholder before declaration checks; only skip rematerialization for
unchanged authoritative properties, preserving correct var/function semantics
for accessor, non-configurable, and writable data descriptors.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/jsc/bindings/NodeVM.cpp`:
- Around line 1097-1101: Update the global-property handling around
alreadyOnGlobal so it distinguishes materialized placeholders from authoritative
global properties. When a sandbox property is deleted and recreated with
different attributes, resynchronize or remove the stale placeholder before
declaration checks; only skip rematerialization for unchanged authoritative
properties, preserving correct var/function semantics for accessor,
non-configurable, and writable data descriptors.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: bbb35a72-57ef-496f-8ddc-4bdedf90fbb9

📥 Commits

Reviewing files that changed from the base of the PR and between 5f8f43b and 997d7fc.

📒 Files selected for processing (1)
  • src/jsc/bindings/NodeVM.cpp

@robobun

robobun commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator Author

Re the outside-diff finding about stale placeholder attributes when a sandbox property is redefined between scripts: that is not a regression. The only observable case is function x(){} over a property that was writable/configurable when first declared over but has since been redefined as non-writable non-configurable:

const sandbox = { x: 1 };
vm.createContext(sandbox);
vm.runInContext("var x;", sandbox);
Object.defineProperty(sandbox, "x", { value: 42, writable: false, configurable: false });
vm.runInContext("function x(){}", sandbox);
// node:    throws
// main:    silent no-op (sandbox.x stays 42)
// this PR: silent no-op (sandbox.x stays 42)

main already produces the silent no-op for exactly the same reason it produces it for the single-script case this PR fixes (the static JSGlobalObject::getOwnPropertySlot never consults the sandbox). Tracking materialised names to refresh attributes across redefinition would also have to distinguish a placeholder from a createGlobalFunctionBinding upgrade; I would rather land the original four-face fix on its own and follow up separately if that corner matters.

Comment thread src/jsc/bindings/NodeVM.cpp Resolved
Comment thread src/jsc/bindings/NodeVM.cpp Resolved
Comment thread src/jsc/bindings/NodeVM.cpp Resolved
robobun and others added 2 commits July 13, 2026 22:18
The prototype-walking getPropertySlot used to populate the accessor check also
finds inherited DontEnum accessors like Object.prototype.__proto__, so dropping
the DontEnum gate made `this.__proto__ = X` inside a context return early and
leave the vm global's [[Prototype]] unchanged. Gate the bypass on
getter.slotBase() == sandbox so only an own accessor on the sandbox
short-circuits; inherited ones fall through to Base::put as before.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No new issues found in this pass. This touches deep JSC internals (ProgramExecutable/UnlinkedProgramCodeBlock code-cache access, direct-property placeholders on NodeVMGlobalObject to steer GlobalDeclarationInstantiation) and the put() accessor-bypass semantics, so a maintainer familiar with the vm bindings should sign off on the approach — especially given #33486/#34072 touch the same put() path.

Checked across review rounds and ruled out: stale placeholders after host-side delete (now declaration-driven, tested); __proto__ regression from dropping the DontEnum gate (now own-only via slotBase() == sandbox, tested); the RO+DD defineOwnProperty short-circuit vs placeholder value (Base::defineOwnProperty re-reads the descriptor via method table, tested); the Proxy-trap clearException() matches Node's trap-bypassing behaviour and is not a regression.

Extended reasoning...

Overview

Adds NodeVMGlobalObject::materializeSandboxPropertiesForDeclarations(), called before JSC::evaluate at both runInContext entry points. It fetches the program's UnlinkedProgramCodeBlock from the code cache, iterates variableDeclarations(), and for each name the sandbox owns but the base global does not, installs a direct property on the vm global mirroring the sandbox's attributes. This makes JSC's static JSGlobalObject::getOwnPropertySlot (used by createGlobalVarBinding/canDeclareGlobalFunction) observe those names, preventing the dead-undefined symbol-table slot. Also widens the put() accessor-bypass to isAccessor() || isCustom() while restricting it to own accessors via slotBase() == sandbox. 30 new tests across all four runIn* entry points; all 95 test-vm-*.js reported passing.

Security risks

node:vm is not a security boundary, but the change does affect how sandbox properties are surfaced on the vm global and how writes route through Base::put. The __proto__ handling was specifically examined (a real regression was caught and fixed in 978da1d). The clearException() after a Proxy trap throw is a deliberate Node-compat choice (V8's contextify Query bypasses traps entirely) and does not swallow anything Node would surface. No new user-controlled-input parsing.

Level of scrutiny

High. This is C++ JSC bindings code with subtle interactions between JSC's static vs method-table property lookup, the code cache, GlobalDeclarationInstantiation semantics, and property-attribute mirroring. The approach — pre-parsing via the code cache to enumerate declarations and installing attribute-only placeholders — is a novel architectural decision that works around JSC's static getOwnPropertySlot call, and a maintainer should confirm it is preferable to alternatives (e.g. patching the JSC call site). The put() change alters an existing guard whose original DontEnum gate had unclear intent.

Other factors

  • Multiple review rounds already caught and fixed real regressions (stale placeholders, __proto__ inherited-accessor bypass), which suggests the interaction surface is genuinely tricky.
  • The author explicitly flagged two in-flight PRs (#33486, #34072) touching NodeVMGlobalObject::put; whichever lands first the others need a rebase — coordination a human should handle.
  • One acknowledged corner deferred to a follow-up: sandbox property redefined to non-writable/non-configurable between scripts, then function x(){} — silent no-op on both main and this PR (not a regression, but not Node-matching either).
  • The one CI failure (test-worker-message-port-transfer-terminate.js SIGABRT on x64-asan) appears unrelated to this diff.

@robobun

robobun commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator Author

#39588 reworks how a contextified global resolves against its sandbox and covers this case. On a build of that branch, the repro from this description prints number/42/42 for the script with var cfg; and for the later script, and function cfg(){} over the read-only, non-configurable property throws, as in Node. The 30 tests from this PR pass when applied on top of that branch (its own coverage is the "var / function declarations over an existing read-only property" test). Closing in favor of #39588.

@robobun robobun closed this Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant