Commit Graph
4625 Commits
Author SHA1 Message Date
ldm0 b829979fa4 fix(dom): run removal steps before ordinary insertion 2026-11-24 14:36:21 +08:00
ldm0 fb14197524 fix(dom): preserve ChildNode conversion and mutation order
Share native Node-or-DOMString and convert-nodes-into-node logic with
ParentNode. Convert arguments before the parentless check, preserve the
receiver among inputs, compute viable siblings before node movement,
and choose pre-insert or replace from the post-conversion tree.

Route native-backed detached methods through the same algorithms while
retaining their script ownership policy. Use the existing replace-child
pipeline instead of inserting then removing and coalescing the entire
observer queue. Preserve previous operations and source removals.

Keep empty replacement record boundaries and perform real self removal
and reinsertion so lifecycle, range and tree effects stay consistent.
Queue disconnection and connection for ordinary same-document moves,
including self insertion at the same position. Preserve atomic-move
connection state through the source profile, and correct parser/JS
comparison expectations against the Chromium lifecycle probe.

Cover six document surfaces and ordinary/borrowed Element,
CharacterData and DocumentType methods, failures, reentrant conversion,
UTF-16, viable siblings, fragments, record order and self reactions.

Validation: cargo fmt --all; strict workspace/all-targets/all-features
clippy; cargo nextest run --no-fail-fast (32 threads, CI retry profile).
Summary [ 129.338s] 20633 tests run: 20633 passed (9 slow), 16 skipped
2026-11-24 14:36:21 +08:00
ldm0 52fe4c7879 fix(dom): preserve ParentNode conversion and replacement records
Convert all Node-or-DOMString arguments before tree operations, preserving
native brands, conversion errors and UTF-16 code units. Keep a single
input node intact and build multi-input fragments sequentially, so failed
insertion exposes the required earlier removals. Reuse this path for
native-backed windowless ParentNode methods.

Validate against the post-conversion tree. Document.replaceChildren
excludes the existing children, following the current DOM algorithm.
Suppress intermediate replace-all target records at their source and
queue one final replacement record without coalescing prior operations
or argument-conversion removals. Preserve source/fragment removals and
reuse the existing tree, reaction and detached script policies.

Cover six document surfaces, ordinary/borrowed calls, failed conversion,
invalid input order, duplicates, doctypes, UTF-16, empty input, Range
boundaries and single/multiple-input observer record ordering.

Validation: cargo fmt --all; strict workspace/all-targets/all-features
clippy; cargo nextest run --no-fail-fast (32 threads, CI retry profile).
Summary [ 127.801s] 20632 tests run: 20632 passed (9 slow), 16 skipped
2026-11-24 14:36:21 +08:00
ldm0 5e46ccae53 fix(dom): validate Document pre-insertion before mutation
Use existing pre-insert validation before appendChild enters the native
mutation pipeline. Keep existing Document roots and doctypes in the
validation sequence for appendChild and insertBefore, including the
detached bridge, so rejected insertions have no removal/adoption effects.

Cover main, child, windowless HTML/XML and parsed documents through
ordinary and borrowed methods, invalid fragments and root reinsertion,
allowed comment/PI/empty-fragment insertion, unchanged live ranges,
MutationObserver records and custom-element reactions. Extend the prior
fragment regression to main/iframe Document validation.

Initialize affected legacy fixtures with a legal HTML document shell
and reuse existing roots in page fixtures. Preserve their feature
assertions while removing reliance on multiple Document elements.

Validation: cargo fmt --all; strict workspace/all-targets/all-features
clippy; cargo nextest run --no-fail-fast (32 threads, CI retry profile).
Summary [ 238.939s] 20631 tests run: 20631 passed (20 slow, 2 flaky), 16 skipped
2026-11-24 14:36:21 +08:00
ldm0 542f450315 fix(dom): preserve namespaced attribute UTF-16 values
Keep lone surrogates through setAttributeNS and SVG href writes, with
rare values keyed by namespace and local name. Preserve them through
native and windowless cloning, and refresh native receivers after value
conversion can adopt the element into another document.

