Commit Graph
4336 Commits
Author SHA1 Message Date
ldm0 a8ed50e807 fix(dom): enforce original origins when opening document streams
Check the entry Document's original origin before document.open changes any
state, and apply the same check when write or writeln implicitly opens a stream.
Preserve inherited and retained origins, including DOMParser results and popup
Documents whose concrete realm belongs to the opener.

Cover relaxed domains, borrowed methods, exception realms, conversion order,
opaque origins, existing insertion points, and retained iframe/popup Documents.
2026-11-22 02:01:54 +08:00
ldm0 40952985c5 fix(parser): preserve insertion points in popup navigations 2026-11-22 02:01:54 +08:00
ldm0 2957fb507b fix(history): throttle excessive History API requests
Share a browsing-context budget across pushState, replaceState, go, back and
forward. Preserve argument conversion and mutation serialization/URL errors
before admission; refused calls do not cancel navigation or dispatch events.

Bound synchronous history update reentrancy across Windows and release the
admission guard on return. Retain child budgets across document navigation and
drop them when the browsing context is removed or closed. Cover recovery,
receiver ownership, conversion order, and recursive navigation callbacks.
2026-11-22 02:01:54 +08:00
ldm0 f5c8ec6a86 fix(navigation): reset focus within the navigating document
Rescan the owning Document for autofocus after intercepted navigation, with
focus-without-user-activation policy and native trusted initiation preserved
through transient activation expiry. Track focus changes per Document so a
parent focus change does not cancel a child navigation reset.

Keep viewport focus ownership explicit and retain the sequential Tab starting
point across manual focus resets and blur. Add regression coverage for policy,
autofocus selection, trusted input, Tab order, and nested viewport transitions.
2026-11-22 02:01:54 +08:00
ldm0 7f7691fcca fix(navigation): respect initiator origins across windows
Gate cross-document navigate events on the initiator and current target origin-domain while preserving cross-origin fragment events. Route named-frame window.open and GET form fragments through native Location navigation to preserve cancellation, interception, and document/history identity.
2026-11-22 02:01:54 +08:00
ldm0 8578ab23d1 fix(navigation): retain Navigation across initial Window reuse 2026-11-22 02:01:54 +08:00
ldm0 19baede9b7 fix(navigation): preserve hyperlink navigate events
Route existing hyperlink targets through native Window identity and the shared
navigation path. Preserve click involvement and sourceElement, suppress
cross-origin source exposure, and honor cancellation and interception in child
frames and named popups.

Retain popup referrer policy and synchronous fragment activation after the
navigate event accepts it. Add regression coverage for trusted and synthetic
clicks, ancestor targets, canceled navigation, interception, and popup policy.
2026-11-22 02:01:54 +08:00
ldm0 ca9bdb7f93 fix(navigation): respect document origins during history traversal
Preserve each history entry's document origin across renderer seeds, including
inherited about: origins. Only dispatch traverse events for same-origin target
documents, using their origin before fetching or redirecting the destination.

Keep event eligibility separate from the contiguous Navigation entry list.
Hide destination identity and state outside that list and avoid creating
pending event state for suppressed cross-origin classic-history traversals.

Add HTTP regressions for child frames, popups, cross-origin gaps and srcdoc
inside cross-origin parents.
2026-11-22 02:01:54 +08:00
ldm0 aa58490420 fix(forms): schedule cancellable planned navigations
Keep submit and formdata events synchronous while navigation runs as a
DOM-manipulation task. Capture the request, submitter, target and history
handling; coalesce replaced submissions without extra task turns.

Preserve popup POST requests, cross-origin and sandbox boundaries, and
javascript URL replacement ordering. Follow form navigation that starts
during document creation and cover reentrant, adopted and same-URL forms.

