mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-04-01 01:46:44 +00:00
use remaining instead of timeout_ms, else, what's the point?
Co-authored-by: Adrià Arrufat <1671644+arrufat@users.noreply.github.com>
This commit is contained in:
@@ -114,6 +114,6 @@ pub fn waitForSelector(selector: [:0]const u8, timeout_ms: u32, session: *Sessio
|
|||||||
const remaining = timeout_ms -| elapsed;
|
const remaining = timeout_ms -| elapsed;
|
||||||
if (remaining == 0) return error.Timeout;
|
if (remaining == 0) return error.Timeout;
|
||||||
|
|
||||||
const el = try runner.waitForSelector(selector, timeout_ms);
|
const el = try runner.waitForSelector(selector, remaining);
|
||||||
return el.asNode();
|
return el.asNode();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,14 +129,14 @@ pub fn fetch(app: *App, url: [:0]const u8, opts: FetchOpts) !void {
|
|||||||
const elapsed: u32 = @intCast(timer.read() / std.time.ns_per_ms);
|
const elapsed: u32 = @intCast(timer.read() / std.time.ns_per_ms);
|
||||||
const remaining = opts.wait_ms -| elapsed;
|
const remaining = opts.wait_ms -| elapsed;
|
||||||
if (remaining == 0) return error.Timeout;
|
if (remaining == 0) return error.Timeout;
|
||||||
_ = try runner.waitForSelector(selector, opts.wait_ms);
|
_ = try runner.waitForSelector(selector, remaining);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.wait_script) |script| {
|
if (opts.wait_script) |script| {
|
||||||
const elapsed: u32 = @intCast(timer.read() / std.time.ns_per_ms);
|
const elapsed: u32 = @intCast(timer.read() / std.time.ns_per_ms);
|
||||||
const remaining = opts.wait_ms -| elapsed;
|
const remaining = opts.wait_ms -| elapsed;
|
||||||
if (remaining == 0) return error.Timeout;
|
if (remaining == 0) return error.Timeout;
|
||||||
try runner.waitForScript(script, opts.wait_ms);
|
try runner.waitForScript(script, remaining);
|
||||||
}
|
}
|
||||||
|
|
||||||
const writer = opts.writer orelse return;
|
const writer = opts.writer orelse return;
|
||||||
|
|||||||
Reference in New Issue
Block a user