Cover independent namespace values, cache cleanup, clone/import, href
fallback, reentrant conversion, native brands and allocation behavior.

Validation: cargo fmt --all; strict workspace/all-targets/all-features
clippy; cargo nextest run --no-fail-fast (32 threads, CI retry profile).
Summary [ 128.190s] 20618 tests run: 20618 passed (9 slow), 16 skipped
2026-11-24 14:36:21 +08:00
ldm0 8b6ce12819 feat(svg): expose native switch and mpath elements
Register native element interfaces and factories, and bind mpath href with concrete receiver checks and owner-realm animated strings. Resolve windowless native owners when reflecting inherited SVG string-list mutations.
2026-11-24 14:36:21 +08:00
ldm0 3611354a19 fix(css): reify generated images and image lists 2026-11-24 14:36:20 +08:00
ldm0 94449fa04d feat(css): reify native URL image values
Expose CSSImageValue in Window and Worker realms using native interface
brands and illegal constructors. Reify Stylo URL images from parse(),
declarations and computed styles, and permit typed cross-property writes
only when the target accepts a native image value.

Cover intrinsic allocation, cross-realm receivers, forged and proxy objects,
conversion bypass, atomic list writes, retained snapshots and Worker exposure.
Gradient/image-set projections keep their existing opaque value path.

Validation: cargo fmt --all; strict workspace/all-targets/all-features clippy;
cargo nextest run --no-fail-fast (20,607 passed, 16 skipped; one existing
child-document decoding test passed on its CI-configured second attempt).
2026-11-24 14:36:20 +08:00
ldm0 a9ce04ede8 test(fetch): drive the Blob MIME regression through page tasks
Run the upstream Request/Response Blob MIME cases in the existing Page task
executor harness so queued body completion tasks can settle their promises.
Replace the synchronous eval loop with the shared bounded task wait while
keeping every MIME, size and header-preservation assertion unchanged.

Order the new test module declaration with cargo fmt.

Validation: cargo fmt --all; strict workspace/all-targets/all-features clippy;
cargo nextest run --no-fail-fast (20,602 passed, 16 skipped, no retries).
2026-11-24 14:36:20 +08:00
ldm0 46173eae75 test(curl): tolerate an already closed TLS fixture socket
A client can consume a complete length-delimited or chunked response and
close before the fixture calls shutdown(Write). Treat NotConnected at
that teardown step as complete; keep all other socket errors and the
HTTP framing, invalid-record and certificate assertions unchanged.

The original fixture failed 3 of 128 runs at 32-way parallelism, with
backtraces pointing to the shutdown call. Validation includes the seven
TLS EOF cases, the repeated framing case, cargo fmt --all, strict
workspace Clippy and full cargo nextest run --no-fail-fast.

Final full suite: 20,599 passed, 16 skipped at 32-way parallelism.
The existing ci retry profile was selected, but no test needed a retry.
Earlier loaded-run timing failures are retained in the local evidence.
2026-11-24 14:36:20 +08:00
ldm0 62e7f0da20 fix(css): preserve typed numeric values in native declarations 2026-11-24 14:36:20 +08:00
ldm0 05c34c8e54 fix(css): reify all declarations as native keyword values
Project the native CSSWideKeyword for all into CSSKeywordValue while
preserving property-specific shorthand and unparsed-value behavior.
Cover parse/parseAll, declaration snapshots, realms, native-slot writes,
property-independent keyword reuse and invalid-write atomicity.
2026-11-24 14:36:20 +08:00
ldm0 29602231d9 fix(css): reify declared numeric calculations as native math values
Project validated declarations into native CSSMath objects, reusing the
bounded numeric parser to retain source doubles and operand order. Keep
scalar calculation wrappers at declaration time and use the native tree
for functions already simplified by Stylo.