Validation: cargo fmt --all; workspace all-target/all-feature clippy with
warnings denied; cargo nextest run --no-fail-fast (20,002 passed, 16 skipped).
Two additional official WPT cases pass with no passing-case regressions
across the form and Navigation API suites.
2026-11-22 02:01:54 +08:00
ldm0 2c002cff92 fix(navigation): serialize reentrant history traversals 2026-11-22 02:01:53 +08:00
ldm0 d98c1fd31e fix(navigation): expose native NavigationDestination bindings 2026-11-22 02:01:53 +08:00
ldm0 abecad0fdd fix(navigation): create transitions in their Navigation realm
Joint history traversal can create a sibling window transition while executing in the initiating realm. Enter the owning Navigation context before allocating the transition and its committed and finished promises.

Extend the shared browser regression to verify realm and entry/destination identity across successful, rejected, and stopped traversals.
2026-11-22 02:01:53 +08:00
ldm0 697763caab fix(history): order joint traversal callbacks before popstate
Finish currententrychange and all interception handlers before script cleanup, then dispatch popstate in its owning realm. Preserve committed history events when stop() cancels Navigation settlement.

Cover first-frame, last-frame, and top-level initiators with successful, rejected, and stopped interception in a browser-shared regression fixture.
2026-11-22 02:01:53 +08:00
ldm0 3b7f109a3a fix(history): integrate joint traversal plans with document lifecycles 2026-11-22 02:01:53 +08:00
ldm0 8c24457b69 fix(fonts): validate FontFace descriptors with shared CSS parsing 2026-11-22 02:01:53 +08:00
ldm0 b14fedea41 fix(fonts): align FontFaceSet with native WebIDL bindings 2026-11-22 02:01:53 +08:00
ldm0 23a1aa867e fix(history): preserve queued and nested traversals with shared history
Keep JointSessionHistory as the history authority while retaining nested Document snapshots and exact traversal task owners. Coordinate all affected frames, preserve committed positions for queued deltas, and release traversal barriers on commit, cancellation, removal, or ignored responses. Republish browser history positions before a later renderer replacement.
2026-11-22 02:01:53 +08:00
ldm0 10fd38c4fa refactor(input): reuse shared editing primitives after rebase
Route clipboard and execCommand edits through the shared text-control input types and event construction. Verify native click preparation refreshes changed DOM/style geometry and reuses an unchanged snapshot.
2026-11-22 02:01:53 +08:00
ldm0 69e29d7276 fix(fetch): adapt request validation to typed errors
Carry typed WebIDL failures through body validation and handle network request preparation errors at the binding boundary. Align the cross-realm invalid-URL regression with Chromium and the upstream conversion path.
2026-11-22 02:01:53 +08:00
ldm0 24777a49e4 feat(fonts): support FontFace loading in workers 2026-11-22 02:01:53 +08:00
ldm0 1342e259ef fix(fonts): validate font set queries with Stylo 2026-11-22 02:01:53 +08:00
ldm0 7831a27a4c 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-22 02:01:53 +08:00
ldm0 c12c21178e 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-22 02:01:53 +08:00
ldm0 38d507f7f9 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-22 02:01:53 +08:00
ldm0 3599a5923c fix(preload): consume stylesheet preload responses 2026-11-22 02:01:53 +08:00
ldm0 d80575eace fix(preload): consume document-owned preload responses 2026-11-22 02:01:53 +08:00
ldm0 b802fcac67 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-22 02:01:53 +08:00
ldm0 a20b3d326b fix(performance): distinguish cached and validated resource transfers
Carry Fetch response cache state through buffered and streaming responses,
navigation, child-document snapshots, and paused response continuations.
Fresh disk and memory hits are local; an actual 304 merge is validated.
A later memory-cache read resets validated state to local.

Resource Timing now reports zero transferred bytes for local hits, 300 for
validation, and body size plus the fixed 300-byte overhead for network
responses. Real response-header lengths no longer affect transferSize.

Exercise real HTTP cache hits, conditional requests, response bodies and
header padding in top and child documents. Preserve the existing network
provenance of in-flight script waiters.

