Commit Graph
59 Commits
Author SHA1 Message Date
ldm0 1e71e557f8 fix(iframe): reject ancestor URLs during attribute navigation 2026-11-20 22:47:42 +08:00
ldm0 d9d85b497d fix(fonts): validate font set queries with Stylo 2026-11-20 22:47:41 +08:00
ldm0 6ef3d8b3b9 fix(fonts): validate binary FontFace sources
Decode and validate binary font data before marking a FontFace loaded, and
check SFNT table extents for every face in a collection. Reuse the stronger
validation for URL fonts so truncated unused tables cannot escape detection.

Reject shared and resizable sources during argument conversion, then copy
ordinary BufferSource bytes after descriptor conversion. Retain validated
bytes independently of later caller mutations and transfers.

Cover real TTF, WOFF and WOFF2 inputs, offset views, malformed and truncated
fonts, shared/resizable/detached buffers, descriptor side effects, collections,
URL font validation and cross-realm promises and errors.
2026-11-20 22:47:41 +08:00
ldm0 1ae6b469a1 fix(fonts): load URL-backed FontFace resources asynchronously
Fetch and validate font bytes through the owning Document resource loader,
including URL fallback, CORS, CSP redirects, Service Workers and preload/SRI
consumption. Preserve loaded promises and track pending FontFaceSet members,
ready promises and queued loading events.

Keep font tasks separate from author timer cancellation and dispatch child
CSP violations at their source Document. Replace fake font fixtures and
synchronous load assertions with real bytes and task-driven checks.
2026-11-20 22:47:41 +08:00
ldm0 148e687f46 fix(sri): preserve supported hashes with malformed padding
Keep supported hash metadata through verification so misplaced or excess
base64 padding cannot disable integrity checks or select a weaker algorithm.
Accept matching noncanonical base64 without changing encoded metadata used
by CSP and preload consumption.

Cover script, preload, CSP, and Window/Worker fetch consumers. Validate with
cargo fmt, workspace Clippy, and all 19,886 nextest tests, plus browser
comparisons and SRI/preload WPT regressions.
2026-11-20 22:47:41 +08:00
ldm0 09a5096546 fix(preload): consume stylesheet preload responses 2026-11-20 22:47:41 +08:00
ldm0 d5e2966cd8 fix(preload): consume document-owned preload responses 2026-11-20 22:47:41 +08:00
ldm0 fc35034823 fix(preload): verify ordinary preload integrity
Check ordinary preload responses with the shared SRI implementation, including CORS eligibility and Service Worker response filters. Dispatch error on verification failure while retaining the actual response bytes for Resource Timing.

Cover top-level and child parser links, dynamic links, binary bodies, redirect taint, hash selection, and Service Worker responses with integration regressions.
2026-11-20 22:47:41 +08:00
ldm0 e62886720d fix(dom): clear defaultView after browsing context destruction 2026-11-20 22:47:39 +08:00
ldm0 8ded1211c9 fix(runtime): preserve retained child Window globals 2026-11-20 22:47:39 +08:00
ldm0 c60e7af73b fix(dom): update document.open URLs from the entry document 2026-11-20 22:47:39 +08:00
ldm0 8f8b1c994a fix(parser): respect script nesting for stylesheet waits 2026-11-20 22:47:39 +08:00
ldm0 8868449086 fix(runtime): admit document lifecycle during awaited evaluation 2026-11-20 22:47:39 +08:00
ldm0 59c1a08507 fix(parser): preserve nested document.write insertion points
Keep blocked writes with the input position saved by each parser script. Share the context between main and child parsers so external-script suspension preserves nested caller tails and consecutive write order.

Add four integration regressions across main/child and navigation/script-created parsers. Validated with fmt, strict workspace Clippy, 19474 passing nextest tests, 18 Chromium comparison checks, and 50 WPT pages without new failures.
2026-11-20 22:47:39 +08:00
ldm0 eaf4fc9c9e fix(html): queue child load delivery through the DOM source
Queue iframe load delivery alongside other DOM tasks and include current
child lifecycle owners in the existing lifecycle scheduling preference.
This keeps initial load ahead of module timers that replace the document.

