You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently we don't fully implement load blocking events correctly. This is most noticeable with iframes, where the load of an iframe can fire too early. This leads to issues like #41807 (comment)
This is part of a broader the broader effort #31973 to fix iframe loading.
Right now, it is implemented as bool and the script_thread is eagerly called, despite multiple other factors that could also delay the load event.
// The user agent must take this nested browsing context
// out of the delaying load events mode
// when this navigation algorithm later matures.
window_proxy.stop_delaying_load_events_mode();
}
is one of the culprits here. It immediately causes document.maybe_queue_document_completion() to run, despite it shouldn't run since we only finished parsing. I will update this issue when I know more concretely what's missing.
Sorry, yes it should be called, but it still thinks that it is ready to load. So the calling is correct, but the determining of not_ready_for_load isn't. Unfortunately it's quite tricky to determine why that's the case, so will need to do more debugging.
Activity
jdm commentedon Jan 17, 2026
Can you be more specific about this? The LoadBlocker does a lot of heavy lifting to track those factors that delay the load event.
TimvdLippe commentedon Jan 17, 2026
Yeah I did a large debugging session yesterday and still trying to figure out the pieces of the puzzle. But I believe
servo/components/script/script_thread.rs
Lines 3312 to 3318 in 1fa5fdc
document.maybe_queue_document_completion()to run, despite it shouldn't run since we only finished parsing. I will update this issue when I know more concretely what's missing.jdm commentedon Jan 17, 2026
maybe_queue_document_completion is called maybe because it checks for outstanding loadblockers first in
servo/components/script/dom/document.rs
Line 2390 in 6e948ee
TimvdLippe commentedon Jan 17, 2026
Sorry, yes it should be called, but it still thinks that it is ready to load. So the calling is correct, but the determining of
not_ready_for_loadisn't. Unfortunately it's quite tricky to determine why that's the case, so will need to do more debugging.jdm commentedon Jan 17, 2026
Yeah, it's believable that we're leaving the delaying mode earlier than we should be. For my own reference, the updated specification link for that is https://html.spec.whatwg.org/multipage/browsing-the-web.html#finalize-a-cross-document-navigation
script: Introduce end of loading phases
TimvdLippe commentedon Feb 8, 2026
I figured out the issue: when we stop the delaying of the load event, we do that for the child proxy. However, per https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-iframe-element:delay-the-load-event the iframe element delays its owner document when its content navigable is in delaying load mode. Therefore, we should instead unblock its parent, not itself when we are no longer in delaying mode. Working on #42446 to figure out how to improve the situation here
script: Introduce end of loading phases
script: Introduce end of loading phases
script: Introduce end of loading phases
TimvdLippe commentedon Feb 9, 2026
Okay, that PR is not sufficient on its own (the test still fails), but I think it unblocks the proper fix for the loadblocking of iframes.
script: Introduce end of loading phases
script: Introduce end of loading phases
script: Fix delaying load event blocker for parents
script: Introduce end of loading phases
script: Introduce end of loading phases
script: Introduce end of loading phases
script: Fix delaying load event blocker for parents
script: Introduce end of loading phases (#42446)
script: Introduce end of loading phases
script: Introduce end of loading phases
script: Introduce end of loading phases
script: Introduce end of loading phases
script: Introduce end of loading phases (servo#46059)