mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 23:23:28 +00:00
userctx: inject user context
This commit is contained in:
@@ -54,6 +54,7 @@ const URLTestExecFn = url.testExecFn;
|
||||
const HTMLElementTestExecFn = @import("html/elements.zig").testExecFn;
|
||||
|
||||
pub const Types = jsruntime.reflect(apiweb.Interfaces);
|
||||
pub const UserContext = @import("user_context.zig").UserContext;
|
||||
|
||||
var doc: *parser.DocumentHTML = undefined;
|
||||
|
||||
@@ -81,6 +82,8 @@ fn testExecFn(
|
||||
std.debug.print("documentHTMLClose error: {s}\n", .{@errorName(err)});
|
||||
};
|
||||
|
||||
js_env.getUserContext().?.document = doc;
|
||||
|
||||
// alias global as self and window
|
||||
var window = Window.create(null);
|
||||
|
||||
@@ -315,7 +318,11 @@ fn testJSRuntime(alloc: std.mem.Allocator) !void {
|
||||
var arena_alloc = std.heap.ArenaAllocator.init(alloc);
|
||||
defer arena_alloc.deinit();
|
||||
|
||||
try jsruntime.loadEnv(&arena_alloc, testsAllExecFn);
|
||||
const userctx = UserContext{
|
||||
.document = null,
|
||||
};
|
||||
|
||||
try jsruntime.loadEnv(&arena_alloc, userctx, testsAllExecFn);
|
||||
}
|
||||
|
||||
test "DocumentHTMLParseFromStr" {
|
||||
|
||||
Reference in New Issue
Block a user