Commit Graph
326 Commits
Author SHA1 Message Date
ldm0 48fc8c571f 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-02 06:03:23 +08:00
ldm0 a6de018613 feat(modules): support text module imports
Compile UTF-8 text into synthetic default exports across Window and Worker module graphs. Share typed module records with modulepreload and retain CORS, integrity, and text fetch destinations through Service Worker updates.
2026-11-02 06:03:23 +08:00
ldm0 91e1601d7e fix(dom): return null for inactive Document locations 2026-11-02 06:03:23 +08:00
ldm0 a806bb1823 fix(navigation): check beforeunload before browser fetches
Run browser-initiated main-document checks through the existing asynchronous
lifecycle scheduler before Fetch interception or network loading. Project the
source turn first, reject superseded navigation tokens, and share navigation
finalization so failed checks retain the committed document and release state.
Foreground DevTools callers remain pending through the check and load, preserving
typed navigation results and the captured target owner.

Keep beforeunload and commit unload commands out of nested non-V8 Page-agent
dispatch while the owner is debugger-paused. Cover real navigate/reload/history
responses, retained documents, pause/resume, supersession, and Fetch ordering.
2026-11-02 06:03:23 +08:00
ldm0 7da70478be fix(navigation): preserve inherited top-level about:blank state 2026-11-02 06:03:23 +08:00
ldm0 a7348b6274 fix(navigation): defer unload until document replacement 2026-11-02 06:03:23 +08:00
ldm0 3c9a9934d7 fix(storage): enforce popup Window getter access checks
Expose popup localStorage and sessionStorage through the existing Window
accessors so opaque documents cannot bypass storage-origin and receiver
validation. Preserve the private cached objects and expose enumerable
accessor descriptors.

Add HTTP integration coverage for CSP and inherited sandbox policies,
allow-popups-to-escape-sandbox, cross-origin access, borrowed and forged
receivers, cached Storage before navigation, and queued popup close.
2026-11-02 06:03:23 +08:00
ldm0 6a9d8f06e2 fix(location): report URL origins for sandboxed documents
Keep the existing document-origin access checks, then serialize the URL
origin independently of sandboxing. This fixes HTTP and Blob locations
in opaque child documents and popups.

Cover 15 HTTP and local-URL scenarios, including borrowed getters and
unchanged Window/message origins. Strengthen the sandboxed Blob OPFS
regression to distinguish URL, Window and message origins while retaining
all handle-clone and storage-denial assertions.
2026-11-02 06:03:23 +08:00
ldm0 c38dd589e8 fix(navigation): inherit document encoding from eligible containers
Capture the actual container Document's encoding and origin for child
navigation. Apply the same-origin and UTF-16 restrictions using the final
response URL and sandbox flags, including response CSP.

Decode local Blob and data navigations from response bytes. Keep popup
fallback independent of its opener and use UTF-8 for srcdoc snapshots.

Exercise nested frames, redirects, sandboxing, encoding precedence and
local URLs over real HTTP. Correct the existing MIME fixture's popup
fallback expectation while retaining all 64 iframe and popup cases.
2026-11-02 06:03:23 +08:00
ldm0 4244f47bb8 fix(navigation): align document MIME and charset extraction 2026-11-02 06:03:23 +08:00
ldm0 f8c2607c5e fix(runtime): reconcile WPT changes with native state on main
Restore native History cursors from sparse serialized positions, preserve
shared Window history across isolated realms, and keep entry identity and
structured state through document.open and cross-realm settlement.

Move event subclass and precommit state access onto shared native backing.
Respect published iframe layout snapshots and align history, rendering,
and rejection tests with their owning task boundaries. Remove duplicate
upstream tests and obsolete helpers from the main rebase.

Validation: cargo fmt --all; workspace/all-targets/all-features Clippy with
-D warnings; full Nextest (20,319 passed, 16 skipped); fresh CLI HTTP/CDP
fetch resource timing fixture (36/36). Build and tests used 32-way parallelism.
2026-11-02 06:02:26 +08:00
ldm0 782f556905 fix(performance): report Window fetch resource timing
Report registered Window fetches at body completion, failure, and cancellation
in the request client realm. Keep original URLs, native entry state, preload
suppression, and one terminal entry across clones and late completions.

Separate CORS-visible body metadata from TAO-protected timing and transfer
size, including redirect taint and quoted/repeated TAO header fields.

