Commit Graph
1656 Commits
Author SHA1 Message Date
ldm0 d4a6234ca0 perf(runtime): skip empty style mutation followups
Handle empty CSP input in a small inline entry and delegate nonempty
batches to a separate function. The mutation finisher only checks
whether the DOM changed before invoking CSP followups.

Skip processing empty stylesheet owner changes at the mutation finisher.
Continue applying pending stylesheet CSS projections and slotchange events.

A/B against the previous caller-side CSP guard on the resulting branch
(fixed local WeChat HTML; release; JS/CSS/subframes disabled; 200 balanced
randomized pairs) measured 142.39 -> 141.29 ms.
Paired saving: 0.34 ms; 95% bootstrap CI:
[-0.87, 1.57] ms. The confidence interval includes zero; no resolved performance gain.
All 400 measured Markdown outputs were identical.

Validation:
- cargo fmt --all
- cargo clippy --workspace --all-targets --all-features -- -D warnings
- cargo nextest run --no-fail-fast (19,490 passed, 16 skipped)
2026-10-07 03:28:07 +08:00
ldm0 62716f0997 perf(runtime): defer meta-refresh base URL lookup
Resolve the document base URL only after a mutation produces meta-refresh candidates. Ordinary text mutations avoid repeating the URL query and clone.

Validation:
- cargo fmt --all
- cargo clippy --workspace --all-targets --all-features -- -D warnings
- cargo nextest run --no-fail-fast (19,490 passed, 16 skipped)
2026-10-07 03:28:07 +08:00
ldm0 d540bf4a66 perf(dom): avoid allocation for single-owner mutation records
Collect unique owner documents in a SmallVec with inline capacity one.
The common parser mutation avoids heap allocation, and batches retain
each document's first-occurrence notification order.

Follow-up A/B against the previous Option + Vec implementation on the
resulting branch (fixed local WeChat HTML; release; JS/CSS/subframes
disabled; 200 balanced randomized pairs) measured 141.49 -> 142.85 ms.
The paired increase was 1.22 ms, with a 95% bootstrap CI of
[-0.14, 3.11] ms: no measured speedup from this refactor.

Validation:
- cargo fmt --all
- cargo clippy --workspace --all-targets --all-features -- -D warnings
- cargo nextest run --no-fail-fast (19,490 passed, 16 skipped)
2026-10-07 03:28:07 +08:00
ldm0 07276a671f perf(style): avoid allocating single-document mutation groups
Handle an ordinary single-node mutation inside the grouping function,
returning a SmallVec group that borrows the original effect slice. Keep
the entry small and inline, and use a batch helper for owned groups and
subtree splitting across documents. Iterate groups by reference.

The invalidation caller consumes one uniform grouping result; a single
node mutation avoids cloning effects and allocating grouping containers.

Record the isolated borrowing A/B conditions, timings, and confidence
intervals beside the single-effect fast path.

Validation of the resulting branch:
- cargo fmt --all
- cargo clippy --workspace --all-targets --all-features -- -D warnings
- cargo nextest run --no-fail-fast (19,490 passed, 16 skipped)
2026-10-07 03:28:07 +08:00
ldm0 3e3d4d3e5e perf(style): inline single effects during DOM mutation conversion
Return SmallVec<[StyleMutationEffect; 1]> from from_dom_mutation_effects.
Handle a pure single character-data update inside the converter before
constructing the deduplication set. Keep the notification call uniform;
batches preserve their existing order and deduplication.

Cover repeated text updates, :empty styles, and MutationObserver old values
in live and windowless documents.

Validation of the resulting branch:
- cargo fmt --all
- cargo clippy --workspace --all-targets --all-features -- -D warnings
- cargo nextest run --no-fail-fast (19,490 passed, 16 skipped)

