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