Cover inline, imported, external, and top-level-await modules using parent
and child timers. Check adopted-image events against the shared DOM FIFO.
Update the WPT ledgers for the three repaired delayed module-write cases.

Validation:
- cargo fmt --all
- cargo clippy --workspace --all-targets --all-features -- -D warnings
- cargo nextest run --no-fail-fast: 17,875 passed, 13 skipped
- 270 WPT cases: 254 to 257 passes, no case or subtest regressions
2026-11-20 22:47:36 +08:00
ldm0 379493363d fix(html): queue document lifecycle transitions on the DOM source
Admit DOMContentLoaded and main Window load after their parser/defer and load
prerequisites so earlier DOM tasks keep their FIFO positions. Keep interactive
readiness at parser stop, preserve child realm prerequisites, and return a load
boundary to its driver if an earlier DOM callback adds a new load delay.

Queue parser-owned external import-map errors during preparation, including
child and document.write parsers, so later dynamic errors cannot overtake them.
Cover ordering, replacement and load-delay behavior in main and child documents.

Validation:
- cargo fmt --all
- cargo clippy --workspace --all-targets --all-features -- -D warnings
- cargo nextest run --no-fail-fast: 17,871 passed, 13 skipped
- 270 WPT cases: 254 pass, 10 fail, 5 timeout, 1 error; one new pass and
  no case-status or passing-subtest-count regressions
2026-11-20 22:47:36 +08:00
ldm0 5070746e60 fix(parser): checkpoint microtasks before preparing parser scripts
Yield live HTML script preparation to the document owner after releasing
parser borrows. Prepare from the current DOM after the guarded microtask
checkpoint, and abandon stale handoffs when that checkpoint replaces the
document. Apply the boundary to main documents, child documents, and
document.write; preserve eager parsing when no runtime owner is installed.

Admit parser async classic scripts after preparation and keep nested
script cleanup from draining microtasks while an outer script is running.
Add main/child integration coverage and update the two repaired WPT cases.

Validation:
- cargo fmt --all
- cargo clippy --workspace --all-targets --all-features -- -D warnings
- cargo nextest run --no-fail-fast: 17,846 passed, 13 skipped
- 245 related WPT cases: all 231 previously passing cases remain passing
- Final CLI build: both repaired WPT cases pass on the validated sources
2026-11-20 22:47:36 +08:00
ldm0 d3f3e6f497 fix(script): checkpoint microtasks during event callback cleanup
Perform HTML script cleanup between event callbacks when the execution-context stack becomes empty, retaining currentTarget, passive state, and window.event through the checkpoint. Preserve script execution scopes during exception reporting, use the same callback boundary for Worker.onerror, and guard the complete microtask checkpoint against reentrancy.

Remove deferred window.event restoration. Update callback-order assertions and asynchronous fixtures to wait for the final event they inspect, while retaining scheduler, document-owner, and follow-up checks. Add Window, child Window, and Worker coverage for nested dispatch, listener removal in microtasks, and script versus callback exceptions.

Callback exception ordering follows Web IDL cleanup before rethrow; the local Chromium probe reports the error before that checkpoint.

WPT: 3 additional passes in the script-element microtask tests; the other 492 cases retain identical statuses and subtest results. Update the corresponding passed/failed case lists.

Validation: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast (17,843 passed, 13 skipped). Fresh CLI build SHA-256 matches the binary used for the 495-case WPT comparison.
2026-11-20 22:47:36 +08:00
ldm0 e2e85488b4 fix(script): retain child parser state during script cleanup
Run classic script microtasks before restoring currentScript or releasing child parser nesting. Defer nested checkpoints to the outer script and wait for exception reporting before running reactions.

Cover inline and external scripts, syntax and runtime errors, document.open/write insertion points, and nested execution. Record the repaired synchronous-script bailout WPT.
2026-11-20 22:47:36 +08:00
ldm0 3b253e547d fix(document): ignore destructive writes during module execution
Track nested ignore-destructive-writes counters per Document across module evaluation and its cleanup checkpoint. Preserve explicit input streams, cross-realm Document identity, and writes from later tasks or pending top-level await continuations.