Validate 36 real HTTP scenarios and isolate preload fixture timing buffers.
Workspace fmt, all-target/all-feature Clippy, and 20,255 Nextest tests pass.
2026-11-02 06:02:26 +08:00
ldm0 8dcdded2d1 fix(observers): validate native element targets across documents
Resolve observer Element and root arguments through native interface brands and live or detached node identities. Preserve registered native proxies, entry identity, and WebIDL conversion order.

Schedule initial intersection notifications from the rendering document and cover adoption, explicit roots, invalid targets, and native proxy sampling with shared browser probes. Align the root-scope fixture with initial non-intersecting entries.
2026-11-02 06:02:26 +08:00
ldm0 f129ea9515 fix(observers): align notifications with document rendering
Run ResizeObserver after animation callbacks using depth-limited broadcasts
and freshly published layout, then apply focus fixup and sample intersections.
Deliver IntersectionObserver callbacks in a separate exact-Document task.

Preserve constructor order and active observer lifetime in the native registry;
validate Document and realm ownership across callbacks and bound reentrant work.
Sample padding, logical axes, inline boxes and device-pixel zoom from frozen
layout, including iframe geometry, and wake rendering after CSSOM changes.

Validation: fmt and workspace Clippy passed; Nextest 20,240 passed, 16 skipped.
Selected ResizeObserver WPT: 7 pages / 46 subtests passed. 153 original WPT pages
have no new failures; focus and navigation probes passed 31 and 152 cases.
2026-11-02 06:02:26 +08:00
ldm0 e5b395d6be fix(iframe): reject ancestor URLs during attribute navigation 2026-11-02 06:02:25 +08:00
ldm0 e7acb15230 fix(navigation): check child beforeunload before loading 2026-11-02 06:02:25 +08:00
ldm0 5548919cd7 fix(navigation): retain Navigation across initial Window reuse 2026-11-02 06:02:25 +08:00
ldm0 43ad12f21c 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-02 06:02:25 +08:00
ldm0 51a0e37f68 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-02 06:02:25 +08:00
ldm0 bdbc3f4f6e fix(fonts): validate font set queries with Stylo 2026-11-02 06:02:24 +08:00
ldm0 63947f8b08 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-02 06:02:24 +08:00
ldm0 38de86937e 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-02 06:02:24 +08:00
ldm0 4f5c5ed901 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-02 06:02:24 +08:00
ldm0 93a2b3335d fix(preload): consume stylesheet preload responses 2026-11-02 06:02:24 +08:00
ldm0 9ff41f73f4 fix(preload): consume document-owned preload responses 2026-11-02 06:02:24 +08:00
ldm0 d684caca58 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-02 06:02:24 +08:00
ldm0 200cb40866 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-02 06:02:24 +08:00
ldm0 cfaaf356be fix(preload): honor CORS settings for ordinary preloads 2026-11-02 06:02:24 +08:00
ldm0 c2ae644fb6 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-02 06:02:24 +08:00
ldm0 27ca491504 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().
2026-11-02 06:02:24 +08:00
ldm0 46ad3b6b93 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-02 06:02:24 +08:00
ldm0 ba890b1126 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-02 06:02:24 +08:00
ldm0 cd3f8b2189 fix(history): restore historical srcdoc documents
Retain srcdoc resources by history Document identity, including the original source, base URL, policy and origin. Restore each entry URL separately and apply the current iframe sandbox flags when reconstructing the Document.

Cover top-level and popup child traversal, classic and Navigation API state, and sandbox script/origin changes.
2026-11-02 06:02:23 +08:00
ldm0 5085d3fc02 fix(history): commit iframe attribute navigations consistently
Plan src and srcdoc push/replace operations from the committed document,
its load state, and the initiator origin. Publish local attribute commits
to joint session history without exposing pending entries synchronously.

Preserve same-origin srcdoc replacement keys and route live popup iframe
setAttribute calls through the shared src navigation path. Cover load
phases, coalesced srcdoc writes, fragment transitions, and popup ownership.

Keep initial attribute commits lazy when there is no joint history
mutation, preserving the scheduled child realm and lifecycle boundaries.
2026-11-02 06:02:23 +08:00
ldm0 958707a7af fix(history): restore top-level navigation snapshots
Carry committed renderer history through browser navigation requests and
restore structured state, entry identities, and activation before new
Document scripts execute. Read the latest committed source entries when
creating the destination so state updates made during a pending response
are retained.

