Skip to content

Commit 008d424

Browse files
committed
fix fetch for completeness
1 parent faefa19 commit 008d424

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/main.zig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ pub fn main() !void {
9797
var browser = try Browser.init(app);
9898
defer browser.deinit();
9999

100+
const v8 = @import("v8");
101+
var temp_scope: v8.HandleScope = undefined;
102+
v8.HandleScope.init(&temp_scope, browser.env.isolate);
103+
defer temp_scope.deinit();
104+
100105
var session = try browser.newSession({});
101106

102107
// page

src/runtime/js.zig

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,22 +1137,26 @@ pub fn Env(comptime S: type, comptime types: anytype) type {
11371137
}
11381138

11391139
pub fn call(self: *const Callback, args: anytype) !void {
1140-
// const v8 = @import("v8");
11411140
var temp_scope: v8.HandleScope = undefined;
11421141
v8.HandleScope.init(&temp_scope, self.executor.isolate);
11431142
defer temp_scope.deinit();
1143+
11441144
return self.callWithThis(self.getThis(), args);
11451145
}
11461146

11471147
pub fn tryCall(self: *const Callback, args: anytype, result: *Result) !void {
1148-
// const v8 = @import("v8");
11491148
var temp_scope: v8.HandleScope = undefined;
11501149
v8.HandleScope.init(&temp_scope, self.executor.isolate);
11511150
defer temp_scope.deinit();
1151+
11521152
return self.tryCallWithThis(self.getThis(), args, result);
11531153
}
11541154

11551155
pub fn tryCallWithThis(self: *const Callback, this: anytype, args: anytype, result: *Result) !void {
1156+
var temp_scope: v8.HandleScope = undefined;
1157+
v8.HandleScope.init(&temp_scope, self.executor.isolate);
1158+
defer temp_scope.deinit();
1159+
11561160
var try_catch: TryCatch = undefined;
11571161
try_catch.init(self.executor);
11581162
defer try_catch.deinit();
@@ -1171,6 +1175,10 @@ pub fn Env(comptime S: type, comptime types: anytype) type {
11711175
}
11721176

11731177
pub fn callWithThis(self: *const Callback, this: anytype, args: anytype) !void {
1178+
var temp_scope: v8.HandleScope = undefined;
1179+
v8.HandleScope.init(&temp_scope, self.executor.isolate);
1180+
defer temp_scope.deinit();
1181+
11741182
const executor = self.executor;
11751183

11761184
const js_this = try executor.valueToExistingObject(this);

0 commit comments

Comments
 (0)