mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-16 16:28:58 +00:00
cdp: introduce current page
avoid page struct copy
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user