Split original list components without CSSOM serialization so parseAll
retains numeric precision. Cover property grammar, range deferral,
computed values, intrinsic allocation, cross-realm objects, snapshots,
and CSSOM mutation across inline and rule style maps.
2026-11-24 14:36:20 +08:00
ldm0 add755b24d fix(css): normalize native percentage units in style maps
Compare Typed OM unit identifiers when validating numeric style writes.
Stylo projects percentages as percent while CSS text uses %, so comparing
against the text suffix rejected valid CSS.percent inputs. Share the
normalizer with declared and computed value reification.

Keep nonzero grammar probes, invalid-unit checks, and atomic writes intact.
Cover inline and rule declarations, foreign values, snapshots, native slots,
mutation records, and deferring negative percentages to computed-value time.

Validation: cargo fmt --all; workspace all-target/all-feature clippy with
-D warnings; cargo nextest run --no-fail-fast (20,575 passed, 16 skipped).
Original WPT: 93 pages, 1,883/2,131 to 1,922/2,131; no passing cases regressed.
2026-11-24 14:36:20 +08:00
ldm0 b8c4302252 feat(css): implement native Typed OM transform values
Expose transform lists and components in Window and Worker with native brands,
indexed access, operand validation, serialization, and DOMMatrix conversion.
Reify parsed, declared, and computed transforms from the style engine while
preserving component identities, dimensional flags, and owner realms.

Cover mutation, conversion ordering, matrix snapshots, cross-realm receivers,
style projection, and real worker execution. Validate the shared fixture in
Moli and Chromium over HTTP and HTTPS.

Validation: cargo fmt --all; workspace all-target/all-feature clippy with
-D warnings; cargo nextest run --no-fail-fast (20,573 passed, 16 skipped).
Transform WPT: 279/281; retain two documented math serialization mismatches.
2026-11-24 14:36:20 +08:00
ldm0 0a88e110d5 fix(css): reify native computed values in Typed OM 2026-11-24 14:36:20 +08:00
ldm0 e22518dc1e fix(navigation): reconcile paused lifecycle after main rebase
Run tree beforeunload from the existing Inspector scope so navigation can
start its request while the old script remains paused. Bind the active
Page per owner-task poll and preserve the beforeunload output prefix and
navigation fence without completing a suspended Runtime command.

Keep document-replacement termination pauses internal while preserving
real output and balancing pauses already reported to frontend sessions.
Keep intentional pagehide/unload callbacks debuggable during replacement.
Cover root/child lifecycle ordering, 204 recovery, resumable unload,
multiple sessions and cancellation between pause notification and loop entry.
2026-11-24 14:36:20 +08:00
ldm0 b63e071e50 feat(css): parse numeric values and basic math expressions
Add Window-only CSSNumericValue.parse with native Typed OM objects, f64
token recovery, type checking, and bounded calc/min/max/clamp algebra.
Preserve WebIDL conversion and callee realms, and support the x resolution
unit alias. Cover grammar, simplification, precision, realms, and limits.
2026-11-24 14:36:20 +08:00
ldm0 2f3dd1bc2a feat(css): implement native numeric value operations
Add CSSNumericValue arithmetic, structural equality, and unit conversion
using native math operands, f64 values, and generated receiver checks.
Preserve WebIDL conversion order and mutable leaf reads, allocate results
in the receiver realm, and throw errors in the callee realm.

Traverse shared graphs iteratively with bounded conversion expansion.
Cover forged/proxy receivers, cross-realm results, overwritten public
properties, precision, special values, and deep/shared expression graphs.
2026-11-24 14:36:20 +08:00
ldm0 10303abfbb fix: adapt WPT changes to upstream module splits
Keep the rebased element bindings, service worker API and navigation tests
working with the new module boundaries. Export shared callbacks at their
required scope and resolve navigation fixture paths from the split files.

Preserve all 1,402 Rust definitions and 172 Python methods from the
pre-rebase sources; retain the upstream test and implementation layout.
2026-11-24 14:36:20 +08:00
ldm0 0f428d7ffe feat(css): add native CSS math value objects
Expose CSSMathValue, its seven concrete subclasses and CSSNumericArray in
Window and Worker realms. Preserve native operand identity and validate
numeric types after WebIDL argument conversion, including percent hints.

