Skip to content

Commit 97bcfb6

Browse files
committed
Create non-default contexts
1 parent 5790c80 commit 97bcfb6

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/v8.zig

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,7 @@ pub const ObjectTemplate = struct {
10041004
.enumerator = configuration.enumerator orelse null,
10051005
.definer = configuration.definer orelse null,
10061006
.descriptor = configuration.descriptor orelse null,
1007-
.data = if (@typeInfo(@TypeOf(data)) == .@"null") null else getDataHandle(data),
1007+
.data = if (@typeInfo(@TypeOf(data)) == .null) null else getDataHandle(data),
10081008
.flags = configuration.flags,
10091009
};
10101010
c.v8__ObjectTemplate__SetIndexedHandler(self.handle, &conf);
@@ -1019,7 +1019,7 @@ pub const ObjectTemplate = struct {
10191019
.enumerator = configuration.enumerator orelse null,
10201020
.definer = configuration.definer orelse null,
10211021
.descriptor = configuration.descriptor orelse null,
1022-
.data = if (@typeInfo(@TypeOf(data)) == .@"null") null else getDataHandle(data),
1022+
.data = if (@typeInfo(@TypeOf(data)) == .null) null else getDataHandle(data),
10231023
.flags = configuration.flags,
10241024
};
10251025
c.v8__ObjectTemplate__SetNamedHandler(self.handle, &conf);
@@ -2478,12 +2478,13 @@ pub const Inspector = struct {
24782478
ctx: Context,
24792479
name: []const u8,
24802480
origin: []const u8,
2481-
auxData: ?[]const u8,
2481+
aux_data: ?[]const u8,
2482+
is_default: bool,
24822483
) void {
24832484
std.log.debug("Inspector contextCreated called", .{});
24842485
var auxData_ptr: [*c]const u8 = undefined;
24852486
var auxData_len: usize = undefined;
2486-
if (auxData) |data| {
2487+
if (aux_data) |data| {
24872488
auxData_ptr = data.ptr;
24882489
auxData_len = data.len;
24892490
} else {
@@ -2501,7 +2502,7 @@ pub const Inspector = struct {
25012502
contextGroupId,
25022503
ctx.handle,
25032504
);
2504-
self.ctx_handle = ctx.handle;
2505+
if (is_default) self.ctx_handle = ctx.handle;
25052506
}
25062507
};
25072508

0 commit comments

Comments
 (0)