mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 23:23:28 +00:00
window: use window as global object
This commit is contained in:
@@ -41,10 +41,6 @@ fn testExecFn(
|
||||
try js_env.start(alloc);
|
||||
defer js_env.stop();
|
||||
|
||||
// alias global as self and window
|
||||
try js_env.attachObject(try js_env.getGlobal(), "self", null);
|
||||
try js_env.attachObject(try js_env.getGlobal(), "window", null);
|
||||
|
||||
// document
|
||||
const file = try std.fs.cwd().openFile("test.html", .{});
|
||||
defer file.close();
|
||||
@@ -54,8 +50,10 @@ fn testExecFn(
|
||||
std.debug.print("documentHTMLClose error: {s}\n", .{@errorName(err)});
|
||||
};
|
||||
|
||||
// add document object
|
||||
try js_env.addObject(doc, "document");
|
||||
// alias global as self and window
|
||||
var window = Window.create(null);
|
||||
window.replaceDocument(parser.documentHTMLToDocument(doc));
|
||||
try js_env.bindGlobal(window);
|
||||
|
||||
// run test
|
||||
try execFn(alloc, js_env);
|
||||
|
||||
Reference in New Issue
Block a user