Keep browser traversals aligned with native Document identities, rebuild
private history ordinals for restored top-level entries, and use native
entry indices for fragment mutations after a cross-origin history prefix.

Cover structured-state restoration, pending-navigation source updates,
fragment indices, browser-owned back/forward traversal, and same-Document
realm and element preservation after WebDriver history restoration.
2026-11-02 06:02:22 +08:00
ldm0 ae651523ca fix(navigation): bind entries and events to the active document
Bind Navigation objects to native Document identity and use the initial-empty lifecycle flag instead of the URL to disable entries. Preserve initialness through document.open(), and replace the Navigation object when javascript: creates a new Document without changing its URL.

Keep underlying History and Location navigation working when Navigation entries and events are disabled. Reject explicit pushes from initial documents and preserve the required pending promises. Cover initial, srcdoc, javascript, and subsequently loaded blank documents using a fixture also compared against Chrome.

Preserve fragment changes on a retained popup Document before its queued close task runs, while continuing to abort navigation when a navigate handler closes the window.
2026-11-02 06:02:22 +08:00
ldm0 36d74647f4 fix(navigation): stop recursive child document loads
Reject child navigations whose URL repeats more than one committed ancestor, ignoring fragments while preserving query and host boundaries. Keep about URLs, POST requests, and history traversals exempt.

Cancel rejected load bookkeeping before fetching so recursive frames remain at initial about:blank and ancestor loads can finish. Cover Navigation and Location with a real HTTP regression and URL admission boundary cases.

Give nested lifecycle fixtures distinct query parameters so their intended unload assertions are not suppressed by recursive-frame admission.
2026-11-02 06:02:22 +08:00
ldm0 1a3ff41dd0 fix(iframe): reload unchanged src during load callbacks
Repeated src assignments must schedule navigation even from the child Window
or iframe element load handler. The old early return left the WPT cross-origin
object test waiting forever on the final frame in its reload barrier. Remove
the load-dispatch tracking and URL helpers used only by that guard.

Cover property and setAttribute writes, same-origin and cross-origin owner
loads, and child Window loads. Check asynchronous navigation, fresh Documents,
stable WindowProxy identity, and loaded descendants across three reloads.

Validation: cargo fmt --all; strict workspace Clippy with all targets/features;
cargo nextest run --no-fail-fast. All 84 browser regression assertions pass in
Moli and Chromium. The unmodified cross-origin-objects.html completes all 90
subtests (69 pass, 21 fail); the same 21 failures reproduce on the old binary
when test reload calls are diagnostically deferred. Eight WPT control pages
retain exactly their baseline results.
2026-11-02 06:02:22 +08:00
ldm0 2710e17b9e fix(window): follow child target-name visibility
Select the first direct child with each target name before checking its
original origin against the receiving Window. Share this lookup between
same-origin and cross-origin named access, including live name changes and
navigation, without applying document.domain relaxation.

Allow named children to shadow non-exposed properties and the then fallback,
while keeping cross-origin IDL properties first. Use canonical array-index
parsing so names such as 01 and 4294967295 remain available by name.

Cover property descriptors, duplicate names, origin changes, renaming,
removal, and indexed WindowProxy identities. The named-access WPT now passes
all three subtests. An older frameElement WPT assumes that cross-origin
name-only lookup succeeds, contrary to this requirement; direct and indexed
frameElement security checks remain covered separately.
2026-11-02 06:02:22 +08:00
ldm0 85bbead9e0 fix(navigation): cancel stopped window subtrees
Resolve Window.stop() through the receiver's captured Window binding and
cancel intercepted fragment/reload navigations as well as descendant
frame navigations. Preserve cross-document traversal handling and guard
ancestor stops against reentrant abort listeners. Keep Window identity
valid across document.open() without targeting replacement LocalWindows.

Import the corrected upstream stop-before-commit WPT and cover receiver,
shadow-frame, history, promise, and callback reentrancy behavior.
2026-11-02 06:02:22 +08:00
ldm0 63e898f6dd fix(navigation): order precommit rejection promises
Reject the navigation API method's committed and finished promises before
firing navigateerror, then reject the transition promises. Apply this order
to pending precommit rejection and cancellation for navigate/reload and
history traversal, including microtasks enqueued by abort/error listeners.

Retain the traversal committed resolver across author callbacks while
deferring its rejection until the API method promises have been rejected.

