mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-17 08:48:58 +00:00
Communicate page navigation state via notifications
In order to support click handling on anchors from JavaScript, we need some hook from the page/session to the CDP instance. This first phase adds notifications in page.navigate, as well as a primitive notification hook to the session. CDP's existing Page.navigate uses this new notifiation system.
This commit is contained in:
@@ -86,6 +86,7 @@ pub fn main() !void {
|
||||
},
|
||||
.fetch => |opts| {
|
||||
log.debug("Fetch mode: url {s}, dump {any}", .{ opts.url, opts.dump });
|
||||
const url = try @import("url.zig").URL.parse(opts.url, null);
|
||||
|
||||
var app = try App.init(alloc, .{
|
||||
.run_mode = args.mode,
|
||||
@@ -107,13 +108,13 @@ pub fn main() !void {
|
||||
// page
|
||||
const page = try session.createPage(null);
|
||||
|
||||
_ = page.navigate(opts.url, null) catch |err| switch (err) {
|
||||
_ = page.navigate(url, null) catch |err| switch (err) {
|
||||
error.UnsupportedUriScheme, error.UriMissingHost => {
|
||||
log.err("'{s}' is not a valid URL ({any})\n", .{ opts.url, err });
|
||||
log.err("'{s}' is not a valid URL ({any})\n", .{ url, err });
|
||||
return args.printUsageAndExit(false);
|
||||
},
|
||||
else => {
|
||||
log.err("'{s}' fetching error ({any})\n", .{ opts.url, err });
|
||||
log.err("'{s}' fetching error ({any})\n", .{ url, err });
|
||||
return err;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user