Merge pull request #1409 from lightpanda-io/cleanup

zig fmt, remove unused code
This commit is contained in:
Karl Seguin
2026-01-24 07:49:25 +08:00
committed by GitHub
11 changed files with 11 additions and 35 deletions

View File

@@ -134,11 +134,3 @@ pub fn removeContext(self: *ExecutionWorld) void {
self.env.isolate.notifyContextDisposed();
_ = self.context_arena.reset(.{ .retain_with_limit = CONTEXT_ARENA_RETAIN });
}
pub fn terminateExecution(self: *const ExecutionWorld) void {
self.env.isolate.terminateExecution();
}
pub fn resumeExecution(self: *const ExecutionWorld) void {
self.env.isolate.cancelTerminateExecution();
}

View File

@@ -1190,7 +1190,8 @@ fn _debugValue(self: *const Local, js_val: js.Value, seen: *std.AutoHashMapUnman
const js_obj = js_val.toObject();
{
// explicit scope because gop will become invalid in recursive call
const gop = try seen.getOrPut(self.call_arena, js_obj.getId());
const obj_id: u32 = @bitCast(v8.v8__Object__GetIdentityHash(js_obj.handle));
const gop = try seen.getOrPut(self.call_arena, obj_id);
if (gop.found_existing) {
return writer.writeAll("<circular>\n");
}

View File

@@ -31,10 +31,6 @@ const Object = @This();
local: *const js.Local,
handle: *const v8.Object,
pub fn getId(self: Object) u32 {
return @bitCast(v8.v8__Object__GetIdentityHash(self.handle));
}
pub fn has(self: Object, key: anytype) bool {
const ctx = self.local.ctx;
const key_handle = if (@TypeOf(key) == *const v8.String) key else ctx.isolate.initStringHandle(key);

View File

@@ -32,12 +32,8 @@ pub fn init(self: *TryCatch, l: *const js.Local) void {
v8.v8__TryCatch__CONSTRUCT(&self.handle, l.isolate.handle);
}
pub fn hasCaught(self: TryCatch) bool {
return v8.v8__TryCatch__HasCaught(&self.handle);
}
pub fn caught(self: TryCatch, allocator: Allocator) ?Caught {
if (!self.hasCaught()) {
if (!v8.v8__TryCatch__HasCaught(&self.handle)) {
return null;
}

View File

@@ -81,10 +81,6 @@ pub const ArrayBuffer = struct {
pub const Exception = struct {
local: *const Local,
handle: *const v8.Value,
pub fn exception(self: Exception, allocator: Allocator) ![]const u8 {
return self.local.valueToString(self.handel, .{ .allocator = allocator });
}
};
// These are simple types that we can convert to JS with only an isolate. This

View File

@@ -771,11 +771,6 @@ const IsolatedWorld = struct {
false,
);
}
pub fn createContextAndLoadPolyfills(self: *IsolatedWorld, page: *Page) !void {
// We need to recreate the isolated world context
try self.createContext(page);
}
};
// This is a generic because when we send a result we have two different

View File

@@ -190,7 +190,7 @@ fn createIsolatedWorld(cmd: anytype) !void {
const world = try bc.createIsolatedWorld(params.worldName, params.grantUniveralAccess);
const page = bc.session.currentPage() orelse return error.PageNotLoaded;
try world.createContextAndLoadPolyfills(page);
try world.createContext(page);
const js_context = &world.executor.context.?;
// Create the auxdata json for the contextCreated event
@@ -292,7 +292,7 @@ pub fn pageRemove(bc: anytype) !void {
pub fn pageCreated(bc: anytype, page: *Page) !void {
for (bc.isolated_worlds.items) |*isolated_world| {
try isolated_world.createContextAndLoadPolyfills(page);
try isolated_world.createContext(page);
}
}