mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-16 16:28:58 +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 {
|
pub fn jsonStringify(self: *const Writer, w: anytype) !void {
|
||||||
if (self.exclude_root) {
|
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 });
|
log.err(.cdp, "node writeChildren", .{ .err = err });
|
||||||
return error.OutOfMemory;
|
return error.OutOfMemory;
|
||||||
};
|
};
|
||||||
@@ -467,7 +467,7 @@ test "cdp Node: Writer" {
|
|||||||
const node = registry.lookup_by_id.get(1).?;
|
const node = registry.lookup_by_id.get(1).?;
|
||||||
const json = try std.json.stringifyAlloc(testing.allocator, Writer{
|
const json = try std.json.stringifyAlloc(testing.allocator, Writer{
|
||||||
.root = node,
|
.root = node,
|
||||||
.depth = 0,
|
.depth = 1,
|
||||||
.exclude_root = false,
|
.exclude_root = false,
|
||||||
.registry = ®istry,
|
.registry = ®istry,
|
||||||
}, .{});
|
}, .{});
|
||||||
|
|||||||
@@ -442,6 +442,7 @@ fn requestChildNodes(cmd: anytype) !void {
|
|||||||
pierce: bool = false,
|
pierce: bool = false,
|
||||||
})) orelse return error.InvalidParams;
|
})) orelse return error.InvalidParams;
|
||||||
|
|
||||||
|
if (params.depth == 0) return error.InvalidParams;
|
||||||
const bc = cmd.browser_context orelse return error.BrowserContextNotLoaded;
|
const bc = cmd.browser_context orelse return error.BrowserContextNotLoaded;
|
||||||
const session_id = bc.session_id orelse return error.SessionIdNotLoaded;
|
const session_id = bc.session_id orelse return error.SessionIdNotLoaded;
|
||||||
const node = bc.node_registry.lookup_by_id.get(params.nodeId) orelse {
|
const node = bc.node_registry.lookup_by_id.get(params.nodeId) orelse {
|
||||||
|
|||||||
Reference in New Issue
Block a user