Add CSSNumericValue.type(), read-only indexed operands and native-slot
serialization with checked exponent arithmetic and iterative graph traversal.
CSSOM math reification and numeric arithmetic remain follow-up work.

Validation: cargo fmt --all; workspace clippy with all targets/features and
-D warnings; cargo nextest run --no-fail-fast. Original numeric WPT: 161/161;
StylePropertyMap: 175/175; Typed OM IDL: 194/544 to 262/544.
2026-11-24 14:36:20 +08:00
ldm0 6af7a4f506 feat(css): expose native mutable style property maps
Back attributeStyleMap and CSSStyleRule.styleMap with their existing native
CSS declarations, including detached compatibility wrappers. Validate typed
inputs before mutation and preserve WebIDL conversion ordering, receiver
brands, owner realms, declaration notifications and iterator snapshots.

Share native value serialization and escape CSSKeywordValue identifiers.
Explicitly reject unsupported arbitrary/empty unparsed declaration storage
without altering the existing declaration; native CSSMath/transform/image
interfaces remain separate follow-ups.
2026-11-24 14:36:20 +08:00
ldm0 bb8c1e392a feat(css): expose native Typed OM numeric factories 2026-11-24 14:36:20 +08:00
ldm0 bc0262c634 fix(css): preserve Typed OM numeric serialization semantics 2026-11-24 14:36:20 +08:00
ldm0 6d13f1dfb1 feat(css): parse native Typed OM style values 2026-11-24 14:36:20 +08:00
ldm0 06c4cc7050 feat(css): add native unparsed Typed OM values 2026-11-24 14:36:20 +08:00
ldm0 abf6310892 feat(svg): expose remaining filter primitive interfaces 2026-11-24 14:36:20 +08:00
ldm0 91985cbb30 fix(svg): synchronize retained animated attribute values 2026-11-24 14:36:20 +08:00
ldm0 4b5da3e5f5 fix(dom): preserve UTF-16 attribute values 2026-11-24 14:36:20 +08:00
ldm0 f4aff4da4c fix(events): expose selection and gamepad handlers
Use the shared handler bindings for Window, DOM elements and body/frameset forwarding. Preserve MathMLElement identity in windowless documents so their global event handlers stay available.
2026-11-24 14:36:20 +08:00
ldm0 4868151f3e fix(build): deduplicate declarations after main rebase
Main and the WPT branch independently introduced the MathML namespace
constant and three identical regression tests. Retain one copy of each
so the rebased test modules compile without duplicate definitions.

The removed test bodies were compared byte for byte against the retained
copies. Preserve the additional upstream tests for Selection, SVGPoint,
and directionality.
2026-11-24 14:36:20 +08:00
ldm0 e640a2d0b9 fix(worker): inherit local script referrer policies
Resolve local worker policy from the Blob URL creator environment, including
meta updates delivered before startup. Keep existing worker snapshots and
SharedWorker reuse stable, and carry the policy through worker-created URLs.
Preserve parent request and child response policy for nested HTTP workers.

Validate with the complete fmt, clippy, and nextest gates (20,458 passed),
73 original WPT files (665 -> 667 passed, zero regressions), and 226 network
comparisons covering worker types, ownership, policy timing, and overrides.
2026-11-24 14:36:20 +08:00
ldm0 38433bd2cc fix(css): preserve referrer state across stylesheet imports 2026-11-24 14:36:20 +08:00
ldm0 76055d42cb fix(css): snapshot document referrer policy for stylesheet requests
Capture the owning Document policy at stylesheet resource admission and
include it in the shared resource key, while preserving existing owner
bindings. Carry parser/preload snapshots and child Document policies into
the native request.

