diff --git a/src/Notification.zig b/src/Notification.zig
index aa4f8eba0..b989628c6 100644
--- a/src/Notification.zig
+++ b/src/Notification.zig
@@ -342,6 +342,8 @@ pub const ConsoleMessageType = enum {
@"error",
fatal,
trace,
+ dir,
+ dirxml,
};
pub const ConsoleMessage = struct {
diff --git a/src/browser/js/Execution.zig b/src/browser/js/Execution.zig
index a29e44167..0435c484a 100644
--- a/src/browser/js/Execution.zig
+++ b/src/browser/js/Execution.zig
@@ -36,6 +36,7 @@ const Factory = @import("../Factory.zig");
const HttpClient = @import("../../network/HttpClient.zig");
const EventManagerBase = @import("../EventManagerBase.zig");
+const Console = @import("../webapi/Console.zig");
const Event = @import("../webapi/Event.zig");
const EventTarget = @import("../webapi/EventTarget.zig");
const Performance = @import("../webapi/Performance.zig");
@@ -165,6 +166,13 @@ pub fn performance(self: *const Execution) *Performance {
};
}
+pub fn console(self: *const Execution) *Console {
+ return switch (self.js.global) {
+ .frame => |frame| frame.window.getConsole(),
+ .worker => |worker| worker.getConsole(),
+ };
+}
+
pub fn frameId(self: *const Execution) u32 {
return switch (self.js.global) {
inline else => |g| g._frame_id,
diff --git a/src/browser/js/Snapshot.zig b/src/browser/js/Snapshot.zig
index 14edf454c..537136c5a 100644
--- a/src/browser/js/Snapshot.zig
+++ b/src/browser/js/Snapshot.zig
@@ -899,8 +899,11 @@ fn attachClass(comptime JsApi: type, comptime flatten: bool, isolate: *v8.Isolat
if (@hasDecl(JsApi.Meta, "name")) {
const js_name = v8.v8__Symbol__GetToStringTag(isolate);
- const js_value = v8.v8__String__NewFromUtf8(isolate, JsApi.Meta.name.ptr, v8.kNormal, @intCast(JsApi.Meta.name.len));
- v8.v8__Template__Set(@ptrCast(instance), js_name, js_value, v8.ReadOnly + v8.DontDelete);
+ // Namespace objects override the class string (e.g. console's is
+ // "console", not "Console").
+ const tag = if (@hasDecl(JsApi.Meta, "class_string")) JsApi.Meta.class_string else JsApi.Meta.name;
+ const js_value = v8.v8__String__NewFromUtf8(isolate, tag.ptr, v8.kNormal, @intCast(tag.len));
+ v8.v8__Template__Set(@ptrCast(instance), js_name, js_value, v8.ReadOnly + v8.DontEnum);
}
if (comptime lp.IS_DEBUG) {
diff --git a/src/browser/js/bridge.zig b/src/browser/js/bridge.zig
index a7b0a13e6..617578b72 100644
--- a/src/browser/js/bridge.zig
+++ b/src/browser/js/bridge.zig
@@ -221,6 +221,12 @@ pub const Function = struct {
if (@typeInfo(PT) == .optional) {
break;
}
+
+ // A slice of js.Value is always bound as variadic (see
+ // Caller.getArgs) and variadics contribute 0 to length.
+ if (@typeInfo(PT) == .pointer and @typeInfo(PT).pointer.size == .slice and @typeInfo(PT).pointer.child == js.Value) {
+ break;
+ }
count += 1;
}
return count;
diff --git a/src/browser/tests/console/console.html b/src/browser/tests/console/console.html
index cb35991ac..dc7d0ba47 100644
--- a/src/browser/tests/console/console.html
+++ b/src/browser/tests/console/console.html
@@ -25,6 +25,43 @@
}
+
+
+
+