summaryrefslogtreecommitdiff
path: root/ext/node/global.rs
diff options
context:
space:
mode:
authorsnek <snek@deno.com>2024-07-09 10:07:56 -0700
committerGitHub <noreply@github.com>2024-07-09 10:07:56 -0700
commitc461f8fd2e36904b3334c9705726b713712f4a69 (patch)
tree796892fa6c0427b959e4350ed01bbe4597694779 /ext/node/global.rs
parent839caf6fafdf9ca1cdec6cd9cef38296be41145f (diff)
fix: do not return undefined for missing global properties (#24474)
accessing e.g. `Buffer` in `Mode::Deno` mode should throw, not return undefined. --------- Signed-off-by: snek <snek@deno.com>
Diffstat (limited to 'ext/node/global.rs')
-rw-r--r--ext/node/global.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/node/global.rs b/ext/node/global.rs
index e01fca95e..2367814f9 100644
--- a/ext/node/global.rs
+++ b/ext/node/global.rs
@@ -305,6 +305,10 @@ pub fn getter<'s>(
let reflect_get = v8::Local::new(scope, reflect_get);
let inner = v8::Local::new(scope, inner);
+ if !inner.has_own_property(scope, key).unwrap_or(false) {
+ return v8::Intercepted::No;
+ }
+
let undefined = v8::undefined(scope);
let Some(value) = reflect_get.call(
scope,