Skip to content

Commit 4db80cb

Browse files
committed
Adopt state into the isolated world
1 parent fac46d9 commit 4db80cb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/cdp/domains/target.zig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,13 @@ fn createTarget(cmd: anytype) !void {
127127

128128
const page = try bc.session.createPage();
129129

130+
// The isolate world must share at least some of the state with the related page, specifically the DocumentHTML
131+
// (assuming grantUniveralAccess will be set to True!).
132+
// We just created the world and the page. The page's state lives in the session, but is update on navigation.
133+
// This also means this pointer becomes invalid after removePage untill a new page is created.
134+
// Currently we have only 1 page/frame and thus also only 1 state in the isolate world.
135+
bc.isolated_world.?.scope.state = &page.state;
136+
130137
{
131138
const aux_data = try std.fmt.allocPrint(cmd.arena, "{{\"isDefault\":true,\"type\":\"default\",\"frameId\":\"{s}\"}}", .{target_id});
132139
bc.inspector.contextCreated(

0 commit comments

Comments
 (0)