mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-16 16:28:58 +00:00
wpt: defer console log display
This commit is contained in:
@@ -40,12 +40,19 @@ pub fn run(arena: *std.heap.ArenaAllocator, comptime dir: []const u8, f: []const
|
|||||||
try js_env.start(alloc);
|
try js_env.start(alloc);
|
||||||
defer js_env.stop();
|
defer js_env.stop();
|
||||||
|
|
||||||
// add document object
|
// display console logs
|
||||||
try js_env.addObject(html_doc, "document");
|
defer {
|
||||||
|
var res = evalJS(js_env, alloc, "console.join('\\n');", "console") catch unreachable;
|
||||||
|
defer res.deinit(alloc);
|
||||||
|
if (res.result.len > 0) {
|
||||||
|
std.debug.print("-- CONSOLE LOG\n{s}\n--\n", .{res.result});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// alias global as self and window
|
// setup global env vars.
|
||||||
try js_env.attachObject(try js_env.getGlobal(), "self", null);
|
try js_env.attachObject(try js_env.getGlobal(), "self", null);
|
||||||
try js_env.attachObject(try js_env.getGlobal(), "window", null);
|
try js_env.attachObject(try js_env.getGlobal(), "window", null);
|
||||||
|
try js_env.addObject(html_doc, "document");
|
||||||
|
|
||||||
// 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;
|
||||||
@@ -114,12 +121,6 @@ pub fn run(arena: *std.heap.ArenaAllocator, comptime dir: []const u8, f: []const
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
// display console logs
|
|
||||||
res = try evalJS(js_env, alloc, "console.join(', ');", "console");
|
|
||||||
if (res.result.len > 0) {
|
|
||||||
std.debug.print("-- CONSOLE LOG\n{s}\n--\n", .{res.result});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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");
|
||||||
if (!res.success) {
|
if (!res.success) {
|
||||||
|
|||||||
Reference in New Issue
Block a user