Lightpanda: the headless browser designed for AI and automation
Merge pull request #2703 from lightpanda-io/nikneym/rework-url-resolve
Halil Duraka457ddf8a74b
diff --cc src/lightpanda.zigindex 3179e87be,50878bcd3..24db2297e--- a/src/lightpanda.zig+++ b/src/lightpanda.zig@@@ -98,15 -98,13 +98,15 @@@ pub fn fetch(app: *App, browser: *Brows// Stash scripts user want to inject.session.inject_scripts = opts.inject_script.items;- // A navigation-safe handle: `page.frame()` always re-resolves the live- // frame, so there's no stale-*Frame footgun across navigate / wait.- const page = try session.createPage();- {+ // One page per url. `PageHandle.frame()` always re-resolves the live frame,+ // so the handles stay valid across navigate / wait. The Runner's wait paths+ // already operate over every live page in the session.+ var pages: std.ArrayList(Session.PageHandle) = try .initCapacity(session.arena, urls.len);+ for (urls) |url| {+ const page = try session.createPage();const frame = page.frame().?;// not guaranteed to be valid after navigate- const encoded_url = try URL.ensureEncoded(frame.call_arena, url, "UTF-8");+ const encoded_url = try URL.resolveNavigation(frame.call_arena, url, .{});_ = try frame.navigate(encoded_url, .{.reason = .address_bar,.kind = .{ .push = null },