Skip to content

fix(ext/node): return all own properties from VM context property enumerator#32911

Merged
bartlomieju merged 1 commit intomainfrom
fix/vm-context-property-enumeration
Mar 23, 2026
Merged

fix(ext/node): return all own properties from VM context property enumerator#32911
bartlomieju merged 1 commit intomainfrom
fix/vm-context-property-enumeration

Conversation

@bartlomieju
Copy link
Copy Markdown
Member

Summary

  • VM context's property enumerator callbacks were using GetPropertyNamesArgs::default() which only returns enumerable, non-symbol properties
  • This caused Reflect.ownKeys(), Object.getOwnPropertyNames(), and Object.getOwnPropertySymbols() to return incomplete results inside VM contexts
  • Fix by using OwnOnly + ALL_PROPERTIES filter so non-enumerable properties and symbols are included
  • Also fixes a V8 crash in test-vm-global-property-enumerator (was a fatal Check failed: IsName panic)

Test plan

  • ./x test-compat parallel::test-vm-ownkeys passes (was failing)
  • ./x test-compat parallel::test-vm-ownpropertynames passes (was failing)
  • ./x test-compat parallel::test-vm-ownpropertysymbols passes (was failing)
  • ./x test-compat parallel::test-vm-global-get-own passes (was failing)
  • All 4 tests enabled in config.jsonc
  • No regressions in other parallel::test-vm- tests (55 pass vs 51 before)

🤖 Generated with Claude Code

…erator

The VM context's named and indexed property enumerator callbacks were
using `GetPropertyNamesArgs::default()` which filters to only enumerable
properties and skips symbols. This caused `Reflect.ownKeys()`,
`Object.getOwnPropertyNames()`, and `Object.getOwnPropertySymbols()`
to return incomplete results when called on a VM context's global object.

Fix by using `OwnOnly` collection mode with `ALL_PROPERTIES` filter, so
non-enumerable properties and symbols are included.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@bartlomieju bartlomieju changed the title fix(node/vm): return all own properties from VM context property enumerator fix(ext/node): return all own properties from VM context property enumerator Mar 22, 2026
@bartlomieju bartlomieju requested a review from Copilot March 22, 2026 15:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes Node.js vm context property enumeration in Deno’s Node-compat layer so that “own keys” queries inside VM contexts return complete results (including non-enumerable properties and symbols) and avoids a V8 crash seen in the VM global property enumerator path.

Changes:

  • Update VM context named property enumerator to collect own non-index keys with ALL_PROPERTIES (incl. non-enumerable + symbols).
  • Update VM context indexed property enumerator to collect own numeric keys (incl. non-enumerable) and keep them as numbers.
  • Enable the corresponding Node-compat VM tests in tests/node_compat/config.jsonc.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
tests/node_compat/config.jsonc Enables additional parallel/test-vm-* coverage related to ownKeys/getOwnProperty* behavior in VM contexts.
ext/node/ops/vm.rs Adjusts V8 GetPropertyNames argument configuration for VM context enumerator callbacks to include all own properties and prevent invalid key types from reaching V8.

Comment thread ext/node/ops/vm.rs
Comment thread ext/node/ops/vm.rs
@bartlomieju bartlomieju merged commit ceb6936 into main Mar 23, 2026
117 checks passed
@bartlomieju bartlomieju deleted the fix/vm-context-property-enumeration branch March 23, 2026 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants