Skip to content

Commit 07e37b2

Browse files
authored
Merge pull request #921 from lightpanda-io/cdp-agent-commt
cdp: add comment for CDP_USER_AGENT
2 parents 6fcfcb6 + 7aff90a commit 07e37b2

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/cdp/domains/browser.zig

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,18 @@ const std = @import("std");
2020

2121
// TODO: hard coded data
2222
const PROTOCOL_VERSION = "1.3";
23-
const PRODUCT = "Chrome/124.0.6367.29";
2423
const REVISION = "@9e6ded5ac1ff5e38d930ae52bd9aec09bd1a68e4";
25-
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";
24+
25+
// CDP_USER_AGENT const is used by the CDP server only to identify itself to
26+
// the CDP clients.
27+
// Many clients check the CDP server is a Chrome browser.
28+
//
29+
// CDP_USER_AGENT const is not used by the browser for the HTTP client (see
30+
// src/http/client.zig) nor exposed to the JS (see
31+
// src/browser/html/navigator.zig).
32+
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";
33+
const PRODUCT = "Chrome/124.0.6367.29";
34+
2635
const JS_VERSION = "12.4.254.8";
2736
const DEV_TOOLS_WINDOW_ID = 1923710101;
2837

@@ -48,7 +57,7 @@ fn getVersion(cmd: anytype) !void {
4857
.protocolVersion = PROTOCOL_VERSION,
4958
.product = PRODUCT,
5059
.revision = REVISION,
51-
.userAgent = USER_AGENT,
60+
.userAgent = CDP_USER_AGENT,
5261
.jsVersion = JS_VERSION,
5362
}, .{ .include_session_id = false });
5463
}
@@ -95,7 +104,7 @@ test "cdp.browser: getVersion" {
95104
.protocolVersion = PROTOCOL_VERSION,
96105
.product = PRODUCT,
97106
.revision = REVISION,
98-
.userAgent = USER_AGENT,
107+
.userAgent = CDP_USER_AGENT,
99108
.jsVersion = JS_VERSION,
100109
}, .{ .id = 32, .index = 0, .session_id = null });
101110
}

0 commit comments

Comments
 (0)