Merge pull request #921 from lightpanda-io/cdp-agent-commt
Some checks failed
e2e-test / zig build release (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
e2e-test / cdp-and-hyperfine-bench (push) Has been cancelled
e2e-test / perf-fmt (push) Has been cancelled
zig-test / zig build dev (push) Has been cancelled
zig-test / browser fetch (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled

cdp: add comment for CDP_USER_AGENT
This commit is contained in:
Karl Seguin
2025-08-05 07:38:43 +08:00
committed by GitHub

View File

@@ -20,9 +20,18 @@ const std = @import("std");
// TODO: hard coded data // TODO: hard coded data
const PROTOCOL_VERSION = "1.3"; const PROTOCOL_VERSION = "1.3";
const PRODUCT = "Chrome/124.0.6367.29";
const REVISION = "@9e6ded5ac1ff5e38d930ae52bd9aec09bd1a68e4"; const REVISION = "@9e6ded5ac1ff5e38d930ae52bd9aec09bd1a68e4";
const USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36";
// CDP_USER_AGENT const is used by the CDP server only to identify itself to
// the CDP clients.
// Many clients check the CDP server is a Chrome browser.
//
// CDP_USER_AGENT const is not used by the browser for the HTTP client (see
// src/http/client.zig) nor exposed to the JS (see
// src/browser/html/navigator.zig).
const CDP_USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36";
const PRODUCT = "Chrome/124.0.6367.29";
const JS_VERSION = "12.4.254.8"; const JS_VERSION = "12.4.254.8";
const DEV_TOOLS_WINDOW_ID = 1923710101; const DEV_TOOLS_WINDOW_ID = 1923710101;
@@ -48,7 +57,7 @@ fn getVersion(cmd: anytype) !void {
.protocolVersion = PROTOCOL_VERSION, .protocolVersion = PROTOCOL_VERSION,
.product = PRODUCT, .product = PRODUCT,
.revision = REVISION, .revision = REVISION,
.userAgent = USER_AGENT, .userAgent = CDP_USER_AGENT,
.jsVersion = JS_VERSION, .jsVersion = JS_VERSION,
}, .{ .include_session_id = false }); }, .{ .include_session_id = false });
} }
@@ -95,7 +104,7 @@ test "cdp.browser: getVersion" {
.protocolVersion = PROTOCOL_VERSION, .protocolVersion = PROTOCOL_VERSION,
.product = PRODUCT, .product = PRODUCT,
.revision = REVISION, .revision = REVISION,
.userAgent = USER_AGENT, .userAgent = CDP_USER_AGENT,
.jsVersion = JS_VERSION, .jsVersion = JS_VERSION,
}, .{ .id = 32, .index = 0, .session_id = null }); }, .{ .id = 32, .index = 0, .session_id = null });
} }