Validation: cargo fmt --all; full workspace/all-targets/all-features Clippy
with -D warnings; cargo nextest run --no-fail-fast (19872 passed, 13 skipped).
All Cargo runs used 32 build jobs and 32 test threads. The production binary
matches Chromium across 22 cache-timing observations; preload controls stay
at 23/24 with the existing pending-preload duplicate-download failure.
2026-11-22 02:01:53 +08:00
ldm0 3bd0128d56 fix(preload): honor CORS settings for ordinary preloads 2026-11-22 02:01:53 +08:00
ldm0 bd37bab3a7 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-22 02:01:53 +08:00
ldm0 eb8209b177 fix(preload): retain child document ownership for completions
Carry the originating Document through preload fetch completions and link
events. Create events in that Document's realm and record Resource Timing in
the request's Window instead of the parent. Keep historical network frame
identity when the Document is replaced, and retain the Window timeline across
document.open() without delivering retired link events.

Cover sibling frames, six preload destinations, cached stylesheet clients, and
gated completions across iframe navigation and document.open().

Retain resource timings that finish before the main world exists on the
native Window bootstrap, and publish them after its first main world is
registered.
2026-11-22 02:01:53 +08:00
ldm0 e1690ae788 fix(preload): keep ordinary preloads from delaying window load
Use identity-only connected-link admission for ordinary preloads, including
CSP failures, so they cannot hold the Document load gate. Keep stylesheet
consumer leases and modulepreload fetch routing independent of that shared
non-blocking lifecycle.

Cover parser and dynamic preloads for six destinations with gated successful
and failed responses, proving Window load precedes completion while late
link events and resource timing remain observable. Preserve load blocking
for real stylesheet consumers and rel transitions.

Record two newly passing preload WPTs and verify modulepreload and MIME/as
controls. The pre-existing duplicate-fetch consumer case remains unchanged.
2026-11-22 02:01:53 +08:00
ldm0 0d4a9de5a1 fix(preload): honor MIME hints and media conditions
Reject unsupported MIME hints and nonmatching media before loading ordinary
preloads. Parse MIME parameters, use the owning Document viewport, and
reprocess media changes. Keep CSS preloads in the typed stylesheet path so
rejected hints cannot fall through to generic requests and abort the renderer.

Validation: cargo fmt --all; full workspace/all-features clippy with -D warnings;
full nextest (19,858 passed, 13 skipped) with 32 build jobs and test threads.
Two newly passing WPT files cover 46 subtests; 15 related WPTs and 476 preload
admission scenarios pass, including parser, dynamic and emulated-media paths.
2026-11-22 02:01:53 +08:00
ldm0 6251aba128 fix(wpt): integrate branch changes with updated main APIs
Complete the rebase adaptation to byte-preserving response headers across
XHR decoding, module loading, CORS, opaque bodies, cache responses and their
fixtures. Convert native headers to WebIDL ByteStrings at JS boundaries.

Align navigation settlement with the current optional resolvers and remove
duplicate reflection helpers, declarations and tests introduced by replaying
overlapping changes from main. Preserve both main and branch regressions.

Validation: cargo fmt --all; full workspace/all-targets/all-features clippy
with warnings denied; cargo nextest run --no-fail-fast (19,850 passed,
13 skipped). Build and test parallelism: 32.
2026-11-22 02:01:53 +08:00
ldm0 662cea66c3 fix(window): preserve existing targets for empty open URLs
Keep an absent navigation URL through Window.open target selection. Reusing
a named iframe, popup, or special target must preserve the active document,
history state, and any pending navigation. Only a new browsing context
defaults to about:blank; explicit URLs still navigate normally.

Do not queue popup activation for an empty-URL reuse. Add regression tests
for loaded and pending named contexts, coercion to an empty URL, and child
scripts selecting _self, _parent, and _top.

Validation: cargo fmt --all; strict workspace Clippy; full nextest
(19,846 passed, 13 skipped), with 32 build jobs and 32 test threads.
Window.open defaults WPT now passes; no regression across the other
22 audited test pages or 10 popup control pages (95/95 subtests).
All 13 browser probes match Chromium.
2026-11-22 02:01:53 +08:00
ldm0 7d5c815aed fix(events): preserve popup callback Window ownership
Retain each listener's captured Window identity for every event so opener
and sibling callbacks keep their timers and exception-reporting realm when
a popup closes. Continue retiring work owned by the closing popup.

