Commit Graph
70 Commits
Author SHA1 Message Date
ldm0 3143575b7b fix(fetch): preserve resource integrity attribute whitespace
Carry script and stylesheet integrity strings verbatim into requests so
Service Worker FetchEvent consumers observe the original attribute value.
Keep SRI token parsing and validation separate from request metadata.

Cover parser capture and stylesheet physical-fetch identity, retaining the
existing absent/empty stylesheet request sharing behavior.
2026-11-20 22:48:01 +08:00
ldm0 bab758acd3 fix(scripts): retain async source network timing
Keep successful parser-async network results through parse-time tasks, EOF
fallback and late source completion. Publish ready scanner preloads through
the same owner task so each async fetch is recorded once.

Capture native response timestamps and body sizes at the source fetch, and
retain them independently of when script execution becomes eligible. Keep
attribution outside fetch reuse keys and apply existing CORS/TAO filtering.

Cover streaming parse-time execution, EOF completion, single-chunk parsing
and multiple async task turns with four API regressions.
2026-11-20 22:48:01 +08:00
ldm0 05a6cb741a fix(timing): retain DOM resource request initiators
Capture image, stylesheet, classic-script and iframe initiators when the
request is admitted, and retain them through deferred completion and src
reloads. Keep attribution separate from fetch option reuse keys and expose
it only for readable network responses.

Cover caller provenance, CORS/TAO boundaries, repeated element requests and
stylesheet fetch reuse with eight native regressions. Box owner task state
before constructing the async wrapper to avoid nested stack growth.
2026-11-20 22:48:01 +08:00
ldm0 823422d4ba fix(dom): initialize parser shadow registries incrementally
Carry newly created null and document-default registry associations through
parser handoffs instead of cloning every retained ShadowRoot after each parse.
Keep fragment, streaming, windowless and popup consumers on the same path.

Preserve the registry when attachShadow reuses a declarative root. Cover
stream notification ownership and cross-document default/null associations
with a fixture also exercised against native Chromium.
2026-11-20 22:47:58 +08:00
ldm0 37bdc19304 fix(dom): parse XML markup fragments with native namespace contexts
Share a strict XML fragment parser across Range.createContextualFragment,
innerHTML, outerHTML and insertAdjacentHTML. Carry native in-scope namespace
bindings without inherited DTD entities, preserve XML node kinds and UTF-16
TrustedHTML inputs, and keep parsed scripts inert after adoption.

Validate the complete fragment before replacing existing children and expose
syntax failures as DOMExceptions in the callee realm. Keep setHTMLUnsafe on
its HTML parser path. Cover native Proxies, ShadowRoot and template contexts,
cross-realm calls, mutation atomicity and malformed namespace declarations.
2026-11-20 22:47:56 +08:00
ldm0 cae4b29cb6 fix(events): preserve uncompiled handler source locations 2026-11-20 22:47:52 +08:00
ldm0 20582c569f fix(parser): preserve original script positions in CSP reports
Track opt-in original tag positions in html5ever, including UTF-16,
CRLF, character-reference rewinds and chunk boundaries. Carry completed
script start positions through the existing parser handoff and use them
for child Document CSP reports. Register synchronous document.write
handoffs before CSP so unknown provenance remains unknown.

Validation: full workspace fmt, clippy and nextest (22,156 passed,
16 skipped; 32 jobs/threads, no retries), plus 24 upstream/local
html5ever tokenizer and driver tests.
2026-11-20 22:47:52 +08:00
ldm0 501bc51933 fix(parser): preserve fragment context form submission state 2026-11-20 22:47:48 +08:00
ldm0 f652d4ac4a fix(dom): preserve native CharacterData UTF-16 values
Keep lossless CharacterData values in the native DOM so creation, edits, cloning, equality and mutation records use the same data. Preserve UTF-16 through document factories and text operations, and compare existing lossless element attribute values.
2026-11-20 22:47:45 +08:00
ldm0 dbeda626b9 fix(parser): adapt text document integration after rebase 2026-11-20 22:47:45 +08:00
ldm0 7ba52e5dab fix(scripts): honor document referrer policies for classic fetches
Capture the owning Document policy when preparing parser and runtime script
requests, separately from persistent script fetch options. Preserve the HTML
preload scanner snapshot and pass it to classic script and link preload fetches.

Admit child preload links at their parser token boundary and retain the policy
while waiting for realm creation, so a later meta cannot change an earlier
request. Keep explicit attributes and subsequent dynamic imports independent.

Cover main and child Documents, parser and runtime modes, same/cross origins,
header and meta defaults, invalid/explicit attributes, and delayed realm creation
with real HTTP regressions that also check request and execution counts.
2026-11-20 22:47:44 +08:00
ldm0 d993c27a02 fix(parser): adapt suspension paths to current ownership model
Reuse the claimed stylesheet pause in deferred preparation and use the shared source suspension cause for popup streams. Exercise document.write resume ownership with a body stylesheet boundary so nested inline execution cannot bypass the intended suspension.
2026-11-20 22:47:42 +08:00
ldm0 cabaff9f62 fix(preload): discover ordinary preloads in child parsers
Route preload links from parser discovery through their child Document and reserved realm. Start admitted work while the parser is active, and discard pending work on Document or realm replacement.

