mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-28 22:53: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);
|
var window = Window.create(null);
|
||||||
window.replaceDocument(html_doc);
|
window.replaceDocument(html_doc);
|
||||||
window.setStorageShelf(&storageShelf);
|
window.setStorageShelf(&storageShelf);
|
||||||
try js_env.bindGlobal(window);
|
try js_env.bindGlobal(&window);
|
||||||
|
|
||||||
// thanks to the arena, we don't need to deinit res.
|
// thanks to the arena, we don't need to deinit res.
|
||||||
var res: jsruntime.JSResult = undefined;
|
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.
|
// Mark tests as ready to run.
|
||||||
res = try evalJS(js_env, alloc, "window.dispatchEvent(new Event('load'));", "ready");
|
const loadevt = try parser.eventCreate();
|
||||||
if (!res.success) {
|
defer parser.eventDestroy(loadevt);
|
||||||
return res;
|
|
||||||
}
|
try parser.eventInit(loadevt, "load", .{});
|
||||||
|
_ = try parser.eventTargetDispatchEvent(
|
||||||
|
parser.toEventTarget(Window, &window),
|
||||||
|
loadevt,
|
||||||
|
);
|
||||||
|
|
||||||
// Check the final test status.
|
// Check the final test status.
|
||||||
res = try evalJS(js_env, alloc, "report.status;", "teststatus");
|
res = try evalJS(js_env, alloc, "report.status;", "teststatus");
|
||||||
|
|||||||
Reference in New Issue
Block a user