Performance vs parent b75de5c66f (fixed local WeChat HTML, release,
JS/CSS/subframes disabled, 100 balanced randomized pairs):
Wall median 180.575 -> 165.316 ms (-8.45%). Paired median saving
13.885 ms; bootstrap 95% CI [12.364, 19.486] ms. The code tree matches
the previously validated and measured SmallVec version 84c5a81cca.
2026-10-07 03:28:07 +08:00
ldm0 ec74985139 fix(renderer): align tests with navigation and fetch APIs 2026-10-07 02:12:32 +08:00
ldm0 b8b03c0216 feat(cli): add --timeout-ms alias for fetch timeout 2026-10-07 01:52:52 +08:00
ldm0 5a836809ed fix(csp): convert violation event dictionaries and validate native getters 2026-10-07 00:46:14 +08:00
Maxim M f8d919d6f8 fix(renderer): keep loading when a document-start script throws
An uncaught exception in a main-world document-start script failed the
document commit. Page.navigate had already been answered, so the client
never received a load event.

Report the exception like a classic script exception and run the
remaining scripts. Internal errors still fail the commit.

Fixes #1084.
2026-10-07 00:30:08 +08:00
ldm0 cc2b49438f fix(fetch): expose null bodies for HEAD and bodyless statuses 2026-10-07 00:17:11 +08:00
ldm0 79e383340a feat(media): expose native time range snapshots 2026-10-07 00:01:09 +08:00
ldm0 08d17733fc fix(svg): reject nonfinite SVGNumber mutations 2026-10-06 23:59:35 +08:00
ldm0 cd2cbc8541 fix(renderer): trace response body handles on realm teardown
Pending Response body materializations and stored JavaScript rejection
reasons held strong V8 handles in the native context host. Navigation could
cancel the body fetch while leaving a resolver rooted, retaining the old
Context and its native Document through the shared isolate.

Move these handles into the owning realm's traced graph at teardown. Keep
buffered bytes and error identity available to externally retained Responses,
including pending body methods completed after the realm retires.

Add native host lifetime regressions for pending bodies and stored errors,
and verify retained body readers remain usable until their last V8 reference.

Validation: cargo fmt --all; strict workspace/all-target/all-feature Clippy;
cargo nextest run --no-fail-fast (19,650 passed, 16 skipped); release build.
CI-equivalent fixture contract is clean. At 144 real-site navigations,
post-blank GC leaves 1.76 MiB JS heap and two actual NativeContexts;
benchmark RSS ends at 177 MiB versus 706 MiB before the fixes.
2026-10-06 22:54:34 +08:00
ldm0 d954a1a5a4 test(renderer): gate the initial replacement reservation poll
The owner thread can finish reservation and prepare during the first poll,
making the cancellation test's initial Pending assertion timing dependent.
Gate reservation dispatch before polling, then release it before the existing
barrier and prepare gate. This reliably exercises cancellation of an in-flight
prepare while retaining the scope-release and isolate-reservation assertions.

Validation: cargo fmt --all; strict workspace/all-target/all-feature Clippy;
cargo nextest run --no-fail-fast (19,650 passed, 16 skipped); release build.
The exact cancellation test also passed 25 concurrent stress executions.
2026-10-06 22:54:34 +08:00
ldm0 d3b6633c33 fix(renderer): release module owners on context teardown
Document teardown used the document.open reset, which preserves compiled
module records and pending dynamic imports. Their strong V8 handles rooted
retired Contexts and native Documents across shared-isolate navigations.

Release module records, pending imports, graph fetches and owner events on
context teardown. Preserve import-map metadata so externally retained module
functions can still access native DOM values and import.meta.resolve aliases.
Leave document.open module-map semantics unchanged.

Add regressions for compiled modules, pending dynamic imports, and exported
functions retained across teardown. All three collection regressions fail
before the fix; retained functions remain usable until their last V8 reference
is released.

Validation: cargo fmt --all; cargo clippy --workspace --all-targets
--all-features -- -D warnings; cargo nextest run --no-fail-fast
(19,646 passed, 16 skipped). The initial run hit a 250ms CLI timeout
stage assertion; a full run with unchanged sources passed.

