browser: catch evalJS error and log them

This commit is contained in:
Pierre Tachoire
2023-12-22 09:36:28 +01:00
parent 670e920633
commit 51cd959e8c

View File

@@ -262,7 +262,7 @@ pub const Page = struct {
// > immediately before the browser continues to parse the // > immediately before the browser continues to parse the
// > page. // > page.
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#notes // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#notes
try self.evalScript(e); self.evalScript(e) catch |err| log.warn("evaljs: {any}", .{err});
}, },
else => continue, else => continue,
} }
@@ -277,7 +277,7 @@ pub const Page = struct {
// eval async scripts. // eval async scripts.
for (sasync.items) |e| { for (sasync.items) |e| {
try self.evalScript(e); self.evalScript(e) catch |err| log.warn("evaljs: {any}", .{err});
} }
// TODO wait for async scripts // TODO wait for async scripts