Introduce Page (container)

Follow up to https://github.com/lightpanda-io/browser/pull/2200

This change is actually pretty mundane, but a bunch of files that used to
take a *Session (e.g. every WebAPI releaseRef and deinit) now take a *Page.

This aims to separate the 2 lifetimes currently managed by Session by moving
the "Page" lifetime to a dedicated container: Page. Ultimately, the goal is to
remove the 1-page-per-session limit of the current design. Not to explicitly
support multiple pages per session (though, that's more possible now), but
in order to better emulate Chrome where, during a navigation event, the old and
new page both exist.
This commit is contained in:
Karl Seguin
2026-04-22 20:38:50 +08:00
parent 553b32b3b8
commit 550fb58f3f
74 changed files with 819 additions and 664 deletions

View File

@@ -394,8 +394,8 @@ pub fn htmlRunner(comptime path: []const u8, opts: HtmlRunnerOpts) !void {
}
fn runWebApiTest(test_file: [:0]const u8) !void {
const frame = try test_session.createFrame();
defer test_session.removeFrame();
const frame = try test_session.createPage();
defer test_session.removePage();
const url = try std.fmt.allocPrintSentinel(
arena_allocator,
@@ -453,8 +453,8 @@ const PageTestOpts = struct {
wait_until_done: bool = true,
};
pub fn pageTest(comptime test_file: []const u8, opts: PageTestOpts) !*Frame {
const frame = try test_session.createFrame();
errdefer test_session.removeFrame();
const frame = try test_session.createPage();
errdefer test_session.removePage();
const url = try std.fmt.allocPrintSentinel(
arena_allocator,