Commit Graph
3366 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 2ae4bc7c66 fix(navigation): protect unload targets during descendant checks
Keep the navigation target protected from document.open/write/writeln while iframe and popup descendant beforeunload handlers run. Acquire the target counter after its reentry check so its own event still dispatches.

Cover target writes, guard release after the check, and writable intermediate documents with behavioral regressions.
2026-11-02 06:03:23 +08:00
ldm0 45288c689b fix(navigation): check renderer history traversals before fetching 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 4d4811fb8e fix(navigation): check the main document tree before navigating
Dispatch beforeunload across the source document tree before renderer navigation requests. Keep the source Location visible until commit and protect the navigation target from destructive writes in descendant callbacks. Cover lifecycle ordering, navigation reentry, removed descendants, source URL preservation and history policy snapshots.
2026-11-02 06:03:23 +08:00
ldm0 ebe3b587cc fix(navigation): preserve history referrer policies at commit 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 f23de0918b style(tests): format regressions after module split 2026-11-02 06:03:23 +08:00
ldm0 469bcf9455 fix(navigation): classify same-document navigation by URL fragments
Keep repeated fragment navigation within its Document for every history mode, including iframe and popup calls. Classify URLs without a fragment as cross-document before dispatching navigate, while preserving interception and cancellation.
2026-11-02 06:03:23 +08:00
ldm0 86426e85c4 fix(navigation): honor sandboxed document origins
Disable Navigation API entries and tracking for top-level CSP sandbox origins while preserving actual fragment and cross-document navigation. Keep repeated fragment navigation in the same Document and honor explicit history behavior.
2026-11-02 06:03:23 +08:00
ldm0 57e8e4de3f fix(navigation): preserve iframe documents on src fragment updates
Route native iframe attribute writes through shared same-document navigation. Preserve initial-document history replacement and pending document loads, and cover namespace and Attr mutations plus canceled navigation.
2026-11-02 06:03:23 +08:00
ldm0 1383749392 fix(dom): retain inherited base URLs across history updates 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 f62a0989c0 fix(cdp): deliver current renderer notifications during navigation 2026-11-02 06:03:23 +08:00
ldm0 507d0b57f8 fix(navigation): preserve documents on HTTP 204 and 205 responses 2026-11-02 06:03:23 +08:00
ldm0 e0d057aef4 fix(dom): expose cross-origin frames named by their container
Select the first child matching the target name, then expose it when it is
same-origin with its owner or the iframe name attribute publishes that name.
Keep child-authored names private and preserve WindowProxy DOM access checks.

Cover main, child and popup owners, renames, authorization changes, duplicate
ordering and removal. Preserve the existing named/indexed identity checks.

This follows Chromium's container-name behavior discussed in
https://github.com/whatwg/html/issues/12663. The two upstream same-origin-only
expectations remain documented compatibility differences.

Validation: cargo fmt --all; workspace clippy with all targets/features and
-D warnings; nextest 20,344 passed, 16 skipped. Normal CLI/CDP each improve
document_domain_access_details from 2/12 to 12/12; the 96-check container-name
matrix passes. All 18 upstream files remain in the comparison (67/81 subtests).
2026-11-02 06:03:23 +08:00
ldm0 a2e6f34378 fix(dom): preserve trailing dots in document.domain
Keep trailing dots from URL host parsing and document.domain assignments so dotted and undotted domains remain distinct. Cover main, inherited, nested, and popup documents, along with encoded dots and public-suffix boundaries.
2026-11-02 06:03:23 +08:00
ldm0 83e828a0d4 test(wpt): use registrable hostnames for loopback fixtures
Run both benchmark entrypoints on web-platform.localhost so the main host
is distinct from its public suffix. Resolve all named-host templates from
the configured primary host, preserving stable origins on subdomain
requests and keeping the alternate namespace separate.

Cover the server URL, hostname aliases, headers and both entrypoint
constructor calls. All 756 Python tests pass in the verified candidate;
the applied sources are byte-identical. The real Moli CLI and CDP
entrypoints each pass all 48 subtests across 13 original origin WPTs.
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 76a4bae9c9 fix(fetch): queue Body completion on receiver fetch tasks 2026-11-02 06:03:23 +08:00
ldm0 c30c6f0aed test: adapt WPT regressions to extracted modules
Remove duplicate test module registrations and fix the Window fixture include path after rebasing onto main. Preserve the preload fixture string and format migrated tests.
2026-11-02 06:03:23 +08:00
ldm0 dac02c3828 test(navigation): preserve gated popup responses after stop 2026-11-02 06:03:23 +08:00
ldm0 ba4fe879a1 test: reconcile main regression tests after WPT rebase 2026-11-02 06:03:23 +08:00
ldm0 0f32429b46 test(dom): distinguish popover callbacks from rendering wakes 2026-11-02 06:03:23 +08:00
ldm0 e7f0cff93d fix(fetch): extract MIME types when materializing bodies 2026-11-02 06:03:22 +08:00
ldm0 350831da29 fix(performance): minimize resource timing content types 2026-11-02 06:02:26 +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 32bf2eb0c7 fix(performance): inherit navigation timing from resource entries 2026-11-02 06:02:26 +08:00
ldm0 a2cc617b71 fix(performance): bind legacy timing to native state 2026-11-02 06:02:26 +08:00
ldm0 b38e7293b8 fix(webidl): expose readonly ResizeObserver result snapshots 2026-11-02 06:02:26 +08:00
ldm0 82f852034a fix(performance): validate receivers and support worker buffer state
Route Performance methods and attributes through native WebIDL brands so
invalid receivers fail before author code, with errors from the callee realm.
Remove the duplicate callback-local slot checks.