Apply the child policy container and nonce-aware destination checks after preload type/media admission. Cover parser-blocking discovery, child CSP, cancellation, admission matrices, and the upstream cached-stylesheet preload regression.
2026-11-20 22:47:41 +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 2b1f4d5aaa fix(dom): preserve windowless document parser streams 2026-11-20 22:47:39 +08:00
ldm0 e1d757c9a1 fix(parser): adapt WPT paths to shared parser state
Preserve owner interruptions during deferred script preparation and use the
current HTML stream and custom-element construction interfaces. Restore
body/window content-handler registration on the new child insertion path and
remove mutation adapters superseded by the shared parser lifecycle.

Validation: cargo fmt --all; strict all-feature workspace Clippy; cargo nextest
run --no-fail-fast (19,128 passed, 13 skipped). The nine child handler regressions
also pass in a focused run.
2026-11-20 22:47:38 +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 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 c64655dfc6 fix(script): mute cross-origin classic script errors 2026-11-20 22:47:35 +08:00
ldm0 f5a8a0695b fix(xml): expand internal subset entities in DOMParser 2026-11-20 22:47:34 +08:00
ldm0 88c18b8d7a fix(forms): block submission for unclosed controls 2026-11-20 22:47:34 +08:00
ldm0 08b1f82833 fix(html): preserve document scripting mode 2026-11-20 22:47:33 +08:00
ldm0 8f4b8b9bf9 fix(forms): synchronize selectedcontent clones 2026-11-20 22:47:32 +08:00
ldm0 d46a3b05a1 fix(parser): preserve strict XML tokenizer errors 2026-11-20 22:47:31 +08:00
ldm0 e0c3b0348d fix(dom): avoid allocating a Range fragment context node 2026-11-18 21:00:22 +08:00
ldm0 e3499ed8f5 fix(parser): batch tree-builder text before DOM mutations
Accumulate adjacent text at resolved insertion points and commit before parser observation boundaries. Preserve foster parenting and reentrant callbacks while batching native mutations for both MutationObserver and Inspector. Replace Inspector-only queue coalescing with regressions at the parser and renderer boundaries.
2026-11-17 04:45:08 +08:00
ldm0 3cc64d6278 refactor(parser): share HTML tree sink session initialization
Extracted from wpt-misc-fix a4d502c2d5cd.
2026-11-16 04:19:03 +08:00
ldm0 638ca7f686 refactor(parser): use shared fetch priority types 2026-11-15 14:41:50 +08:00
ldm0 7ca5ce7d4b refactor(types): group fetch and page types under moli-types 2026-11-15 14:41:50 +08:00
ldm0 18622bb9d7 refactor(parser): share UTF-8 input prefix splitting
HTML and streaming XML use identical owned-string chunk splitting. Share it inside the parser crate, keeping zero-budget handling, UTF-8 boundaries, the oversized first character case and optional remainder ownership.
2026-11-09 18:53:28 +08:00
ldm0 eac226d361 fix(stylesheets): evaluate parser media in the owning document 2026-11-03 07:53:58 +08:00
ldm0 7f08c25f08 fix(dom): preserve template document identity and adoption lifecycles
Share a lazy inert owner across each document's template contents and keep
HTML/XML semantics, interface identity, and template-owner state separate.
Cloning preserves interfaces while creating independent owner state.

Separate portable Document metadata from arena-local relationships. Use
one metadata-copy boundary for Document cloning and main-document
replacement, clearing template-owner and CSS-target handles while keeping
whole-DOM snapshots and copy-on-write storage relationships intact. Metadata
copies also discard base-element href/target caches while retaining about
base URLs and explicit overrides; only DOM node cloning freezes computed
base URLs. Detached Document URL readers use native metadata without JS
URL/documentURI/baseURI shadow state, including selector and bridge readers.

Apply the DOM-specific document cloning rules separately: freeze the source
computed base URL as an override, separately retain the inherited about
base URL, and rebuild base-element caches from the cloned tree. Preserve
main-document replacement metadata semantics.

Establish exact HTML template identity and associated fragment allocation
in one native entry shared by DOM and parser creation. Clone actual native
contents rather than guessing from names, preserving foreign and mixed-case
elements through serialization, deep cloning, import and adoption. Keep HTML
createElement normalization at its binding boundary; namespace-aware creation
and wrapper selection preserve the exact local name, including registry paths.

Plan per-node adoption targets across ordinary children, shadow roots and
template contents. Retarget custom-element registries and callbacks with
the actual destination documents, and clear cross-document shadow sheets
while retaining sheets within a document and its own template owner.
Avoid preparing unused inert style sources.

Cover cross-arena ID collisions, metadata preservation, snapshot isolation,
nested templates, deep adoption, iframe/detached documents, cloned
interfaces, retained sheet arrays, registry associations and URL behavior.
2026-10-29 02:54:08 +08:00
ldm0 c2b4631360 fix(domparser): stop recovering element trees after XML prologue errors
Extracted from wpt-misc-fix (1b15b0f68b).