Test policy changes, shared URLs, parent/child isolation and parser-created
stylesheets through the controlling service worker. The shared browser
fixture performs 55 comparisons and also passes in Chromium.
2026-11-24 14:36:20 +08:00
ldm0 b9065e5827 fix(fetch): resolve client referrers before dispatch
Select the live Document URL, following srcdoc containers and rejecting opaque
client origins, before applying the effective referrer policy. Resolve these
values before both service-worker interception and native network dispatch,
without changing the public Request or the origin and cookie initiator.

Use HTML's about:srcdoc URL match so javascript replacements remain srcdoc
Documents. Preserve the replaced Document's current delivered policies,
including removed meta elements, instead of reverting to response-only state.

Cover network headers across two origins, author base URLs, history changes,
about:blank boundaries, javascript replacements, opaque srcdoc Documents, and
service-worker request metadata.

Keep Fetch resource classification when attaching policy metadata, and isolate
memory-cache entries by their resolved Referer so policy changes cannot reuse
a response selected for a different referrer.
2026-11-24 14:36:20 +08:00
ldm0 5da046670c fix(fetch): separate Request base URLs from settings origins
Validate RequestInit.referrer against the origin retained by its actual realm,
including retired child realms and popup aliases. An inherited or authored
base URL must not authorize a foreign referrer or discard a same-origin one.

Resolve main-document relative Request URLs against the live document base.
Cover same-origin, foreign, relative, empty, and client referrers in main and
child realms, plus retained constructors after iframe removal.
2026-11-24 14:36:20 +08:00
ldm0 848981a686 fix(referrer): snapshot creator policy for local documents
Capture the creator Document's current effective referrer policy when cloning
its policy container. Initial empty child documents now resolve their actual
owner, including popup parents, and reuse the shared inheritance path.

Preserve the original navigation policy when recording about-document history
state. Test creation snapshots, later parent and child mutations, removed meta
elements, grandchildren, and explicit Fetch overrides across both origins.
2026-11-24 14:36:20 +08:00
ldm0 093fa4fad0 fix(referrer): persist meta policy on each document
Apply meta referrer delivery on insertion and attribute changes, preserve it across removal and document.open(), and share the state with Fetch, XHR, and existing script consumers. Cover temporal ordering, namespaces, windowless documents, cloning, and main/child/popup network owners.
2026-11-24 14:36:20 +08:00
ldm0 4693806b16 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-24 14:36:20 +08:00
ldm0 57aad5a1c4 fix(runtime): pin owner task futures before executor handoff
Larger script preparation state exposed a stack overflow while a child message
handler created an external worker. LLDB stopped in spawn_local while reserving
another large copy of the owner task future on the caller stack.

Pin the payload before wrapping it in executor/TLS and spawn futures so nested
owner turns carry a pointer instead of duplicating the task state.
2026-11-24 14:36:20 +08:00
ldm0 6bf2da082b fix(fetch): accept close-delimited HTTPS responses
Enable the opt-in curl TLS EOF behavior from a8c770e while retaining
certificate verification, TLS record errors and HTTP framing checks.
The fork also rejects incomplete HTTPS response headers so accepting
transport EOF does not expose truncated header sections as responses.

Cover real TLS connections with and without close_notify, HTTP/1.0 and
HTTP/1.1, complete and truncated Content-Length/chunked/HTTP2 responses,
empty and informational responses, partial headers, invalid TLS records,
and untrusted certificates. Timeouts are always test failures.

Original modulepreload referrer WPT improves from 9/16 to 16/16. The eight
generated dynamic-import referrer files that stopped at HTTPS fetches now
complete at 94/94, matching Chromium, and module regressions remain 44/44.
2026-11-24 14:36:20 +08:00
ldm0 4314e7582b fix(modules): preserve document policy for module preloads
Capture the exact Document's default referrer policy when preparing a
modulepreload request, separately from the module's persistent script options.
Carry it through single-module fetch reservations into the actual network
request, including main and child parser and connected-link paths.

Seed the HTML preload scanner with the response policy and snapshot meta
policies in token order for parser modules and modulepreload links. Seed
insertion scans with the live policy without scanning an idle Document.
Admit child links at FinishParsingChildren so a later meta in the same parser
batch cannot overwrite an earlier request's policy or duplicate link terminals.