Share native resource-buffer configuration with worker contexts instead of
requiring a page host. Preserve owner isolation and context-owned cleanup.

Cover Window/iframe and Dedicated Worker receiver behavior, borrowed timing
operations, registry isolation, and worker teardown. Validated with fmt,
workspace Clippy, 20,250 Nextest tests, CLI probes, and 20 upstream WPT cases.
2026-11-02 06:02:26 +08:00
ldm0 78e85d927d fix(observers): sample targets across top-level documents
Opener observers could report an initial non-intersecting popup target but
miss its insertion, and ResizeObserver sampled zero-sized popup targets.
The rendering update only refreshed the observer's Document, while a shared
latest-layout slot let independent top-level Documents overwrite each other.

Keep each popup's latest layout and matching metrics in its current Document
record, and refresh the distinct target/root Documents before broadcasting.
Document replacement and committed close release the corresponding snapshot;
iframe viewport invalidation preserves snapshots owned by other windows.

Cover opener/iframe observers across Documents, popup replacement and close,
and iframe attribute invalidation and removal. Share browser-facing scenarios
between native regression tests and the Chromium/Moli CDP comparison.
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 6bccdd8847 fix(observers): preserve intersection notification ordering
Keep targets in observe() order across duplicates, unobserve/reobserve and DOM
reordering. Remove targets without changing the relative order of survivors.

Snapshot only the observer list when notifying. Drain each queue immediately
before its callback so earlier callbacks and microtasks can takeRecords() or
cancel pending observations. Revalidate Document and callback realm ownership
between deliveries.

Validation: fmt and workspace Clippy passed; Nextest 20,242 passed, 16 skipped.
Original multiple-targets WPT passed 20/20 repetitions (baseline 2/20); 14 related
WPT pages have no new failures. Shared behavior probes match Chromium.
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 5542e11da6 fix(focus): revalidate DOM focus during rendering updates
Coalesce native focus checks with the owning Document's animation-frame wake
and revalidate focusability after callbacks. Remove the fieldset-only
synchronous blur and the dependency on author-modifiable setTimeout.

Keep pending checks bound to their exact Document across document.open and
Window retirement. Bound change/blur handlers and their cleanup microtasks
with the execution watchdog.

Cover focusability changes, restored focus, native scheduling, shadow and
child documents, replacement, retirement, reentrancy, and timeout recovery.
Adapt the vendored nested-fieldset test to HTML's asynchronous focus-fixup
requirement and document its difference from the original upstream test.
2026-11-02 06:02:26 +08:00
ldm0 83e6b90aee fix(focus): preserve sequential navigation positions across DOM mutations
Track navigation origins as elements or native DOM boundary points, and
update them through existing removal, movement and text-split notifications.
Use shadow-including DOM order when the origin is outside the tab order.

Keep navigation positions independent of Selection, reset focus through
shadow hosts on self-replacement, and retain the detached-insertion fast
path when no live ranges exist. Cover both Tab directions with and without
a DOM Selection.
2026-11-02 06:02:26 +08:00
ldm0 fde73b3cae fix(selection): separate visible text control selections from cached ranges 2026-11-02 06:02:26 +08:00
ldm0 5986b35d99 fix(selection): restore focused text control ranges after clearing
Restore the owning Document's Selection after successful text selection
setters, including unchanged cached offsets. Reuse the existing projection
in the owner realm and reset the focused control's cached offsets when
clearing its Document Selection.

Cover parent/child realms, shadow trees, cleared/replaced ranges, argument
conversion side effects, and isolated background controls.
2026-11-02 06:02:26 +08:00
ldm0 b5d2f8db61 fix(selection): sync Range mutations with the owning document
Resolve an associated Selection through the native Range record and its owning Document, independently of the Range creation realm or borrowed method realm. Share native document membership checks with addRange and getRangeAt, and clear associations when explicit Range mutations leave that document.

Route direct and relative boundary setters through the same adjustment and synchronization path. Keep composed direction and type when a DOM Range projects a span across shadow roots.

Cover cross-realm ownership, detached trees, explicit reattachment, cloned and replaced ranges, invalid boundaries and author getters. Validate 448 ownership combinations and 36 direction/type scenarios against Chromium, while preserving validation-before-mutation semantics for invalid foreign offsets.
2026-11-02 06:02:26 +08:00
ldm0 c9bcd4eddb fix(selection): preserve composed state across shadow trees
Keep composed selection direction independent of its public Range projection. When extend() crosses DOM roots, create a new caret at the focus without modifying the previously associated Range.

Track composed positions through native text edits, splits and removals, including child-document mutations invoked through borrowed parent-realm methods. Share text boundary rules with live ranges and remove the current-Window-specific removal path.

Add browser-matched coverage for open and closed shadow trees, parent offsets, UTF-16 mutations, range identity and cross-realm ownership.
2026-11-02 06:02:26 +08:00
ldm0 2bc5baeb66 fix(focus): initialize selections in contenteditable hosts
Initialize the native caret before focus events in the editing host owner realm, retaining existing host selections and their Range identity. Preserve UTF-16 offsets, whitespace and shadow projections, and queue document selectionchange through the existing task queue.
2026-11-02 06:02:26 +08:00
ldm0 49f2313778 fix(selection): validate range membership with native DOM ownership 2026-11-02 06:02:26 +08:00
ldm0 0f69d75bf9 fix(selection): project focused text controls into document ranges 2026-11-02 06:02:26 +08:00