mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-17 17:38:10 +00:00
Remove BrowserContext URL
Add BrowserContext.getURL which gets the URL from the session.page.
This commit is contained in:
@@ -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>,...
|
||||
|
||||
Reference in New Issue
Block a user