mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-07-31 17:55:59 -04:00
debug: limit macrotask runner to when we have a page
This is the only main change in this branch compared to main that could explain the Debug check failed: isolate()->CurrentLocalHeap()->IsRunning() failure being reported.
This commit is contained in:
@@ -215,7 +215,9 @@ fn _tick(self: *Runner, comptime is_cdp: bool, timeout_ms: u32, conditions: []Wa
|
||||
return .{ .ok = 0 };
|
||||
}
|
||||
|
||||
try browser.runMacrotasks();
|
||||
if (hasRunnablePage(session)) {
|
||||
try browser.runMacrotasks();
|
||||
}
|
||||
|
||||
const http_active = http_client.http_active;
|
||||
const http_next_tick = http_client.next_tick_count;
|
||||
@@ -431,6 +433,17 @@ fn firstConditionError(conditions: []const WaitCondition) !void {
|
||||
}
|
||||
}
|
||||
|
||||
fn hasRunnablePage(session: *Session) bool {
|
||||
for (session.pages.items) |page| {
|
||||
const target = page.replacement orelse page;
|
||||
switch (target.frame._parse_state) {
|
||||
.html, .complete => return true,
|
||||
else => {},
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const testing = @import("../testing.zig");
|
||||
test "Runner: waitForSelector timeout" {
|
||||
const page = try testing.pageTest("runner/runner1.html", .{});
|
||||
|
||||
Reference in New Issue
Block a user