From 3db18870d96c8c19559bf2e2570ced91758a141e Mon Sep 17 00:00:00 2001 From: ldm0 Date: Thu, 10 Sep 2026 02:59:28 +0800 Subject: [PATCH] fix(script): keep parser async work runnable after EOF Async scripts still fetching at parser EOF previously entered a queue behind DOMContentLoaded, allowing a slow defer script to block a ready async script or its error event. Transfer remaining async work to the exact Document runtime producer and publish each task when its source completes, retaining its load-delay lease. Preserve observed async completion order across parser handoff. Add gated success, failure, and out-of-order completion tests, and update the WPT ledger for execution-timing/085.html. Validation: - cargo fmt --all - cargo clippy --workspace --all-targets --all-features -- -D warnings - cargo nextest run --no-fail-fast: 17,879 passed, 13 skipped - 270 WPT cases: 257 to 258 passes, no case or subtest regressions --- moli-benchmark/wpt-cross-current/failed-cases.txt | 1 - moli-core/tests/scripts.rs | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/moli-benchmark/wpt-cross-current/failed-cases.txt b/moli-benchmark/wpt-cross-current/failed-cases.txt index b7c205e1390..8f2dd1dce1f 100644 --- a/moli-benchmark/wpt-cross-current/failed-cases.txt +++ b/moli-benchmark/wpt-cross-current/failed-cases.txt @@ -59,7 +59,6 @@ content-security-policy/resource-hints/prefetch-allowed-with-conflicting-permiss content-security-policy/resource-hints/prefetch-generate-directives.html content-security-policy/resource-hints/prefetch-no-csp.html content-security-policy/sandbox/autoplay-disabled-by-csp.html -content-security-policy/script-src/non-nonceable-elements.html content-security-policy/script-src/script-src-trusted_types_eval_DedicatedWorker.html content-security-policy/securitypolicyviolation/blockeduri-inline.html content-security-policy/unsafe-eval/eval-blocked-in-about-blank-iframe.html diff --git a/moli-core/tests/scripts.rs b/moli-core/tests/scripts.rs index 39800d5bf6d..b80ef8c99f1 100644 --- a/moli-core/tests/scripts.rs +++ b/moli-core/tests/scripts.rs @@ -39,6 +39,9 @@ mod parser_preparation; #[path = "scripts/lifecycle_task_order.rs"] mod lifecycle_task_order; +#[path = "scripts/post_parse_async.rs"] +mod post_parse_async; + fn diagnostic_global<'a>( page: &'a moli_core::page::Page, name: &str,