mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 07:03:29 +00:00
Alias global as self and window
Signed-off-by: Francis Bouvier <francis.bouvier@gmail.com>
This commit is contained in:
@@ -20,6 +20,10 @@ fn execJS(
|
|||||||
js_env.start(apis);
|
js_env.start(apis);
|
||||||
defer js_env.stop();
|
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);
|
||||||
|
|
||||||
// add document object
|
// add document object
|
||||||
try js_env.addObject(apis, doc, "document");
|
try js_env.addObject(apis, doc, "document");
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ fn execJS(
|
|||||||
js_env.start(apis);
|
js_env.start(apis);
|
||||||
defer js_env.stop();
|
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);
|
||||||
|
|
||||||
// add document object
|
// add document object
|
||||||
try js_env.addObject(apis, doc, "document");
|
try js_env.addObject(apis, doc, "document");
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ fn testExecFn(
|
|||||||
js_env.start(apis);
|
js_env.start(apis);
|
||||||
defer js_env.stop();
|
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
|
// document
|
||||||
doc = try parser.documentHTMLParseFromFileAlloc(std.testing.allocator, "test.html");
|
doc = try parser.documentHTMLParseFromFileAlloc(std.testing.allocator, "test.html");
|
||||||
defer parser.documentHTMLClose(doc);
|
defer parser.documentHTMLClose(doc);
|
||||||
|
|||||||
2
vendor/jsruntime-lib
vendored
2
vendor/jsruntime-lib
vendored
Submodule vendor/jsruntime-lib updated: c22004957d...3c64a17a63
Reference in New Issue
Block a user