Lightpanda: the headless browser designed for AI and automation
cdp: complete Network event payloads
Ppsoft199139981f2534a4
diff --git a/src/cdp/domains/network.zig b/src/cdp/domains/network.zigindex cd4172f0b..597eb92b2 100644--- a/src/cdp/domains/network.zig+++ b/src/cdp/domains/network.zig@@ -328,6 +328,7 @@ pub fn httpRequestFail(bc: *CDP.BrowserContext, msg: *const Notification.Request// We're missing a bunch of fields, but, for now, this seems like enoughtry bc.cdp.sendEvent("Network.loadingFailed", .{.requestId = &id.toRequestId(msg.transfer),+ .timestamp = timestamp(.monotonic),// Seems to be what chrome answers with. I assume it depends on the type of error?.type = "Ping",.errorText = msg.err,@@ -382,6 +383,8 @@ pub fn httpResponseHeaderDone(arena: Allocator, bc: *CDP.BrowserContext, msg: *c.frameId = &id.toFrameId(req.frame_id),.requestId = &id.toRequestId(transfer),.loaderId = &id.toLoaderId(req.loader_id),+ .timestamp = timestamp(.monotonic),+ .type = req.resource_type.string(),.response = ResponseWriter.init(arena, msg.transfer),.hasExtraInfo = false, // TODO change after adding Network.responseReceivedExtraInfo}, .{ .session_id = session_id });@@ -393,6 +396,7 @@ pub fn httpRequestDone(bc: *CDP.BrowserContext, msg: *const Notification.Requestconst session_id = bc.session_id orelse return;try bc.cdp.sendEvent("Network.loadingFinished", .{.requestId = &id.toRequestId(msg.transfer),+ .timestamp = timestamp(.monotonic),.encodedDataLength = msg.content_length,}, .{ .session_id = session_id });}@@ -447,6 +451,16 @@ pub const RequestWriter = struct {try jws.write(request.body != null);}+ {+ try jws.objectField("initialPriority");+ try jws.write("High");+ }++ {+ try jws.objectField("referrerPolicy");+ try jws.write("strict-origin-when-cross-origin");+ }+{try jws.objectField("headers");try jws.beginObject();@@ -516,6 +530,17 @@ const ResponseWriter = struct {try jws.write(transfer._from_cache);}+ {+ try jws.objectField("connectionReused");+ try jws.write(false);+ try jws.objectField("connectionId");+ try jws.write(0);+ try jws.objectField("encodedDataLength");+ try jws.write(transfer._cdp_content_length);+ try jws.objectField("securityState");+ try jws.write("unknown");+ }+{try jws.objectField("timing");try jws.write(.{@@ -533,6 +558,12 @@ const ResponseWriter = struct {.sendStart = -1,.sslEnd = -1,.sslStart = -1,+ .workerStart = -1,+ .workerReady = -1,+ .workerFetchStart = -1,+ .workerRespondWithSettled = -1,+ .pushStart = -1,+ .pushEnd = -1,});}