Remove BrowserContext URL

Add BrowserContext.getURL which gets the URL from the session.page.
This commit is contained in:
Karl Seguin
2025-04-07 13:51:50 +08:00
parent b76875bf5d
commit f38a0d2d67
4 changed files with 13 additions and 12 deletions

View File

@@ -284,8 +284,6 @@ pub fn BrowserContext(comptime CDP_T: type) type {
// we should reject it.
session_id: ?[]const u8,
// State
url: []const u8,
loader_id: []const u8,
security_origin: []const u8,
page_life_cycle_events: bool,
@@ -306,7 +304,6 @@ pub fn BrowserContext(comptime CDP_T: type) type {
.cdp = cdp,
.target_id = null,
.session_id = null,
.url = URL_BASE,
.security_origin = URL_BASE,
.secure_context_type = "Secure", // TODO = enum
.loader_id = LOADER_ID,
@@ -336,6 +333,11 @@ pub fn BrowserContext(comptime CDP_T: type) type {
};
}
pub fn getURL(self: *const Self) ?[]const u8 {
const page = self.session.currentPage() orelse return null;
return page.rawuri;
}
pub fn onInspectorResponse(ctx: *anyopaque, _: u32, msg: []const u8) void {
if (std.log.defaultLogEnabled(.debug)) {
// msg should be {"id":<id>,...