Create existing popup test handlers inside actual popup documents and wait
for their ready messages; assigning opener callbacks to a popup must not
change their owner. Add pagehide and exception-routing regressions.

Validation: cargo fmt --all; strict workspace Clippy; cargo nextest run
--no-fail-fast (19,842 passed, 13 skipped), all with 32 build/test jobs.
Ten targeted WPT pages pass all 95 subtests; browser probes match Chromium.
2026-11-22 02:01:53 +08:00
ldm0 cbc28848ac feat(window): expose branded BarProp objects and popup visibility
Expose six lazy, distinct BarProp objects per Window with native receiver validation and replaceable Window attributes. Derive visibility from the owning live Window and the existing popup feature parser, including nested frames and window retirement.

Validation: cargo fmt --all; strict workspace Clippy; all 19,839 nextest tests passed (13 skipped), with 32 build jobs and test threads. Chromium comparison probes match. Targeted official WPT: 90/91 subtests pass; the remaining auxiliary-window timeout reproduces a pre-existing opener timer retirement bug independently of BarProp.
2026-11-22 02:01:53 +08:00
ldm0 5411b5891e fix(dom): end initial blank Window reuse after document.open
Clear initial about:blank after the current document.open replacement finishes
its URL/history update. Preserve the initial state on failed preflight and when
an outer completion has been superseded by a reentrant replacement.

Track Navigation entry initialization separately from initial blank state in
child documents and popups. Reconnect exposed same-origin WindowProxies when a
replacement commits, keeping Inspector registration and document-start scripts
in the queued realm turn.

Cover stream opening, implicit writes, reentrancy, retained Window references,
and Navigation history state. Bind the old Navigator in the stale Beacon test
and advance earlier Page lifecycle tasks before BroadcastChannel delivery.

Validation: cargo fmt --all; strict workspace/all-target/all-feature clippy;
19,836 nextest tests passed, 13 skipped, at 32 build/test workers. The target
initial-blankness WPT now passes 2/2; related automated WPT pages have no
regressions. Chromium comparisons cover Navigation, getters and message channels.
2026-11-22 02:01:53 +08:00
ldm0 f5ccc84f38 fix(dom): initialize document modes and blank popup URLs
Reset child documents to no-quirks before opening a parser, while allowing
completed doctype tokens or EOF to select the subsequent document mode.

Create initial and navigated blank popup documents without a doctype, and
synchronize the committed Location before binding the replacement Document.
Cover chunked input, native no-quirks state, opener isolation, and blank
popup navigation.

Validation: cargo fmt --all; workspace all-target/all-feature Clippy with
-D warnings; 19,832 nextest tests passed, 13 skipped (32 jobs and threads).
Eight Chromium behavior probes match; 24 official WPT pages have no
regressions and three additional document.open subtests pass.
2026-11-22 02:01:53 +08:00
ldm0 361c55d856 fix(dom): abort child loads when opening a document stream
Cancel an ongoing child navigation before document.open replaces its stream,
and abort requests owned by that Document. Queue Fetch rejection and XHR
abort delivery in the preserved Window, while guarding reopened XHRs and
leaving ordinary document.open requests intact.

Retain the active-parser-aborted flag on the Document so later open/write
calls remain ineffective after navigation or window.stop aborts its parser.
New Documents created by cloneNode start with that flag cleared.
2026-11-22 02:01:53 +08:00
ldm0 efe2c4d8f6 fix(dom): parse popup document streams incrementally
Keep a live parser session for popup document.open/write/close, sharing
DOM mutation and element construction with the child-document parser.
Preserve split tokens, node identity and parser-script insertion order;
resume external scripts and drain deferred work before completion.

