cdp: introduce current page

avoid page struct copy
This commit is contained in:
Pierre Tachoire
2025-02-05 17:48:18 +01:00
parent 8f8a1fda85
commit e7dcb8a605
4 changed files with 11 additions and 11 deletions

View File

@@ -112,16 +112,10 @@ fn getDocument(
std.debug.assert(input.sessionId != null);
log.debug("Req > id {d}, method {s}", .{ input.id, "DOM.getDocument" });
if (ctx.browser.session.page == null) {
return error.NoPage;
}
// retrieve the root node
const page = ctx.browser.session.page.?;
const page = ctx.browser.currentPage() orelse return error.NoPage;
if (page.doc == null) {
return error.NoDocument;
}
if (page.doc == null) return error.NoDocument;
const root = try parser.documentGetDocumentElement(page.doc.?) orelse {
return error.NoRoot;