Validation: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast (32 build jobs / test threads).
Summary [ 126.296s] 20925 tests run: 20925 passed (9 slow), 19 skipped
2026-10-28 02:12:31 +08:00
ldm0 ba803e7b90 fix(xml): report malformed attributes while preserving namespace parsing
Check strict lexical XML errors before xml5ever tree construction. Cover six malformed attribute/name forms both alone and in a valid XHTML prologue, plus distinct xml:lang/lang namespaces.

Validation: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast (20283 passed, 18 skipped). Release v3 and five browser regression rounds. Full WPT recorded separately.

Original-commit: 0232344406
2026-10-21 17:55:02 +08:00
ldm0 e78f5a33b2 feat(layout): update Taffy and Stylo forks with current Blitz adapters
Move Taffy to 0.15 and Stylo to 0.22 using fixed fork revisions, with the
matching stylo_taffy adapter. Upgrade cssparser and the production HTML/XML
parsers while preserving the vendored XML behavior.

Adapt sizing inputs, baselines, grid positions, overflow and out-of-flow
ownership. Preserve font-stretch CSSOM compatibility and intrinsic sizing
through nested atomic inline probes.

Validation: root cargo fmt --all; strict workspace/all-target/all-feature
Clippy; Nextest 20280 passed, 18 skipped; Release build; five browser
regression rounds; RTL and nested intrinsic Chromium geometry controls.
Full WPT Cross is recorded separately with its Cases refresh.

Original-commit: 281a920d89
2026-10-21 17:55:02 +08:00
ldm0 e3538c8999 fix(stylesheets): honor quirks mode MIME compatibility 2026-10-12 17:17:55 +08:00
ldm0 2c8f19277b fix(xml): validate numeric references using the XML Char production
Validate XML numeric character references using the XML Char production rather than HTML recovery rules. Keep carriage returns and C1/noncharacter values which XML permits, and reject forbidden controls/surrogates. Parser regressions cover decimal and hexadecimal references and retain strict failures.
2026-10-10 03:44:51 +08:00
ldm0 19667e531a perf(dom): better inline script performance 2026-10-05 20:48:11 +08:00
ldm0 7a8362581a test(parser): continue decoded input after meta charset 2026-10-04 00:37:48 +08:00
ldm0 6aeffcf522 test(css): cover completed parser style contents and CSP checks 2026-10-01 22:49:41 +08:00
lanyue-llk 345ba4cbc4 fix(document): share literal text parsing across child document paths 2026-09-29 18:01:12 +08:00
lanyue-llk 9d236a20ef fix(parser): preserve text document MIME and encoding semantics 2026-09-29 18:01:12 +08:00
ldm0 a9830ab24b fix(csp): reject nonnonceable script elements
Apply the shared script nonceability check to parser scripts, buffered preloads and runtime script preparation. Suspicious script attribute names and values must not authorize execution merely because a nonce matches. Includes parser, preload and dynamic-preparation regressions.

The attribute checks follow the [CSP3 nonceability algorithm](https://www.w3.org/TR/CSP3/#is-element-nonceable), including case-insensitive `<link`, `<script` and `<style` matches and parser duplicate attributes.

Validation: all branch checks passed. Summary [ 115.690s] 18925 tests run: 18925 passed (9 slow), 16 skipped
2026-09-29 16:27:50 +08:00
ldm0 b6156fadc1 fix(parser): route XHTML template children through template contents 2026-09-27 03:07:54 +08:00
ldm0 511c8a2341 refactor(parser): centralize element construction lifecycles
Separate parser provenance from active child construction. Share one
construction session across HTML/XML parsers and runtime adapters, with
completion ownership, normal-EOF checks, and cancellation that does not
publish incomplete styles.

Use ordinary creation for generated document shells and remove obsolete
per-element completion forwarding. Cover parser ownership, adoption,
duplicate completion, missing callbacks, and cancellation in tests.
2026-09-26 07:01:12 +08:00
ldm0 83e0afd1a1 fix(css): avoid reparsing incomplete inline styles
Process parser-created style sources after their closing tag or EOF, and
prepare later source changes through the stylesheet owner lifecycle.
Keep synchronization and CSSOM reads on prepared sources so CSSOM edits
survive reads and document initialization.

Complete styles in inert XML parsing and build the XML viewer through
ordinary DOM creation. Cover streaming, EOF, child documents, fragments,
and XML stylesheet behavior in regression tests.
2026-09-26 07:01:12 +08:00
ldm0 60b9a8523e test(parser): cover deferred mutation interruption boundaries
Document the deferred flag as an undelivered callback notification. Cover
one-shot interruption across text, character references, comments and input
chunks, plus EOF with an incomplete character reference.
2026-09-24 19:22:52 +08:00
lanyue-llk 9abac5771d fix(parser): preserve pauses across mutation callbacks 2026-09-24 19:22:52 +08:00
ldm0 36ae738e6f fix(parser): preserve stylesheet pauses across encoding notices 2026-09-23 22:34:09 +08:00
lanyue-llk bcf420f622 revert: undo split PR 640 merges (#734-#740) 2026-09-22 20:02:07 +08:00