Cover same/cross-origin requests, response and meta defaults, explicit and
invalid attributes, late meta tags, module-map reuse, and dynamic imports
from preloaded modules after a policy change with real HTTP regressions.
2026-11-24 14:36:20 +08:00
ldm0 e5488609be fix(modules): apply document referrer policies to module graph fetches
Capture the exact Document's current referrer policy for each module fetch,
separately from compiled script options. Preserve explicit script and response
policies while allowing later imports with an empty policy to observe meta
policy changes. Resolve child policies through their Document and realm owner.

Carry the prepared module request through the main runtime root's Service
Worker path and its network fallback instead of rebuilding it without the
Document policy. Apply the same fallback to child parser roots.

Add real HTTP regression coverage for main and child documents, root and
static imports, saved classic/module import functions, string timers, explicit
and invalid policies, response policy overrides, and dynamic meta updates.
2026-11-24 14:36:20 +08:00
ldm0 65b71beb6d fix(modules): preserve dynamic import referrers and policies
Retain script referrer policy in V8 host-defined options, including imports
from saved functions and string timers. Carry the importing script's URL
through the module tree's existing referrer field into Fetch independently
of the document origin and cookie initiator. Keep the client referrer for
imports without referring script metadata.

Add real HTTP coverage for main and child documents, classic and module
scripts, inline and external sources, element mutation, response policies,
and direct and timer imports. Verify that an explicit script referrer does
not replace the document's origin or cookie context.
2026-11-24 14:36:20 +08:00
ldm0 76c007d85c fix(scripts): preserve dynamic import credentials from initiating scripts
Carry preparation-time fetch metadata through classic script execution and
child external-script ready tasks. Encode normalized credentials in V8
script origins so saved import functions retain their initiating script's
credentials after element mutation or removal.

Inherit credentials and nonce in string timers while clearing parser
metadata and keeping the root script's integrity out of dependency fetches.
Cover main and child documents, inline and external classic/module scripts,
credential defaults, same/cross-origin requests, and timer imports.
2026-11-24 14:36:20 +08:00
ldm0 3c00a0543b fix(modules): reuse compiled records for child script roots
Deliver compiled child root completions without requiring discarded
JavaScript source. Reuse the realm's existing record when each script
consumer advances, retaining its namespace, fetch metadata, response base
URL, and pending or rejected evaluation.

Cover preload, parser, runtime, and import consumers with real HTTP tests,
including redirect request keys, separate realms, per-element load events,
and top-level-await fulfillment and rejection identity.
2026-11-24 14:36:20 +08:00
ldm0 188b71f421 fix(modules): reuse module maps for runtime script roots
Consult the module map before fetching runtime module script roots while
preserving script-element Service Worker filtering and integrity checks.
Keep shared fetches alive across document.open so imports in the retained
realm settle without reviving retired script elements or their events.
2026-11-24 14:36:20 +08:00
ldm0 6a0abe7f2e fix(build): adapt local runtime changes to upstream module split
Preserve the former visibility of ScriptVm methods after their implementations
move into submodules, and qualify navigation types outside their old import
scope. Retain the upstream module layout and the existing runtime behavior.

Validation: cargo fmt --all; workspace Clippy with all targets/features and
-D warnings; full nextest, 20,404 passed and 16 skipped.
2026-11-24 14:36:20 +08:00
ldm0 d42b93df4e fix(preload): start runtime modulepreloads in their document
Start connected main-document modulepreloads during mutation commit using the
same module-map reservation and scheduling path as parser preloads. Route child
links through the existing Document/realm-owned modulepreload queue instead of
leaving their start requests in the main lifecycle accumulator.

Cover post-load JavaScript/JSON/CSS/text preloads, import reuse, asynchronous
load/error delivery, CORS and integrity failures, per-Window module maps, and
queued child starts retired by document.open.
2026-11-24 14:36:20 +08:00
ldm0 d664c82665 test(dom): cover inactive Document locations 2026-11-24 14:36:20 +08:00