mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 07:03:29 +00:00
requestChildNode cannot have a depth of 0
This commit is contained in:
@@ -213,7 +213,7 @@ pub const Writer = struct {
|
||||
|
||||
pub fn jsonStringify(self: *const Writer, w: anytype) !void {
|
||||
if (self.exclude_root) {
|
||||
_ = self.writeChildren(self.root, 0, w) catch |err| {
|
||||
_ = self.writeChildren(self.root, 1, w) catch |err| {
|
||||
log.err(.cdp, "node writeChildren", .{ .err = err });
|
||||
return error.OutOfMemory;
|
||||
};
|
||||
@@ -467,7 +467,7 @@ test "cdp Node: Writer" {
|
||||
const node = registry.lookup_by_id.get(1).?;
|
||||
const json = try std.json.stringifyAlloc(testing.allocator, Writer{
|
||||
.root = node,
|
||||
.depth = 0,
|
||||
.depth = 1,
|
||||
.exclude_root = false,
|
||||
.registry = ®istry,
|
||||
}, .{});
|
||||
|
||||
@@ -442,6 +442,7 @@ fn requestChildNodes(cmd: anytype) !void {
|
||||
pierce: bool = false,
|
||||
})) orelse return error.InvalidParams;
|
||||
|
||||
if (params.depth == 0) return error.InvalidParams;
|
||||
const bc = cmd.browser_context orelse return error.BrowserContextNotLoaded;
|
||||
const session_id = bc.session_id orelse return error.SessionIdNotLoaded;
|
||||
const node = bc.node_registry.lookup_by_id.get(params.nodeId) orelse {
|
||||
|
||||
Reference in New Issue
Block a user