Rework CDP frameIds (and loaderIds and requestIds and interceptorIds)

Our BrowsingContext currently supports 1 target. So we have a per-BC target_id.
Previously, our target had 1 "frame" - our page. So we often treated the
targetId as the frameId. But to work with frames, we need page-specific
frameIds and loaderIds.

This tries to clean up our ids (a little). frameIds are now ids derived from
a new incrementing page.id. This page.id has to be passed around (via http
Requests and through notifications) in order to properly generate messages with
a frameId.
This commit is contained in:
Karl Seguin
2026-02-18 18:52:15 +08:00
parent 5fd95788f9
commit e2a1ce623c
18 changed files with 409 additions and 296 deletions

View File

@@ -92,7 +92,7 @@ const TestContext = struct {
const BrowserContextOpts = struct {
id: ?[]const u8 = null,
target_id: ?[]const u8 = null,
target_id: ?[14]u8 = null,
session_id: ?[]const u8 = null,
url: ?[:0]const u8 = null,
};
@@ -122,7 +122,7 @@ const TestContext = struct {
bc.session_id = "SID-X";
}
if (bc.target_id == null) {
bc.target_id = "TID-X";
bc.target_id = "TID-000000000Z".*;
}
const page = try bc.session.createPage();
const full_url = try std.fmt.allocPrintSentinel(