Add both unmodified upstream precommit-rejection ordering variants and a
39-scenario protocol regression covering method and native navigations,
child/popup owners, rejection identity, cancellation, history, and downloads.
2026-11-02 06:02:22 +08:00
ldm0 80d593dc34 fix(navigation): preserve asynchronous precommit redirects
Keep precommit controllers usable until interception commits and read the
final redirect URL, history mode, and state after all precommit handlers
settle. Resolve redirects against the owning document base URL, including
popup documents, and expose the redirected navigation type on the event.

Route intercepted Location, anchor, and form navigations through the shared
pending precommit transaction. Reject controllers from retired windows and
prevent canceled work from committing even when the old event is edited.

Add two unmodified upstream redirect WPT variants and protocol regressions
covering async redirects, multiple handlers, cancellation, history parity,
download suppression, child windows, and popup retirement.
2026-11-02 06:02:22 +08:00
ldm0 71ec0a669d fix(navigation): complete intercepted download transitions
Run intercepted download links through the shared same-document navigation
lifecycle, including precommit handlers, redirects, cancellation, history
commits and transition settlement. Suppress the download once intercepted
and preserve the source element identity in child and popup windows.

Allow shared settlement without Navigation API method promises, resolve
transition.committed with undefined and finish fulfilled handlers in their
existing reaction so navigatesuccess precedes author microtasks.

Cover download interception and transition return values with protocol
regressions, plus four unmodified upstream WPT query variants.
2026-11-02 06:02:22 +08:00
ldm0 0c7d14fdf4 fix(navigation): track intercepted traversal transitions
Carry transition resolvers through pending traversal commits and settlement,
reusing precommit transitions and the shared navigation lifecycle. Keep
committed reactions after currententrychange and intercept handlers, and
finish empty handler lists asynchronously.

Preserve rejection reasons and transitions started by completion callbacks.
Add default protocol regressions and four unmodified upstream WPT variants.
Serve their .mjs helper through the compat fixture server.
2026-11-02 06:02:21 +08:00
ldm0 5d71ada385 fix(navigation): suppress fragment events for intercepted commits
Intercepted Navigation API pushes and replacements use URL/history updates.
Skip popstate and hashchange in their shared commit path, including deferred
precommit handlers and destinations that would otherwise change documents.

Import upstream precommit push, replace, reload, and traversal tests, and
cover event suppression, handler failures, state, and CDP history together.
2026-11-02 06:02:21 +08:00
ldm0 81c2982496 fix(history): commit popup fragments through shared navigation
Use the shared Location history and event pipeline for committed popup
Documents. Preserve the Document and Navigation API state, clear classic
history state, and bind new entries and events to the correct Window.

Synchronize popup Document URLs without touching the opener, stop when
navigation listeners close or replace the popup, and replace same-URL entries.
Keep initial empty popups' Navigation entries disabled and preserve their
native event delivery. Cover loading phases, cancellation, and repeated URLs.
2026-11-02 06:02:21 +08:00
ldm0 cc0dc0d273 fix(history): replace Location entries until popup load completes
Resolve Location's Document through the shared Window owner lookup and
include popup Documents in the native completely-loaded query. Mark them
complete after load callbacks finish, preserving document.open state and
checking the exact Document owner after reentrant replacement.

Consult the incumbent Window's native transient activation in addition
to the current protocol gesture scope. Cover parser/load navigation,
post-load navigation, document.open, window.open(_self), and input-driven
activation. Refresh the observed Location WPT case statuses.

The scripted_click_assign_during_load WPT now passes. Its assign() sibling
expects a separate push rule, but current HTML routes both APIs through
Location-object navigate; Chrome 145 also fails that older expectation.
Record both observed results in the case lists.
2026-11-02 06:02:21 +08:00
ldm0 6d6e396849 fix(runtime): stop navigation through inactive Location objects
Check the relevant Document lifetime after argument conversion and before
parsing or navigating. Inactive Location objects expose about:blank while
retained Documents keep their URLs. Track the actual Window owner so old
Locations cannot navigate a replacement iframe Window or document.

Cover removal, reinsertion, navigation, srcdoc, closed popups, conversion
side effects, and receiver validation. Update the retained child Window
expectation and record the no-browsing-context WPT pass.
2026-11-02 06:02:21 +08:00
ldm0 3266be1042 fix(dom): clear defaultView after browsing context destruction 2026-11-02 06:02:21 +08:00
ldm0 4d69d760bf fix(runtime): preserve retained child Window globals 2026-11-02 06:02:21 +08:00