Merge pull request #2164 from lightpanda-io/Page_createIsolatedWorld

Fix Page.createIsolatedWorld
This commit is contained in:
Karl Seguin
2026-04-16 15:16:51 +08:00
committed by GitHub
5 changed files with 24 additions and 5 deletions

View File

@@ -13,7 +13,7 @@ inputs:
zig-v8:
description: 'zig v8 version to install'
required: false
default: 'v0.3.9'
default: 'v0.4.0'
v8:
description: 'v8 version to install'
required: false

View File

@@ -3,7 +3,7 @@ FROM debian:stable-slim
ARG MINISIG=0.12
ARG ZIG_MINISIG=RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U
ARG V8=14.0.365.4
ARG ZIG_V8=v0.3.9
ARG ZIG_V8=v0.4.0
ARG TARGETPLATFORM
RUN apt-get update -yq && \

View File

@@ -5,8 +5,8 @@
.minimum_zig_version = "0.15.2",
.dependencies = .{
.v8 = .{
.url = "https://github.com/lightpanda-io/zig-v8-fork/archive/refs/tags/v0.3.9.tar.gz",
.hash = "v8-0.0.0-xddH64iHBACfPm7oAqZerjmLLO6ftP4Yg5V7dtEGcD0i",
.url = "https://github.com/lightpanda-io/zig-v8-fork/archive/refs/tags/v0.4.0.tar.gz",
.hash = "v8-0.0.0-xddH61yIBAD04dV4CHW0qIFiqbOGvkN_-amGdmgbQ3dU",
},
// .v8 = .{ .path = "../zig-v8-fork" },
.brotli = .{

View File

@@ -128,6 +128,10 @@ pub fn contextCreated(
}
}
pub fn getContextId(_: *const Inspector, local: *const js.Local) i32 {
return v8.v8__inspector__executionContextId(local.handle);
}
pub fn contextDestroyed(self: *Inspector, context: *const v8.Context) void {
v8.v8_inspector__Inspector__ContextDestroyed(self.handle, context);

View File

@@ -257,7 +257,22 @@ fn createIsolatedWorld(cmd: *CDP.Command) !void {
const page = bc.session.currentPage() orelse return error.PageNotLoaded;
const js_context = try world.createContext(page);
return cmd.sendResult(.{ .executionContextId = js_context.id }, .{});
const aux_data = try std.fmt.allocPrint(cmd.arena, "{{\"isDefault\":false,\"type\":\"isolated\",\"frameId\":\"{s}\"}}", .{params.frameId});
var ls: js.Local.Scope = undefined;
js_context.localScope(&ls);
defer ls.deinit();
bc.inspector_session.inspector.contextCreated(
&ls.local,
params.worldName,
page.origin orelse "",
aux_data,
false,
);
const context_id = bc.inspector_session.inspector.getContextId(&ls.local);
return cmd.sendResult(.{ .executionContextId = context_id }, .{});
}
fn navigate(cmd: *CDP.Command) !void {