mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-02-04 14:33:47 +00:00
zig fmt, remove unused code
This commit is contained in:
@@ -134,11 +134,3 @@ pub fn removeContext(self: *ExecutionWorld) void {
|
|||||||
self.env.isolate.notifyContextDisposed();
|
self.env.isolate.notifyContextDisposed();
|
||||||
_ = self.context_arena.reset(.{ .retain_with_limit = CONTEXT_ARENA_RETAIN });
|
_ = 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();
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1190,7 +1190,8 @@ fn _debugValue(self: *const Local, js_val: js.Value, seen: *std.AutoHashMapUnman
|
|||||||
const js_obj = js_val.toObject();
|
const js_obj = js_val.toObject();
|
||||||
{
|
{
|
||||||
// explicit scope because gop will become invalid in recursive call
|
// 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) {
|
if (gop.found_existing) {
|
||||||
return writer.writeAll("<circular>\n");
|
return writer.writeAll("<circular>\n");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,10 +31,6 @@ const Object = @This();
|
|||||||
local: *const js.Local,
|
local: *const js.Local,
|
||||||
handle: *const v8.Object,
|
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 {
|
pub fn has(self: Object, key: anytype) bool {
|
||||||
const ctx = self.local.ctx;
|
const ctx = self.local.ctx;
|
||||||
const key_handle = if (@TypeOf(key) == *const v8.String) key else ctx.isolate.initStringHandle(key);
|
const key_handle = if (@TypeOf(key) == *const v8.String) key else ctx.isolate.initStringHandle(key);
|
||||||
|
|||||||
@@ -32,12 +32,8 @@ pub fn init(self: *TryCatch, l: *const js.Local) void {
|
|||||||
v8.v8__TryCatch__CONSTRUCT(&self.handle, l.isolate.handle);
|
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 {
|
pub fn caught(self: TryCatch, allocator: Allocator) ?Caught {
|
||||||
if (!self.hasCaught()) {
|
if (!v8.v8__TryCatch__HasCaught(&self.handle)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -81,10 +81,6 @@ pub const ArrayBuffer = struct {
|
|||||||
pub const Exception = struct {
|
pub const Exception = struct {
|
||||||
local: *const Local,
|
local: *const Local,
|
||||||
handle: *const v8.Value,
|
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
|
// These are simple types that we can convert to JS with only an isolate. This
|
||||||
|
|||||||
@@ -771,11 +771,6 @@ const IsolatedWorld = struct {
|
|||||||
false,
|
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
|
// This is a generic because when we send a result we have two different
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ fn createIsolatedWorld(cmd: anytype) !void {
|
|||||||
|
|
||||||
const world = try bc.createIsolatedWorld(params.worldName, params.grantUniveralAccess);
|
const world = try bc.createIsolatedWorld(params.worldName, params.grantUniveralAccess);
|
||||||
const page = bc.session.currentPage() orelse return error.PageNotLoaded;
|
const page = bc.session.currentPage() orelse return error.PageNotLoaded;
|
||||||
try world.createContextAndLoadPolyfills(page);
|
try world.createContext(page);
|
||||||
const js_context = &world.executor.context.?;
|
const js_context = &world.executor.context.?;
|
||||||
|
|
||||||
// Create the auxdata json for the contextCreated event
|
// 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 {
|
pub fn pageCreated(bc: anytype, page: *Page) !void {
|
||||||
for (bc.isolated_worlds.items) |*isolated_world| {
|
for (bc.isolated_worlds.items) |*isolated_world| {
|
||||||
try isolated_world.createContextAndLoadPolyfills(page);
|
try isolated_world.createContext(page);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user