Cancel stale parser and lifecycle work when a stream is replaced, and
mark prepared scripts started before CSP filtering. Cover tree reset,
script scheduling, custom-element reentry and blocked-script adoption.
2026-11-22 02:01:53 +08:00
ldm0 ebc798861c fix(dom): erase popup event listeners when opening document streams
Clear the popup Document and its shadow-including tree through the shared
native callback retirement path before stream replacement mutates the DOM.
Clear only that popup Window's listener and handler state, including pending
content handlers, without calling page-defined accessors.

Cover borrowed methods, detached/template nodes, Window isolation, reentrant
dispatch, implicit write boundaries, conversion failures and content handlers.

Validation (32 build jobs / test threads): cargo fmt --all; workspace clippy
with all targets/features and -D warnings; full nextest (19,813 passed,
13 skipped); seven Chromium differential probes and four WPT pages.
2026-11-22 02:01:53 +08:00
ldm0 4b19df53a8 fix(dom): update popup document stream URLs from the entry document
Popup document.open and opener-initiated writes kept the popup's previous URL
instead of applying the entry document's URL/history update. Sync the native
Document, Window history, base URL and future request context while preserving
Document identity, history.state and the existing resource authority/origin.

Use implicit open for the first write regardless of which popup owns the
calling code. Publish native URL state before history callbacks and clear the
initial about:blank flag after the update. A queued close does not retire the
current Document until its close task runs.

Cover borrowed and implicit opens, source fragments, opener base isolation,
request context snapshots, reentrant history changes and queued closure.
2026-11-22 02:01:53 +08:00
ldm0 064a28fc7a fix(dom): route popup document streams through shared bindings
Popup Documents installed their own open/write/writeln/close methods, bypassing
Document receiver checks, XML preconditions, and Trusted Types conversion.
Borrowing Document.prototype methods could instead enter the main document's
replacement path and clear the opener.

Inherit the existing Document bindings and route operations by the receiver's
current popup owner. Select its Window policy even when the wrapper shares the
opener's V8 realm, and convert write arguments before mutating content.

Snapshot delivered meta CSP when window.open or a hyperlink creates a popup,
and seed inherited policies before importing its markup. This keeps receiver
policy checks independent of later opener changes without losing inherited
requirements or the popup's own meta policies.

Cover native receiver checks, XML receivers, borrowed methods, opener ownership,
Trusted Types isolation and inheritance, and load callback conversion ordering.
2026-11-22 02:01:53 +08:00
ldm0 6473a4a6c6 test(popup): cover body and frameset content handlers 2026-11-22 02:01:53 +08:00
ldm0 3fdbf5aa59 fix(popup): share body and frameset Window handler properties
Route body/frameset IDL attributes through their owning popup Window's existing handler values and ordered registrations. Include onmessageerror in the shared Window handler list and clear private handler state on document retirement without invoking author-replaced setters.

Cover shared values, listener replacement and cancellation, onerror arguments, adoption, windowless ownership, and document retirement.
2026-11-22 02:01:53 +08:00
ldm0 50c2ec4947 fix(popup): drive parsed document readiness and DOMContentLoaded
Keep network and javascript-URL popup documents loading while their classic
scripts run. Resume parser completion after the producing task's script
reactions, then dispatch DOMContentLoaded and load in separate DOM tasks.

Keep child-frame load blockers distinct from parser completion and validate
the concrete Window before each readiness/load continuation. Cover trusted
Document events, popup Window bubbling, script reactions, external-resource
gates, and close/replacement during lifecycle callbacks.
2026-11-22 02:01:53 +08:00
ldm0 f4d11c05e2 fix(popup): keep DOM event propagation in the owning Window 2026-11-22 02:01:53 +08:00
ldm0 98de5f13f3 fix(popup): dispatch native lifecycle events with Document targets
Construct popup load events through the intrinsic Event constructor and apply the legacy Document target override to load and pageshow. Keep dispatch paths and listener receivers on the popup Window.

Cover native interfaces, trust, cancellation, cleanup, redispatch, constructor overrides, retirement during load, and failed initial navigation without a materialized Document.
2026-11-22 02:01:53 +08:00
ldm0 67d5d9b7d8 test(protocol): await restored documents and focus events 2026-11-22 02:01:53 +08:00