add cookie size to CDP response

Compute and include the cookie size field (name.len + value.len)
in Storage.getCookies and Network.getCookies CDP responses,
matching Chrome's behavior.
This commit is contained in:
egrs
2026-02-17 13:08:02 +01:00
parent a1256b46c8
commit 628049cfd7
2 changed files with 7 additions and 5 deletions

View File

@@ -502,7 +502,7 @@ test "cdp.Network: cookies" {
});
try ctx.expectSentResult(.{
.cookies = &[_]ResCookie{
.{ .name = "test3", .value = "value3", .domain = "car.example.com", .path = "/", .secure = true }, // No Pancakes!
.{ .name = "test3", .value = "value3", .domain = "car.example.com", .path = "/", .size = 11, .secure = true }, // No Pancakes!
},
}, .{ .id = 6 });
@@ -519,7 +519,7 @@ test "cdp.Network: cookies" {
.params = .{ .browserContextId = "BID-S" },
});
// Just the untouched test4 should be in the result
try ctx.expectSentResult(.{ .cookies = &[_]ResCookie{.{ .name = "test4", .value = "value4", .domain = ".example.com", .path = "/mango" }} }, .{ .id = 8 });
try ctx.expectSentResult(.{ .cookies = &[_]ResCookie{.{ .name = "test4", .value = "value4", .domain = ".example.com", .path = "/mango", .size = 11 }} }, .{ .id = 8 });
// Empty after clearBrowserCookies
try ctx.processMessage(.{