Fix load event for page with no external scripts but with iframes

Previously the "load" event happened when all external scripts were done. In the
case that there was no external script, the "load" event would fire immediately
after parsing.

With iframes, it now waits for external script AND iframes to complete but the
no-external-script code was never updated to consider iframes and would thus
fire load events prematurely.
This commit is contained in:
Karl Seguin
2026-03-01 18:00:00 +08:00
parent 0a9e5b66ee
commit 84a949e7c7
2 changed files with 0 additions and 11 deletions

View File

@@ -866,11 +866,6 @@ fn pageDoneCallback(ctx: *anyopaque) !void {
.html => |buf| { .html => |buf| {
parser.parse(buf.items); parser.parse(buf.items);
self._script_manager.staticScriptsDone(); self._script_manager.staticScriptsDone();
if (self._script_manager.isDone()) {
// No scripts, or just inline scripts that were already processed
// we need to trigger this ourselves
self.documentIsComplete();
}
self._parse_state = .complete; self._parse_state = .complete;
}, },
.text => |*buf| { .text => |*buf| {

View File

@@ -582,12 +582,6 @@ fn evaluate(self: *ScriptManager) void {
} }
} }
pub fn isDone(self: *const ScriptManager) bool {
return self.static_scripts_done and // page is done processing initial html
self.defer_scripts.first == null and // no deferred scripts
self.async_scripts.first == null; // no async scripts
}
fn parseImportmap(self: *ScriptManager, script: *const Script) !void { fn parseImportmap(self: *ScriptManager, script: *const Script) !void {
const content = script.source.content(); const content = script.source.content();