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.

https://github.com/lightpanda-io/browser/issues/867
This commit is contained in:
Karl Seguin
2025-07-14 11:21:02 +08:00
parent d35a3eab6c
commit fae2b5acfa
2 changed files with 4 additions and 0 deletions

View File

@@ -31,6 +31,7 @@ pub fn processMessage(cmd: anytype) !void {
addScriptToEvaluateOnNewDocument,
createIsolatedWorld,
navigate,
stopLoading,
}, cmd.input.action) orelse return error.UnknownMethod;
switch (action) {
@@ -40,6 +41,7 @@ pub fn processMessage(cmd: anytype) !void {
.addScriptToEvaluateOnNewDocument => return addScriptToEvaluateOnNewDocument(cmd),
.createIsolatedWorld => return createIsolatedWorld(cmd),
.navigate => return navigate(cmd),
.stopLoading => return cmd.sendResult(null, .{}),
}
}