Skip to content

Commit 1d74294

Browse files
committed
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...
1 parent d477665 commit 1d74294

File tree

2 files changed

+1
-31
lines changed

2 files changed

+1
-31
lines changed

src/log.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub const Scope = enum {
4545
const Opts = struct {
4646
format: Format = if (is_debug) .pretty else .logfmt,
4747
level: Level = if (is_debug) .info else .warn,
48-
filter_scopes: []const Scope = &.{.unknown_prop},
48+
filter_scopes: []const Scope = &.{},
4949
};
5050

5151
pub var opts = Opts{};

src/runtime/js.zig

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2199,11 +2199,6 @@ pub fn Env(comptime State: type, comptime WebApis: type) type {
21992199

22002200
fn generateNamedIndexer(comptime Struct: type, template_proto: v8.ObjectTemplate) void {
22012201
if (@hasDecl(Struct, "named_get") == false) {
2202-
if (comptime builtin.mode == .Debug) {
2203-
if (log.enabled(.unknown_prop, .debug)) {
2204-
generateDebugNamedIndexer(Struct, template_proto);
2205-
}
2206-
}
22072202
return;
22082203
}
22092204

@@ -2263,31 +2258,6 @@ pub fn Env(comptime State: type, comptime WebApis: type) type {
22632258
template_proto.setNamedProperty(configuration, null);
22642259
}
22652260

2266-
fn generateDebugNamedIndexer(comptime Struct: type, template_proto: v8.ObjectTemplate) void {
2267-
const configuration = v8.NamedPropertyHandlerConfiguration{
2268-
.getter = struct {
2269-
fn callback(c_name: ?*const v8.C_Name, raw_info: ?*const v8.C_PropertyCallbackInfo) callconv(.c) u8 {
2270-
const info = v8.PropertyCallbackInfo.initFromV8(raw_info);
2271-
const isolate = info.getIsolate();
2272-
const v8_context = isolate.getCurrentContext();
2273-
2274-
const js_context: *JsContext = @ptrFromInt(v8_context.getEmbedderData(1).castTo(v8.BigInt).getUint64());
2275-
2276-
const property = valueToString(js_context.call_arena, .{ .handle = c_name.? }, isolate, v8_context) catch "???";
2277-
log.debug(.unknown_prop, "unkown property", .{ .@"struct" = @typeName(Struct), .property = property });
2278-
return v8.Intercepted.No;
2279-
}
2280-
}.callback,
2281-
2282-
// This is really cool. Without this, we'd intercept _all_ properties
2283-
// even those explicitly set. So, node.length for example would get routed
2284-
// to our `named_get`, rather than a `get_length`. This might be
2285-
// useful if we run into a type that we can't model properly in Zig.
2286-
.flags = v8.PropertyHandlerFlags.OnlyInterceptStrings | v8.PropertyHandlerFlags.NonMasking,
2287-
};
2288-
template_proto.setNamedProperty(configuration, null);
2289-
}
2290-
22912261
fn generateUndetectable(comptime Struct: type, template: v8.ObjectTemplate) void {
22922262
const has_js_call_as_function = @hasDecl(Struct, "jsCallAsFunction");
22932263

0 commit comments

Comments
 (0)