Release build with default Cargo parallelism. The CI real-site spider's
48-site peak RSS drops from 485.5 to 281.1 MiB, and last alive RSS drops
from 398.9 to 171.6 MiB. No forced GC was added to production navigation.
2026-10-06 22:54:34 +08:00
ldm0 31d40b20a6 fix(renderer): retire unpromoted child realm handles
Include prebootstrapped child contexts in document teardown and clear
superseded prebootstrap contexts before retiring their execution bindings.
These contexts can be exposed through contentWindow before promotion and
otherwise keep their native Document alive through intrinsic Global handles.

Cover collection after teardown and native DOM access while JavaScript still
retains the child realm. The collection regression fails without the fix.

Validation: cargo fmt --all; cargo clippy --workspace --all-targets
--all-features -- -D warnings; cargo nextest run --no-fail-fast
(19,643 passed, 16 skipped); release spider benchmark and heap snapshots.
2026-10-06 22:54:34 +08:00
ldm0 e6b8656643 fix(layout): resolve float inline bidi placeholders as neutral 2026-10-06 16:51:41 +08:00
ldm0 f8de77140b fix(layout): resolve out-of-flow inline bidi placeholders as neutral 2026-10-06 16:51:41 +08:00
ldm0 7fe5c0913e fix(layout): place inline decorations at physical bidi edges
Position transparent opening and closing edges around their visual descendants
after bidi reordering and before alignment. Keep the logical edge widths used
by line breaking while honoring CSS direction for physical padding and borders.

Move the inline-object bidi patch onto current upstream Parley main and pin
the fork at 8eb00ef5e628b1bba95dcde88658deb2a5aed1b5. Adapt the new font,
metrics, whitespace and layout APIs while preserving neutral atomic analysis.
Preserve the browser's synthetic-bold policy through Fontique's host threshold.

Use structural style ancestry for inline text masks so physical edge ordering
cannot change which glyphs belong to a background-clip:text target.

Add 96 Chromium-verified decoration cases covering natural RTL and mixed text,
CSS directions, asymmetric padding and borders, and layout publication. Add a
Chromium-verified paint test for ordinary and nested LTR/RTL text masks.
2026-10-06 16:51:41 +08:00
ldm0 d8e7c37723 fix(layout): resolve atomic inline bidi levels through Parley
Resolve inline objects independently so an atomic sibling outside a closed
RTL context follows the surrounding text instead of the preceding RTL run.
Pin the Parley 0.11.1 fork repair and its shared Fontique source.

Declare atomic and transparent boundary roles at the Moli adapter, keeping
opening edges with the next participant and closing edges with the previous
item. Add 336 Chromium-verified geometry cases across document modes,
contexts, directions, breaks and atomic placement, including publication.
2026-10-06 16:51:41 +08:00
ldm0 557d40e12d fix(svg): validate existing root factory receivers with native brands 2026-10-06 15:51:50 +08:00
ldm0 a2c0b604ea refactor(events): derive PointerEvent interface sequences
Replace PointerEventReference and the sequence member helper with a derived dictionary at the original conversion position. Retain the event-backing predicate and original object identity, and cover cross-realm inputs and failure stopping before later getters.

Validation on the combined tree: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast (19639 passed, 16 skipped; CARGO_BUILD_JOBS=1).
2026-10-06 13:35:34 +08:00
ldm0 62acafceee refactor(clipboard): derive collections and option dictionaries
Replace ClipboardItemReference and collection/options adapters with interface sequences, dictionary fields and a raw record field. Retain record projection, storage snapshots and Promise rejection behavior. Cover iterator failure identity and conversion stopping without modifying clipboard data.

Validation on the combined tree: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast (19639 passed, 16 skipped; CARGO_BUILD_JOBS=1).
2026-10-06 13:35:34 +08:00
ldm0 ad74744d51 refactor(abort): derive AbortSignal.any interface sequences
Replace SignalReference and its argument adapter with a required interface sequence field. Preserve iterable conversion before AbortSignal state processing and use the common interface TypeError context.

