mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-02-04 14:33:47 +00:00
run microtasks after each script execution
This don't change the behavior for async and deferred scripts. just run microtasks after a script execution
This commit is contained in:
@@ -38,7 +38,7 @@ const ScriptManager = @This();
|
|||||||
|
|
||||||
page: *Page,
|
page: *Page,
|
||||||
|
|
||||||
// used to prevent recursive evalutaion
|
// used to prevent recursive evaluation
|
||||||
is_evaluating: bool,
|
is_evaluating: bool,
|
||||||
|
|
||||||
// Only once this is true can deferred scripts be run
|
// Only once this is true can deferred scripts be run
|
||||||
@@ -801,7 +801,8 @@ pub const Script = struct {
|
|||||||
log.debug(.browser, "executed script", .{ .src = url, .success = success, .on_load = script_element._on_load != null });
|
log.debug(.browser, "executed script", .{ .src = url, .success = success, .on_load = script_element._on_load != null });
|
||||||
}
|
}
|
||||||
|
|
||||||
defer page.tick();
|
// We should run microtasks even if script execution fails.
|
||||||
|
defer page.js.runMicrotasks();
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
self.executeCallback("load", script_element._on_load, page);
|
self.executeCallback("load", script_element._on_load, page);
|
||||||
|
|||||||
Reference in New Issue
Block a user