From 13c623755ce4fe4e13301739b03bc9ef4b969065 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Mon, 7 Jul 2025 14:29:48 -0700 Subject: [PATCH] js: remove existing unknown property debug Because it will be displayed only if the property is non-native. So if your property is set in pureJS, you will still have the log... --- src/log.zig | 2 +- src/runtime/js.zig | 30 ------------------------------ 2 files changed, 1 insertion(+), 31 deletions(-) diff --git a/src/log.zig b/src/log.zig index b50cfc3c..19623600 100644 --- a/src/log.zig +++ b/src/log.zig @@ -45,7 +45,7 @@ pub const Scope = enum { const Opts = struct { format: Format = if (is_debug) .pretty else .logfmt, level: Level = if (is_debug) .info else .warn, - filter_scopes: []const Scope = &.{.unknown_prop}, + filter_scopes: []const Scope = &.{}, }; pub var opts = Opts{}; diff --git a/src/runtime/js.zig b/src/runtime/js.zig index d62a1714..70d7ef7e 100644 --- a/src/runtime/js.zig +++ b/src/runtime/js.zig @@ -2199,11 +2199,6 @@ pub fn Env(comptime State: type, comptime WebApis: type) type { fn generateNamedIndexer(comptime Struct: type, template_proto: v8.ObjectTemplate) void { if (@hasDecl(Struct, "named_get") == false) { - if (comptime builtin.mode == .Debug) { - if (log.enabled(.unknown_prop, .debug)) { - generateDebugNamedIndexer(Struct, template_proto); - } - } return; } @@ -2263,31 +2258,6 @@ pub fn Env(comptime State: type, comptime WebApis: type) type { template_proto.setNamedProperty(configuration, null); } - fn generateDebugNamedIndexer(comptime Struct: type, template_proto: v8.ObjectTemplate) void { - const configuration = v8.NamedPropertyHandlerConfiguration{ - .getter = struct { - fn callback(c_name: ?*const v8.C_Name, raw_info: ?*const v8.C_PropertyCallbackInfo) callconv(.c) u8 { - const info = v8.PropertyCallbackInfo.initFromV8(raw_info); - const isolate = info.getIsolate(); - const v8_context = isolate.getCurrentContext(); - - const js_context: *JsContext = @ptrFromInt(v8_context.getEmbedderData(1).castTo(v8.BigInt).getUint64()); - - const property = valueToString(js_context.call_arena, .{ .handle = c_name.? }, isolate, v8_context) catch "???"; - log.debug(.unknown_prop, "unkown property", .{ .@"struct" = @typeName(Struct), .property = property }); - return v8.Intercepted.No; - } - }.callback, - - // This is really cool. Without this, we'd intercept _all_ properties - // even those explicitly set. So, node.length for example would get routed - // to our `named_get`, rather than a `get_length`. This might be - // useful if we run into a type that we can't model properly in Zig. - .flags = v8.PropertyHandlerFlags.OnlyInterceptStrings | v8.PropertyHandlerFlags.NonMasking, - }; - template_proto.setNamedProperty(configuration, null); - } - fn generateUndetectable(comptime Struct: type, template: v8.ObjectTemplate) void { const has_js_call_as_function = @hasDecl(Struct, "jsCallAsFunction");