mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-22 04:34:44 +00:00
Make CDP frame-aware
This commit is contained in:
@@ -1210,7 +1210,7 @@ pub fn iframeAddedCallback(self: *Page, iframe: *Element.Html.IFrame) !void {
|
||||
page_frame.iframe = iframe;
|
||||
iframe._content_window = page_frame.window;
|
||||
|
||||
page_frame.navigate(src, .{}) catch |err| {
|
||||
page_frame.navigate(src, .{.reason = .initialFrameNavigation}) catch |err| {
|
||||
log.warn(.page, "iframe navigate failure", .{ .url = src, .err = err });
|
||||
self._pending_loads -= 1;
|
||||
iframe._content_window = null;
|
||||
@@ -3119,6 +3119,7 @@ pub const NavigateReason = enum {
|
||||
script,
|
||||
history,
|
||||
navigation,
|
||||
initialFrameNavigation,
|
||||
};
|
||||
|
||||
pub const NavigateOpts = struct {
|
||||
|
||||
@@ -252,13 +252,14 @@ pub fn pageNavigate(bc: anytype, event: *const Notification.PageNavigate) !void
|
||||
.address_bar => null,
|
||||
};
|
||||
if (reason_) |reason| {
|
||||
try cdp.sendEvent("Page.frameScheduledNavigation", .{
|
||||
.frameId = frame_id,
|
||||
.delay = 0,
|
||||
.reason = reason,
|
||||
.url = event.url,
|
||||
}, .{ .session_id = session_id });
|
||||
|
||||
if (reason != .initialFrameNavigation) {
|
||||
try cdp.sendEvent("Page.frameScheduledNavigation", .{
|
||||
.frameId = frame_id,
|
||||
.delay = 0,
|
||||
.reason = reason,
|
||||
.url = event.url,
|
||||
}, .{ .session_id = session_id });
|
||||
}
|
||||
try cdp.sendEvent("Page.frameRequestedNavigation", .{
|
||||
.frameId = frame_id,
|
||||
.reason = reason,
|
||||
|
||||
Reference in New Issue
Block a user