Validation on the combined tree: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast (19639 passed, 16 skipped; CARGO_BUILD_JOBS=1).
2026-10-06 13:35:34 +08:00
ldm0 e570980d19 refactor(fetch): derive Response.json initialization dictionary
Derive ResponseInit directly on ParsedResponseInit and use it for the Response.json argument. Remove the duplicate representation and adapter while retaining header conversion, status defaults and response construction order.

Validation on the combined tree: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast (19639 passed, 16 skipped; CARGO_BUILD_JOBS=1).
2026-10-06 13:35:34 +08:00
ldm0 09c5a25acb refactor(indexeddb): derive options and version-change dictionaries
Replace three dictionary argument adapters with dictionary field declarations. Preserve keyPath union conversion, member order and the subsequent IndexedDB option validation.

Validation on the combined tree: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast (19639 passed, 16 skipped; CARGO_BUILD_JOBS=1).
2026-10-06 13:35:34 +08:00
ldm0 d15274d1e4 refactor(streams): derive dictionary arguments in conversion stages
Derive strategy and codec/iterator options while retaining highWaterMark presence and operation-specific defaults in the stream algorithm. Convert and validate TransformStream writable strategy before its readable strategy, then read transformer members. Derive QueuingStrategyInit with required unrestricted highWaterMark and cover conversion/error order across realms.

Validation on the combined tree: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast (19639 passed, 16 skipped; CARGO_BUILD_JOBS=1).
2026-10-06 13:35:34 +08:00
ldm0 86ccaa5ee8 refactor(navigator): derive MediaCapabilities configuration fields
Derive required configuration arguments, nested audio/video/key-system dictionaries and session-type sequences. Preserve optional absence, validate required child members for null, and stop before later getters on child failures. Keep the three-state encryptionScheme converter and Promise rejection policy.

Validation on the combined tree: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast (19639 passed, 16 skipped; CARGO_BUILD_JOBS=1).
2026-10-06 13:35:34 +08:00
ldm0 66b76317b0 refactor(events): derive nested device and WebMCP dictionaries
Declare DeviceMotion vectors and WebMCP annotations as optional nested dictionaries. Missing/undefined remain absent; null creates a present dictionary with default members. Signal routing and lightweight popup validation remain in their existing converters.

Validation on the combined tree: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast (19639 passed, 16 skipped; CARGO_BUILD_JOBS=1).
2026-10-06 13:35:34 +08:00
ldm0 aecb1e9c2f refactor(webapi): derive common options dictionaries
Remove options-to-dictionary adapter hooks for TextDecoder, custom elements, QuotaExceededError, Worklet, Geolocation and ProgressEvent. Use dictionary member defaults, including the Geolocation timeout, and normalize conversion error contexts to the declaring API.

Validation on the combined tree: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast (19639 passed, 16 skipped; CARGO_BUILD_JOBS=1).
2026-10-06 13:35:34 +08:00
ldm0 5c56c0acfd feat(webidl): derive iterable sequences with element metadata
Add sequence fields for Vec and optional Vec, with inferred or explicit item converters and interface/brand_check metadata. Reuse the runtime iterator and preserve interleaved conversion, exception identity, nullability and object identity across realms.

Validation on the combined tree: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast (19639 passed, 16 skipped; CARGO_BUILD_JOBS=1).
2026-10-06 13:35:34 +08:00
ldm0 e00eb11b8e refactor(dom): derive XPath and observer input conversions
Replace fourteen custom conversion fields, plus the ResizeObserver options adapter, with derive declarations. Keep XPath tree resolution after resolver calls and retain existing-result object admission. ResizeObserver keeps its handle-resolvability predicate; custom TypeErrors use common WebIDL contexts.

Validation on the combined tree: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast (19639 passed, 16 skipped; CARGO_BUILD_JOBS=1).
2026-10-06 13:35:34 +08:00
ldm0 365a8db1f3 refactor(events): derive native members and URL base arguments
Replace nine custom field parsers with existing interface, raw and USVString conversion declarations. Retain required members, original objects and optional/null semantics; use the common WebIDL TypeError format.

