diff --git a/src/main.zig b/src/main.zig index 580e8971..719b31ea 100644 --- a/src/main.zig +++ b/src/main.zig @@ -50,7 +50,7 @@ fn execJS( pub fn main() !void { // generate APIs - const apis = jsruntime.compile(DOM.Interfaces); + const apis = try jsruntime.compile(DOM.Interfaces); // create v8 vm const vm = jsruntime.VM.init(); diff --git a/src/main_shell.zig b/src/main_shell.zig index e55facb5..9283acf2 100644 --- a/src/main_shell.zig +++ b/src/main_shell.zig @@ -33,7 +33,7 @@ fn execJS( pub fn main() !void { // generate APIs - const apis = jsruntime.compile(DOM.Interfaces); + const apis = try jsruntime.compile(DOM.Interfaces); // allocator var gpa = std.heap.GeneralPurposeAllocator(.{}){}; diff --git a/src/main_wpt.zig b/src/main_wpt.zig index 6c54d69b..fe75630a 100644 --- a/src/main_wpt.zig +++ b/src/main_wpt.zig @@ -12,9 +12,6 @@ const HTMLElem = @import("html/elements.zig"); const wpt_dir = "tests/wpt"; -// generate APIs -const apis = jsruntime.compile(DOM.Interfaces); - // FileLoader loads files content from the filesystem. const FileLoader = struct { const FilesMap = std.StringHashMap([]const u8); @@ -65,6 +62,10 @@ const FileLoader = struct { // Once browsercore will have the html loader, it would be useful to refacto // this test to use it. pub fn main() !void { + + // generate APIs + const apis = comptime try jsruntime.compile(DOM.Interfaces); + std.debug.print("Running WPT test suite\n", .{}); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; @@ -122,7 +123,7 @@ pub fn main() !void { // TODO I don't use testing.expect here b/c I want to execute all the // tests. And testing.expect stops running test in the first failure. - const res = runWPT(&arena, tc, &loader) catch |err| { + const res = runWPT(&arena, apis, tc, &loader) catch |err| { std.debug.print("FAIL\t{s}\n{any}\n", .{ tc, err }); failures += 1; continue; @@ -152,7 +153,7 @@ pub fn main() !void { // runWPT parses the given HTML file, starts a js env and run the first script // tags containing javascript sources. // It loads first the js libs files. -fn runWPT(arena: *std.heap.ArenaAllocator, f: []const u8, loader: *FileLoader) !jsruntime.JSResult { +fn runWPT(arena: *std.heap.ArenaAllocator, comptime apis: []jsruntime.API, f: []const u8, loader: *FileLoader) !jsruntime.JSResult { const alloc = arena.allocator(); // document diff --git a/src/run_tests.zig b/src/run_tests.zig index 5cd637a9..8860bc67 100644 --- a/src/run_tests.zig +++ b/src/run_tests.zig @@ -65,7 +65,7 @@ test { try generate.tests(); // generate APIs - const apis = jsruntime.compile(DOM.Interfaces); + const apis = try jsruntime.compile(DOM.Interfaces); // create JS vm const vm = jsruntime.VM.init(); diff --git a/vendor/jsruntime-lib b/vendor/jsruntime-lib index 3b53c93c..bde400ea 160000 --- a/vendor/jsruntime-lib +++ b/vendor/jsruntime-lib @@ -1 +1 @@ -Subproject commit 3b53c93cf37b79253c3ed9e38ff9aa802e832711 +Subproject commit bde400eae6652df5c358e94aa66998b291b955c5