Skip to content

Commit 9c277ae

Browse files
committed
add debugger placeholders
1 parent 2446580 commit 9c277ae

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

build.zig.zon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
.dependencies = .{
77
.v8 = .{
88
.url = "https://github.com/lightpanda-io/zig-v8-fork/archive/84cdca7cd9065f67c7933388f2091810fc485bc6.tar.gz",
9-
.hash = "v8-0.0.0-xddH63bVAwBSEobaUok9J0er1FqsvEujCDDVy6I00",
9+
.hash = "v8-0.0.0-xddH67vcAwCuN2gBsAO8TBzEw523KMroIKGrdZwc-Q-y",
1010
},
1111
//.v8 = .{ .path = "../zig-v8-fork" }
1212
.@"ada-singleheader" = .{

src/browser/js/Inspector.zig

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,14 @@ pub fn init(allocator: Allocator, isolate: v8.Isolate, ctx: anytype) !Inspector
2828
// If necessary, turn a void context into something we can safely ptrCast
2929
const safe_context: *anyopaque = if (ContextT == void) @ptrCast(@constCast(&{})) else ctx;
3030

31-
const channel = v8.InspectorChannel.init(safe_context, InspectorContainer.onInspectorResponse, InspectorContainer.onInspectorEvent, isolate);
31+
const channel = v8.InspectorChannel.init(
32+
safe_context,
33+
InspectorContainer.onInspectorResponse,
34+
InspectorContainer.onInspectorEvent,
35+
InspectorContainer.onRunMessageLoopOnPause,
36+
InspectorContainer.onQuitMessageLoopOnPause,
37+
isolate,
38+
);
3239

3340
const client = v8.InspectorClient.init();
3441

@@ -109,6 +116,8 @@ pub fn getNodePtr(self: *const Inspector, allocator: Allocator, object_id: []con
109116
const NoopInspector = struct {
110117
pub fn onInspectorResponse(_: *anyopaque, _: u32, _: []const u8) void {}
111118
pub fn onInspectorEvent(_: *anyopaque, _: []const u8) void {}
119+
pub fn onRunMessageLoopOnPause(_: *anyopaque, _: u32) void {}
120+
pub fn onQuitMessageLoopOnPause(_: *anyopaque) void {}
112121
};
113122

114123
pub fn getTaggedAnyOpaque(value: v8.Value) ?*js.TaggedAnyOpaque {

src/cdp/cdp.zig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,17 @@ pub fn BrowserContext(comptime CDP_T: type) type {
632632
};
633633
}
634634

635+
// debugger events
636+
pub fn onRunMessageLoopOnPause(_: *anyopaque, _: u32) void {
637+
// onRunMessageLoopOnPause is called when a breakpoint is hit.
638+
// Until quit pause, we must continue to run a nested message loop
639+
// to interact with the the debugger ony (ie. Chrome DevTools).
640+
}
641+
642+
pub fn onQuitMessageLoopOnPause(_: *anyopaque) void {
643+
// Quit breakpoint pause.
644+
}
645+
635646
// This is hacky x 2. First, we create the JSON payload by gluing our
636647
// session_id onto it. Second, we're much more client/websocket aware than
637648
// we should be.

0 commit comments

Comments
 (0)