mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 23:23:28 +00:00
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...
This commit is contained in:
@@ -45,7 +45,7 @@ pub const Scope = enum {
|
|||||||
const Opts = struct {
|
const Opts = struct {
|
||||||
format: Format = if (is_debug) .pretty else .logfmt,
|
format: Format = if (is_debug) .pretty else .logfmt,
|
||||||
level: Level = if (is_debug) .info else .warn,
|
level: Level = if (is_debug) .info else .warn,
|
||||||
filter_scopes: []const Scope = &.{.unknown_prop},
|
filter_scopes: []const Scope = &.{},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub var opts = Opts{};
|
pub var opts = Opts{};
|
||||||
|
|||||||
@@ -2199,11 +2199,6 @@ pub fn Env(comptime State: type, comptime WebApis: type) type {
|
|||||||
|
|
||||||
fn generateNamedIndexer(comptime Struct: type, template_proto: v8.ObjectTemplate) void {
|
fn generateNamedIndexer(comptime Struct: type, template_proto: v8.ObjectTemplate) void {
|
||||||
if (@hasDecl(Struct, "named_get") == false) {
|
if (@hasDecl(Struct, "named_get") == false) {
|
||||||
if (comptime builtin.mode == .Debug) {
|
|
||||||
if (log.enabled(.unknown_prop, .debug)) {
|
|
||||||
generateDebugNamedIndexer(Struct, template_proto);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2263,31 +2258,6 @@ pub fn Env(comptime State: type, comptime WebApis: type) type {
|
|||||||
template_proto.setNamedProperty(configuration, null);
|
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 {
|
fn generateUndetectable(comptime Struct: type, template: v8.ObjectTemplate) void {
|
||||||
const has_js_call_as_function = @hasDecl(Struct, "jsCallAsFunction");
|
const has_js_call_as_function = @hasDecl(Struct, "jsCallAsFunction");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user