mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-28 14:43:28 +00:00
Merge pull request #233 from lightpanda-io/fix-window-global
wpt: dispatch native event
This commit is contained in:
@@ -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;
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user