Clear native modal state and the old Document registration when connected nodes are removed or adopted. Keep validated atomic moves in their original opening and priority, including the split DOMDebugger path. Cover light and shadow subtrees, adoption and background inertness.
Prepare linked and inline requests at parser admission, then read the current
delivered Document policy for each newly discovered import. Each request keeps
its own policy through redirects, so later meta policies constrain new imports
without retroactively rejecting requests that were already admitted.
Reuse the existing meta policy registry and import collector. Register the
request and final URL of every completed sheet before expanding its imports,
and skip graph installation and repeated CSSOM refresh for links without
imports.
Cover dynamic and parser-delivered meta policies, same- and cross-origin
roots, inline imports, blocked data imports, and nested redirect cycles.
Retain the original root resource URL alongside the response parser base when
installing live import graphs, so a redirected link cannot import its root
response again through the original URL.
Capture the exact child Document's CSP for parser stylesheet graphs. Check
network and data imports before loading, apply policy to redirect targets, and
validate cached or Service Worker redirect chains for the current consumer.
Queue violations through the existing exact-Document Page task path and target
the child Document. Refused imports still settle parser and load blockers.
Use inherited native origins for local Documents' CSP self checks, independently
of their live base URL. Cover redirected cycles, linked and inline import graphs,
enforced/meta/report-only policies, redirect targets, data imports and srcdoc.
Process parser and script-created refresh declarations in order and retain them
on their owning Document across load callbacks and adoption. Share candidate
priority and deadline state between main and child documents, and arm child
timers after owner load completes.
Consume queued work by exact Document identity and revision, classify navigation
when it fires, and keep the registered target URL. Reprocess same-value meta
attributes using the matched Attr identity so XML case, namespaces, observer
records, and refresh deadlines remain correct.
Cover competing declarations, stale tasks, independent frames, load/adoption
boundaries, sandbox/shadow handling, saved targets, and fragment navigation.
Store top-navigation permission in the existing DocumentSandboxPolicy and
combine iframe and response CSP restrictions. Read the committed policy
when checking navigation instead of the live iframe sandbox attribute.
Cover adding and removing restrictions after load, applying them on the
next navigation, and combining iframe and CSP permissions.
Keep main-driver and document.write blockers in one Document-owned slot.
Claim pending work before executing JavaScript so reentrant writes can
install a successor without cleanup from the outer execution removing it.
Use one readiness gate for inserted-source and stylesheet completion, carry
continuations behind new blockers, and discard retired document or driver
work. Cover both resource completion orders, nested writes and main-resource
failure.
Keep the continuation owner in each parser suspension, so scheduler routing
does not infer it from document.write pending work. Require matching
ownership when consuming resume permits and cover both stylesheet paths
with regression tests.
Flush parser insertion reactions after the tree builder completes its current
token so connected callbacks run before children without retaining parser
borrows across JavaScript execution.
Keep one DocumentParserSession and expose a restricted insertion handle for
nested writes. Share input, suspension, cancellation, and close state so
blocked writes remain queued and outer feeds stop when nested parsing blocks
or replaces the document. Let the owning session finish deferred close and
dispatch readiness transitions once.
Reuse form-owner mutation detection for child parser insertions and add
regressions for reaction order, form association, nested writes, gated external
scripts, document replacement, and deferred close.
Validation: cargo fmt --all; strict workspace Clippy; cargo nextest run
--no-fail-fast (18,104 passed, 13 existing skips); release build.
Keep physical stylesheet fetches and import graph work shared while installing CSSOM state and terminal events for every link owner. Settle completed clients at admission, retain completed import graphs for late owners, and validate document ownership before asynchronous installation.
This replaces the abandoned turn-exit replay path with an explicit shared-fetch/per-owner lifecycle model and adds coverage for document.write(), data URLs, imports, failures, node mutation, and document replacement.
Use a synchronous prepare/commit/apply boundary for connected stylesheet lifecycle authority, so DocumentRuntime no longer acquires it through raw ContextHost pointers. Keep modulepreload network fetches identity-only and publish terminal link events without a Document load-delay lease.