Skip to content

Commit 93eef15

Browse files
committed
cdp: dispatch executionContextCreated on Runtime.enable
1 parent ebe2c8e commit 93eef15

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

src/cdp/runtime.zig

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const result = cdp.result;
2828
const IncomingMessage = @import("msg.zig").IncomingMessage;
2929
const Input = @import("msg.zig").Input;
3030
const stringify = cdp.stringify;
31+
const target = @import("target.zig");
3132

3233
const log = std.log.scoped(.cdp);
3334

@@ -129,6 +130,27 @@ fn sendInspector(
129130
}
130131

131132
ctx.sendInspector(msg.json);
133+
134+
if (method == .enable) {
135+
try executionContextCreated(
136+
alloc,
137+
ctx,
138+
0,
139+
"://",
140+
"",
141+
// TODO: hard coded ID
142+
"7102379147004877974.3265385113993241162",
143+
.{
144+
.isDefault = true,
145+
.type = "default",
146+
// TODO: hard coded ID
147+
.frameId = cdp.FrameID,
148+
},
149+
// TODO: hard coded ID
150+
target.BrowserContextID,
151+
);
152+
}
153+
132154
return "";
133155
}
134156

src/cdp/target.zig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ pub fn target(
6262
}
6363

6464
// TODO: hard coded IDs
65-
const PageTargetID = "CFCD6EC01573CF29BB638E9DC0F52DDC";
66-
const BrowserTargetID = "2d2bdef9-1c95-416f-8c0e-83f3ab73a30c";
67-
const BrowserContextID = "65618675CB7D3585A95049E9DFE95EA9";
65+
pub const PageTargetID = "CFCD6EC01573CF29BB638E9DC0F52DDC";
66+
pub const BrowserTargetID = "2d2bdef9-1c95-416f-8c0e-83f3ab73a30c";
67+
pub const BrowserContextID = "65618675CB7D3585A95049E9DFE95EA9";
6868

6969
// TODO: noop method
7070
fn setDiscoverTargets(

0 commit comments

Comments
 (0)