Skip to content

Commit fae2b5a

Browse files
committed
Noop CDP methods that go-rod requires
go-rod appears to stop processing when it receives an error, such as UnknownMethod. Added placeholder handlers for Network.setUserAgentOverride and Page.stopLoading. Setting a custom user agent is something still being discussed, so no-oping it seems reasonable. And, due to the currently synchronous nature of the initial page load, no-oping stopLoading also seems reasonable. #867
1 parent d35a3ea commit fae2b5a

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/cdp/domains/network.zig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ pub fn processMessage(cmd: anytype) !void {
2929
disable,
3030
setCacheDisabled,
3131
setExtraHTTPHeaders,
32+
setUserAgentOverride,
3233
deleteCookies,
3334
clearBrowserCookies,
3435
setCookie,
@@ -40,6 +41,7 @@ pub fn processMessage(cmd: anytype) !void {
4041
.enable => return enable(cmd),
4142
.disable => return disable(cmd),
4243
.setCacheDisabled => return cmd.sendResult(null, .{}),
44+
.setUserAgentOverride => return cmd.sendResult(null, .{}),
4345
.setExtraHTTPHeaders => return setExtraHTTPHeaders(cmd),
4446
.deleteCookies => return deleteCookies(cmd),
4547
.clearBrowserCookies => return clearBrowserCookies(cmd),

src/cdp/domains/page.zig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pub fn processMessage(cmd: anytype) !void {
3131
addScriptToEvaluateOnNewDocument,
3232
createIsolatedWorld,
3333
navigate,
34+
stopLoading,
3435
}, cmd.input.action) orelse return error.UnknownMethod;
3536

3637
switch (action) {
@@ -40,6 +41,7 @@ pub fn processMessage(cmd: anytype) !void {
4041
.addScriptToEvaluateOnNewDocument => return addScriptToEvaluateOnNewDocument(cmd),
4142
.createIsolatedWorld => return createIsolatedWorld(cmd),
4243
.navigate => return navigate(cmd),
44+
.stopLoading => return cmd.sendResult(null, .{}),
4345
}
4446
}
4547

0 commit comments

Comments
 (0)