Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/wpt/run.zig
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub fn run(arena: *std.heap.ArenaAllocator, comptime dir: []const u8, f: []const
var window = Window.create(null);
window.replaceDocument(html_doc);
window.setStorageShelf(&storageShelf);
try js_env.bindGlobal(window);
try js_env.bindGlobal(&window);

// thanks to the arena, we don't need to deinit res.
var res: jsruntime.JSResult = undefined;
Expand Down Expand Up @@ -107,10 +107,14 @@ pub fn run(arena: *std.heap.ArenaAllocator, comptime dir: []const u8, f: []const
}

// Mark tests as ready to run.
res = try evalJS(js_env, alloc, "window.dispatchEvent(new Event('load'));", "ready");
if (!res.success) {
return res;
}
const loadevt = try parser.eventCreate();
defer parser.eventDestroy(loadevt);

try parser.eventInit(loadevt, "load", .{});
_ = try parser.eventTargetDispatchEvent(
parser.toEventTarget(Window, &window),
loadevt,
);

// Check the final test status.
res = try evalJS(js_env, alloc, "report.status;", "teststatus");
Expand Down