mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-22 04:34:44 +00:00
Merge pull request #1512 from lightpanda-io/fix_scheduled_navigation
Fix schedule navigation
This commit is contained in:
@@ -205,7 +205,6 @@ fn readLoop(self: *Server, socket: posix.socket_t, timeout_ms: u32) !void {
|
|||||||
}
|
}
|
||||||
ms_remaining -= @intCast(elapsed);
|
ms_remaining -= @intCast(elapsed);
|
||||||
},
|
},
|
||||||
.navigate => unreachable, // must have been handled by the session
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -969,7 +969,7 @@ fn _wait(self: *Page, wait_ms: u32) !Session.WaitResult {
|
|||||||
},
|
},
|
||||||
.html, .complete => {
|
.html, .complete => {
|
||||||
if (self._queued_navigation != null) {
|
if (self._queued_navigation != null) {
|
||||||
return .navigate;
|
return .done;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The HTML page was parsed. We now either have JS scripts to
|
// The HTML page was parsed. We now either have JS scripts to
|
||||||
|
|||||||
@@ -135,14 +135,18 @@ pub const WaitResult = enum {
|
|||||||
done,
|
done,
|
||||||
no_page,
|
no_page,
|
||||||
cdp_socket,
|
cdp_socket,
|
||||||
navigate,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn wait(self: *Session, wait_ms: u32) WaitResult {
|
pub fn wait(self: *Session, wait_ms: u32) WaitResult {
|
||||||
while (true) {
|
while (true) {
|
||||||
if (self.page) |*page| {
|
if (self.page) |*page| {
|
||||||
switch (page.wait(wait_ms)) {
|
switch (page.wait(wait_ms)) {
|
||||||
.navigate => self.processScheduledNavigation() catch return .done,
|
.done => {
|
||||||
|
if (page._queued_navigation == null) {
|
||||||
|
return .done;
|
||||||
|
}
|
||||||
|
self.processScheduledNavigation() catch return .done;
|
||||||
|
},
|
||||||
else => |result| return result,
|
else => |result| return result,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user