Skip to content

vm: preserve global function declaration restrictions - #65061

Open
subotac wants to merge 1 commit into
nodejs:mainfrom
subotac:fix/vm-global-lexical-declaration
Open

vm: preserve global function declaration restrictions#65061
subotac wants to merge 1 commit into
nodejs:mainfrom
subotac:fix/vm-global-lexical-declaration

Conversation

@subotac

@subotac subotac commented Aug 5, 2026

Copy link
Copy Markdown

Global function declarations in a context can be reflected as configurable sandbox properties while V8 tracks their global bindings as non-configurable.

When the property query interceptor finds the sandbox property first, preserve the DontDelete attribute from the global proxy. This ensures that a subsequent lexical declaration is rejected with a SyntaxError.

Extend the existing restricted-global-property test to cover a function declaration followed by a conflicting lexical declaration.

Fixes: #65025

Keep the global proxy's DontDelete attribute when the sandbox also
contains the property, so lexical redeclarations are rejected.

Signed-off-by: subotac <73706465+subotac@users.noreply.github.com>
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. vm Issues and PRs related to the vm subsystem. labels Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. vm Issues and PRs related to the vm subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vm: lexical declaration no longer throws SyntaxError over a global function declaration in vm context (regression in v26.6.0)

2 participants