1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

fix(ext/node): include non-enumerable keys in Reflect.ownKeys(globalThis) (#21485)

Closes #21484.
This commit is contained in:
ud2 2023-12-08 00:04:44 +08:00 committed by GitHub
parent c1fc7b2cd5
commit 3f96e5a29a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 3 deletions

View file

@ -25,3 +25,4 @@ false
false
bar
bar
true

View file

@ -48,3 +48,5 @@ globals.checkWindowGlobal();
(globalThis as any).foo = "bar";
console.log((globalThis as any).foo);
console.log(globals.getFoo());
console.log(Reflect.ownKeys(globalThis).includes("console")); // non-enumerable keys are included

View file

@ -432,9 +432,14 @@ pub fn enumerator<'s>(
};
let inner = v8::Local::new(scope, inner);
let Some(array) =
inner.get_property_names(scope, GetPropertyNamesArgs::default())
else {
let Some(array) = inner.get_property_names(
scope,
GetPropertyNamesArgs {
mode: v8::KeyCollectionMode::OwnOnly,
property_filter: v8::PropertyFilter::ALL_PROPERTIES,
..Default::default()
},
) else {
return;
};