fix(preload): keep ordinary preloads from delaying window load

Use identity-only connected-link admission for ordinary preloads, including
CSP failures, so they cannot hold the Document load gate. Keep stylesheet
consumer leases and modulepreload fetch routing independent of that shared
non-blocking lifecycle.

Cover parser and dynamic preloads for six destinations with gated successful
and failed responses, proving Window load precedes completion while late
link events and resource timing remain observable. Preserve load blocking
for real stylesheet consumers and rel transitions.

Record two newly passing preload WPTs and verify modulepreload and MIME/as
controls. The pre-existing duplicate-fetch consumer case remains unchanged.
This commit is contained in:
ldm0
2026-11-24 14:32:19 +08:00
parent f9872f542c
commit 88e2d7de79
5 changed files with 10 additions and 26 deletions
@@ -8875,6 +8875,8 @@ pointerlock/constructor.html
pointerlock/pointerlock-requires-gesture.html
preload/avoid-delaying-onload-link-modulepreload-exec.html
preload/avoid-delaying-onload-link-modulepreload.html
preload/avoid-delaying-onload-link-preload-style.html
preload/avoid-delaying-onload-link-preload.html
preload/modulepreload-as.html
preload/modulepreload-json.html
preload/modulepreload-multiple.html
+2 -5
View File
@@ -9,11 +9,11 @@ use moli_core::{
use std::time::Instant;
use support::FixtureServer;
use tokio::time::Duration;
#[path = "fetch_behaviors/preload_lifecycle.rs"]
mod preload_lifecycle;
#[path = "fetch_behaviors/preload_as.rs"]
mod preload_as;
#[path = "fetch_behaviors/preload_lifecycle.rs"]
mod preload_lifecycle;
#[path = "fetch_behaviors/preload_crossorigin.rs"]
mod preload_crossorigin;
@@ -2216,6 +2216,3 @@ async fn carries_and_replaces_cookies_across_multi_hop_redirect_chain() -> Resul
#[path = "fetch_behaviors/encoded_video_chunk.rs"]
mod encoded_video_chunk;
#[path = "fetch_behaviors/cache_timing.rs"]
mod cache_timing;
@@ -88,7 +88,10 @@ async fn preload_type_and_media_admission_uses_child_document_viewport() -> Resu
Ok(())
}
async fn evaluate_preload_probe(page: &mut Page, fixture: &str) -> Result<serde_json::Value> {
pub(super) async fn evaluate_preload_probe(
page: &mut Page,
fixture: &str,
) -> Result<serde_json::Value> {
let result = tokio::time::timeout(
Duration::from_secs(15),
page.evaluate_runtime_expression_with_await_async(
@@ -1,4 +1,4 @@
use super::preload_lifecycle::evaluate_preload_probe;
use super::preload_as::evaluate_preload_probe;
use super::*;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::TcpListener;
@@ -1,24 +1,6 @@
use super::preload_as::evaluate_preload_probe;
use super::*;
pub(super) async fn evaluate_preload_probe(
page: &mut Page,
fixture: &str,
) -> Result<serde_json::Value> {
let result = tokio::time::timeout(
Duration::from_secs(15),
page.evaluate_runtime_expression_with_await_async(
&format!("({fixture}).then(JSON.stringify)"),
true,
),
)
.await??;
Ok(serde_json::from_str(
result["value"]
.as_str()
.expect("preload lifecycle observations"),
)?)
}
#[tokio::test(flavor = "multi_thread")]
async fn ordinary_preloads_do_not_delay_window_load_or_lose_late_events() -> Result<()> {
for dynamic in [false, true] {