Validate root and child module behavior with five regression tests. The 149-case dynamic-markup WPT run gains four passes with unchanged remaining outcomes; update their recorded case status. cargo fmt, workspace all-feature clippy, and all 17835 nextest tests pass.
2026-11-20 22:47:36 +08:00
ldm0 ccd888df20 fix(document): reset child input-stream readiness 2026-11-20 22:47:36 +08:00
ldm0 2d7d807b60 fix(document): initialize child navigation readiness 2026-11-20 22:47:36 +08:00
ldm0 4e1f44aed9 fix(scripts): restore child parser insertion point on fetch errors 2026-11-20 22:47:36 +08:00
ldm0 28abec7c98 fix(scripts): queue parser preparation error events
Distinguish empty or invalid external script URLs from internal parser preparation failures. Queue trusted element errors on the shared DOM-manipulation source for root, document.write, and child parser paths without reporting spurious Window exceptions.

Retain exact Document ownership, listener checkpoints, and already-started state. Cover stale tasks and reused PageVm-local ids, and record the two WPT cases verified in CLI and CDP modes.
2026-11-20 22:47:36 +08:00
ldm0 3313a52bc2 fix(modules): bind synthetic text sources to their owning records
Resolve JSON and CSS evaluation data by exact module identity in the compiling realm, with weak context entries owned by compiled records. Remove the main-Document source lookup that broke child imports.

Cover static and deferred dynamic child imports, realm-local caches, parse errors, identity collisions and record disposal. Mark both JSON/CSS cross-origin WPT cases passing after CLI/CDP verification.
2026-11-20 22:47:35 +08:00
ldm0 02d8f96d48 test(modules): isolate malformed child parser JSON from valid imports
Extracted from wpt-misc-fix commit d313c717fba5f77b21a09930e4fc8dfc104298d6.
2026-11-18 22:04:42 +08:00
ldm0 68d6d03838 fix(network): preserve form Origin and apply post-formdata policy 2026-11-18 00:10:43 +08:00
ldm0 951880d512 fix(referrer): snapshot the creator policy for initial child Documents
Extract an independent, cohesive change from wpt-misc-fix.

Source-commit: 7bf4ce062b
2026-11-17 05:33:17 +08:00
ldm0 b3dd528d44 fix(performance): preserve Service Worker response timing metadata
Retain response type and timing authorization through Response materialization, clone, SW settlement, and direct Worker Fetch completion. Report delivered body bytes without a client network transfer, preserve forwarded CORS restrictions, and avoid re-filtering synthetic Default responses by their request URL.
2026-11-12 00:44:00 +08:00
ldm0 44386363ff test(document): reopen child streams after their initial load task
Run the existing child input-stream readiness regression after the initial load callback has returned. This exercises a fully loaded Document rather than an in-load document.open operation that resumes the current load.

Source-commit: 36456eeea3
2026-11-11 03:23:21 +08:00
ldm0 2d55f52956 test(stylesheets): cover shared redirect paths and late CSP
Extend redirect-sibling coverage to main documents, shared intermediate
sheets and a policy delivered between the alias and direct requests.
Verify complete independent CSSOM paths, cycle termination, cascade and
request counts with the existing collector implementation.
2026-11-09 13:08:51 +08:00
ldm0 1ef5279e3e test(stylesheets): cover redirected sibling import isolation
Exercise linked and inline child stylesheet graphs in both sibling source
orders. Verify independent CSSOM children, owner links, final cascade, and
separate no-store responses with request-driven synchronization.

Allow an alias redirect under a CSP path allowlist while rejecting the direct
sibling request to its destination. Assert its violation and empty imported
sheet so response aliasing cannot bypass request-specific admission.
2026-11-09 13:08:51 +08:00
ldm0 741956c289 fix(stylesheets): check child inline CSP before import admission
Use the stylesheet owner's Document policy for the shared inline check and run
it when child parser style contents are complete. Reject blocked owners before
registering import work or acquiring a load-delay token, keeping rejected CSS
out of both CSSOM and the cascade.

Queue child violations through the existing exact Window task target instead
of executing author code during parser admission. Reuse the same owner-aware
policy path for declarative CSS modules.

