mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-28 22:53:28 +00:00
cdp: add TargetCreated event on createTarget message
This commit is contained in:
@@ -95,6 +95,19 @@ const AttachToTarget = struct {
|
|||||||
waitingForDebugger: bool = false,
|
waitingForDebugger: bool = false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const TargetCreated = struct {
|
||||||
|
sessionId: []const u8,
|
||||||
|
targetInfo: struct {
|
||||||
|
targetId: []const u8,
|
||||||
|
type: []const u8 = "page",
|
||||||
|
title: []const u8,
|
||||||
|
url: []const u8,
|
||||||
|
attached: bool = true,
|
||||||
|
canAccessOpener: bool = false,
|
||||||
|
browserContextId: []const u8,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
const TargetFilter = struct {
|
const TargetFilter = struct {
|
||||||
type: ?[]const u8 = null,
|
type: ?[]const u8 = null,
|
||||||
exclude: ?bool = null,
|
exclude: ?bool = null,
|
||||||
@@ -328,6 +341,19 @@ fn createTarget(
|
|||||||
ctx.state.secureContextType = "InsecureScheme";
|
ctx.state.secureContextType = "InsecureScheme";
|
||||||
ctx.state.loaderID = LoaderID;
|
ctx.state.loaderID = LoaderID;
|
||||||
|
|
||||||
|
// send targetCreated event
|
||||||
|
const created = TargetCreated{
|
||||||
|
.sessionId = cdp.ContextSessionID,
|
||||||
|
.targetInfo = .{
|
||||||
|
.targetId = ctx.state.frameID,
|
||||||
|
.title = "about:blank",
|
||||||
|
.url = ctx.state.url,
|
||||||
|
.browserContextId = input.params.browserContextId orelse ContextID,
|
||||||
|
.attached = true,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
try cdp.sendEvent(alloc, ctx, "Target.targetCreated", TargetCreated, created, input.sessionId);
|
||||||
|
|
||||||
// send attachToTarget event
|
// send attachToTarget event
|
||||||
const attached = AttachToTarget{
|
const attached = AttachToTarget{
|
||||||
.sessionId = cdp.ContextSessionID,
|
.sessionId = cdp.ContextSessionID,
|
||||||
|
|||||||
Reference in New Issue
Block a user