fix(ext/node): return all own properties from VM context property enumerator#32911
Merged
bartlomieju merged 1 commit intomainfrom Mar 23, 2026
Merged
fix(ext/node): return all own properties from VM context property enumerator#32911bartlomieju merged 1 commit intomainfrom
bartlomieju merged 1 commit intomainfrom
Conversation
…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>
Contributor
There was a problem hiding this comment.
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GetPropertyNamesArgs::default()which only returns enumerable, non-symbol propertiesReflect.ownKeys(),Object.getOwnPropertyNames(), andObject.getOwnPropertySymbols()to return incomplete results inside VM contextsOwnOnly+ALL_PROPERTIESfilter so non-enumerable properties and symbols are includedtest-vm-global-property-enumerator(was a fatalCheck failed: IsNamepanic)Test plan
./x test-compat parallel::test-vm-ownkeyspasses (was failing)./x test-compat parallel::test-vm-ownpropertynamespasses (was failing)./x test-compat parallel::test-vm-ownpropertysymbolspasses (was failing)./x test-compat parallel::test-vm-global-get-ownpasses (was failing)config.jsoncparallel::test-vm-tests (55 pass vs 51 before)🤖 Generated with Claude Code