Cover missing, incorrect and accepted nonces, meta policy, report-only policy,
plain styles, child event attribution, and parser/frame-load completion.
2026-11-09 13:08:51 +08:00
ldm0 a9517f0fee fix(stylesheets): preserve request policy during import graph loading
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.
2026-11-09 13:08:51 +08:00
ldm0 e057516b42 fix(stylesheets): enforce child import policy and cycle identity
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.
2026-11-09 13:08:51 +08:00
ldm0 7b377340d9 fix(stylesheets): finish child linked import graphs before parser scripts 2026-11-09 13:08:51 +08:00
ldm0 a3d76e11a1 fix(modules): unify CSP admission and honor preload integrity 2026-11-06 02:23:36 +08:00
ldm0 742f80a396 refactor(csp): keep module redirect checks in request context 2026-11-06 00:36:55 +08:00
ldm0 6c1d13bba7 fix(csp): keep module redirect targets private 2026-11-06 00:36:55 +08:00
ldm0 f4850f3cd7 fix(modules): check CSP before each redirect request 2026-11-06 00:36:55 +08:00
ldm0 58f6e9643a fix(modules): enforce destination-specific CSP for synthetic modules 2026-11-06 00:36:55 +08:00
ldm0 a55f7ececc fix(cache): partition renderer resources by fetch destination 2026-11-05 14:32:38 +08:00
ldm0 86ede9afdb fix(stylesheets): reject child integrity failures before CSSOM
Reject integrity-failed parser stylesheet responses in child Documents before preparing or installing an owner CSSStyleSheet. Complete the failed load and release its blocker through the existing terminal path.

Add eight end-to-end URL iframe/srcdoc cases covering initial and cached integrity rejection, matching hashes, CSSOM and computed style, dependent import suppression, and parser/DCL/iframe-load progress.

The regression reproduced the empty-sheet bug at the previous PR head. Validation at 32 build jobs, test threads and Tokio workers: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast.
Summary [ 146.212s] 22163 tests run: 22163 passed (9 slow), 20 skipped
2026-11-03 07:16:23 +08:00
ldm0 d9290e87ad feat(modules): support native text module imports
Support type: text through the shared module map, Window, child Documents and workers. Export UTF-8 decoded strings without executing their contents, preserve typed-module identity, and carry text request metadata through network, preload and Service Worker loaders. Regressions cover static/dynamic import sharing, BOM and invalid UTF-8, CORS, integrity, worker environments and unsupported-type rejection.

Extracted from development commit a6de018613.
Base: main (62e527cd34).

Validation (32 build jobs and test threads): cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast.
     Summary [ 146.817s] 22203 tests run: 22203 passed (9 slow), 20 skipped
2026-11-03 06:30:06 +08:00
ldm0 59b0aa9754 fix(worker): send typed Fetch Metadata for worker main scripts
Set SameOrigin mode and native Worker/SharedWorker destinations on dedicated, nested and shared worker main-script requests. Retain CORS mode for module imports and honor nested worker script-kind credentials.

Validation (32 build jobs / test threads, zero retries):

- `cargo fmt --all`
- `cargo clippy --workspace --all-targets --all-features -- -D warnings`
- `cargo nextest run --no-fail-fast`: Summary [ 133.978s] 22032 tests run: 22032 passed (9 slow), 19 skipped
2026-10-31 21:23:14 +08:00
ldm0 3c826bd1e8 fix(referrer): use delivered Document policies for Fetch and XHR
Read effective policies from native Document delivery state and preserve them in Fetch and both XHR transport paths. Remove obsolete subtree rescanning and response-only owner lookups.

Validation (32 build jobs / test threads, zero retries):

- `cargo fmt --all`
- `cargo clippy --workspace --all-targets --all-features -- -D warnings`
- `cargo nextest run --no-fail-fast`: Summary [ 141.923s] 21998 tests run: 21998 passed (9 slow), 19 skipped
2026-10-31 18:55:48 +08:00
ldm0 a86afb442e test(document): cover child input-stream readiness 2026-10-21 06:11:29 +08:00
ldm0 59cca282f9 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
2026-10-18 01:54:47 +08:00
ldm0 46389039a0 fix(html): retain child parser EOF during script execution 2026-10-14 16:04:23 +08:00
ldm0 fdd0542c53 fix(modules): bind synthetic sources to their compiled records 2026-09-30 19:04:39 +08:00