Validation on the combined tree: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast (19639 passed, 16 skipped; CARGO_BUILD_JOBS=1).
2026-10-06 13:35:34 +08:00
ldm0 d131974596 feat(webidl): derive dictionary arguments and nested members
Add dictionary fields backed by WebIdlDictionary, including empty, optional and nullable conversions without requiring Rust Default. Preserve required-member checks, getter order, scope-dependent defaults and original exceptions.

Allow non-defaulted interface arguments to convert in field order without adding an arity gate, so existing XPath conversion timing can be preserved.

Validation on the combined tree: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast (19639 passed, 16 skipped; CARGO_BUILD_JOBS=1).
2026-10-06 13:35:34 +08:00
ldm0 82428463f2 refactor(forms): derive FormData constructor interface conversions
Validate HTMLFormElement and nullable HTMLElement arguments in the derived parser. Keep submit button and form ownership checks in the constructor and cover ignored valid submitters when the form is omitted.
2026-10-06 13:35:34 +08:00
ldm0 bfb457b280 refactor(events): derive legacy MouseEvent interface conversions
Replace WindowReference and EventTargetReference with interface field attributes. Retain the Window-specific native receiver predicate and nullable argument conversion order.
2026-10-06 13:35:34 +08:00
ldm0 761b39bc84 feat(webidl): derive native interface brand checks
Add interface and brand_check field attributes to argument and dictionary derives, including variadic object arguments. Preserve native object identity and validate brands at each field conversion position.

Cover nullability, conversion order, cross-realm errors, registered native proxies, and invalid attribute combinations.
2026-10-06 13:35:34 +08:00
ldm0 b9fc881f87 fix(webstorage): preserve StorageEvent WebIDL initialization 2026-10-06 03:11:26 +08:00
ldm0 706f22f3ec fix(forms): validate FormData native argument brands 2026-10-06 03:09:00 +08:00
ldm0 ca54aa017e fix(events): validate legacy MouseEvent initializer arguments 2026-10-06 03:04:21 +08:00
ldm0 45d89eacf9 fix(window): keep current events in private realm state 2026-10-06 02:38:13 +08:00
ldm0 29bb4dc91d feat(webidl): expose declared prototype attribute metadata 2026-10-06 01:48:34 +08:00
ldm0 e790a88a66 test(target): heap-allocate background navigation fixtures 2026-10-06 01:46:40 +08:00
ldm0 9128d88d15 test(xhr): assert the configured watchdog termination budget 2026-10-06 01:45:57 +08:00
ldm0 041846069a fix(core): preserve newer Page state when commands settle out of order
Stamp every successful Page VM state capture with its VM creation identity
and capture sequence, including nested captures. Reject older revisions at
the shared Page cache installation point while preserving each query reply.

A real same-document regression holds two DOM snapshots and consumes them in
reverse order. Both return their captured titles, while the cached title
must remain the newer value.
2026-10-06 01:01:03 +08:00
ldm0 91aec378a4 refactor(cdp): search resource content on the renderer owner
Native CDP replies can expose resources before the protocol adapter consumes
its Page snapshot. Resolve, decode, and search sources in one renderer command
instead of refreshing a snapshot and selecting cached content in the adapter.

Pass the immutable main response body by committed loader and preserve frame
matching, decoding, byte limits, and the attachment check before settlement.
Require a single renderer turn in the held-native-publication regression.
2026-10-06 01:01:03 +08:00
ldm0 70b4b1eb15 fix(cdp): refresh resource sources before searching
Native Page replies can reach the frontend before the adapter updates the cached resource report. Capture a current renderer snapshot before selecting root frame subresources and reject completions from replaced renderer attachments.

Add regressions for resource searches before native adapter settlement and for navigation before consuming a resource snapshot.
2026-10-06 01:01:03 +08:00
ldm0 24ef334500 fix(renderer): replace the Service Worker client on initial Document commit 2026-10-06 01:01:03 +08:00
ldm0 85332301b2 fix(renderer): disable subframe loading during document retirement 2026-10-06 01:01:03 +08:00
ldm0 fcadef16be fix(renderer): protect Document access and retained realm identity 2026-10-06 01:01:03 +08:00