Commit Graph
404 Commits
Author SHA1 Message Date
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 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 76a4bae9c9 fix(fetch): queue Body completion on receiver fetch tasks 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 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 60f94cd4d3 fix(layout): adapt WPT input to explicit published snapshots 2026-11-02 06:02:25 +08:00
ldm0 20bef73cfa fix(history): preserve traversal settlement and owner-scoped cancellation 2026-11-02 06:02:25 +08:00
ldm0 7890b8d06d fix(navigation): validate child ancestor navigation permissions 2026-11-02 06:02:25 +08:00
ldm0 d001702426 fix(navigation): complete popup document unload lifecycle 2026-11-02 06:02:25 +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 321b34d523 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-02 06:02:25 +08:00
ldm0 afd6d847b8 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-02 06:02:25 +08:00
ldm0 b2c7ca5855 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-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 e426ce91da 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-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 9ff41f73f4 fix(preload): consume document-owned preload responses 2026-11-02 06:02:24 +08:00
ldm0 8927b2abe2 test(protocol): await restored documents and focus events 2026-11-02 06:02:23 +08:00
ldm0 37a916bfdc test(history): adapt navigation fixtures after main rebase
Initialize the history field in the upstream navigation fixture. Use the existing 8 MiB stack helper for the two deep traversal tests whose replacement-navigation path exceeds the default test-thread stack.
2026-11-02 06:02:23 +08:00
ldm0 a0c3c44bbd fix(history): restore nested histories across document replacement
Keep child entries and srcdoc resources with their parent Document identity
when top-level and popup Documents are replaced. Restore their original joint
history steps, avoid traversing descendants of a retiring parent, and prune
forward entries when navigation branches from an earlier step.

Preserve parser-created frame identities in navigation projections. Cover
named and unnamed frames, script-created parents, nested Documents, entry
state and identity, and interleaved multi-step traversals through CDP.
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 1daf2f344d fix(navigation): cancel active events according to dispatch state
Set the canceled flag when aborting a navigate event during dispatch, including iframe traversal events that are not author-cancelable. Preserve the flag when a precommit handler aborts the navigation after dispatch has ended.

Keep cross-document history traversal running when stop() cancels its Navigation API event and promises. Continue checking that its original Window and Document are active before queuing the load.

Cover detachment, window.stop(), and nested navigation in both phases, plus the non-cancelable preventDefault control. Verify abort listeners, promise rejection identity, the exception realm, and cross-document restoration.

Spec: https://html.spec.whatwg.org/multipage/nav-history-apis.html#abort-the-ongoing-navigation
Spec: https://html.spec.whatwg.org/multipage/document-lifecycle.html#stop-loading
2026-11-02 06:02:22 +08:00
ldm0 34f86385dc fix(navigation): preserve queued traversal targets and results
Reject retained traversal results in their original realm when the target
LocalWindow retires before the history task runs. Complete the Promise
reactions without firing navigation events or applying stale history.
Keep PageVm namespaces and exact task ownership checks when consuming the
payload, and leave classic History tasks without results as no-op cleanup.

Choose back/forward destinations from the committed current entry so
repeated pending calls share the same destination and result Promises.
Cover removed and reinserted frames, same- and cross-document traversals,
rejection realms and callback completion, and PageVm task-ID reuse.
2026-11-02 06:02:22 +08:00
ldm0 2aa27eddef fix(navigation): preserve iframe lifecycle during history traversal
Keep child document subtrees active while a history response is pending or
ignored. Check beforeunload before navigate, then defer pagehide and unload
until a document response commits. Preserve the event flag independently
of temporary native unload counters so later navigations remain usable.

Unload removed frame subtrees before retiring their Window and Document
wrappers, and reject active navigation trackers before removal events.
Dispatch in the retiring realm so removing cross-origin frames does not
leak a SecurityError into the parent.
Cover delayed responses, 204/205/download retries, stop(), and detachment
with gated protocol tests.
2026-11-02 06:02:22 +08:00
ldm0 b75c83840b fix(navigation): dispatch popup cross-document history events
Route popup history traversal through the Window-owned task queue and retain
its Navigation API signal and method results until commit or cancellation.
Window.stop() aborts those API results while the physical traversal continues.

Deliver popup pageshow and traversal unload events, preserve nested unload
guards, and handle close() from navigate and pagehide callbacks. Add gated
HTTP regression coverage for traversal metadata, cancellation, ignored
responses, and opener history isolation.
2026-11-02 06:02:22 +08:00
ldm0 b53ac1ff5c fix(navigation): track and cancel popup document requests
Start real loads for popup Navigation API calls and reloads. Keep the
active URL and history while fetching, then install the destination
history only when its response commits, including redirects.

Cancel pending resource loaders on stop or close, preserve pending
promises for ignored responses, and reject reentrant navigations during
stop callbacks. Add gated HTTP regression tests for these boundaries.
2026-11-02 06:02:22 +08:00
ldm0 ae51bc7cfc fix(navigation): abort popup navigations before closing
Notify Navigation API in the popup's exact execution scope before the close
task retires its callbacks and LocalWindow. Re-establish the popup alias
from its retained Window when its opener has already been detached.

Cover precommit and committed query, fragment, and reload interceptions,
late handler settlements, reentrant close/navigation, same-name popups,
and opener retirement while checking unrelated windows remain usable.
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 b91438b877 fix(navigation): reject transitions canceled during precommit
Settle the canceled event's transition promises with its AbortError. Retain the committed resolver before abort/error callbacks so a reentrant navigation cannot resolve the old transition, and preserve any replacement transition during cleanup.

Cover back(), navigate(), and reload() cancellation by stop(), a subsequent navigation, and a subsequent intercepted navigation, including promise reasons and renderer/CDP history consistency.
2026-11-02 06:02:21 +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 8f5403b6a1 fix(history): publish same-document commits before callbacks
Synchronize Document.URL and report same-document pushes, replacements, and
traversals when their renderer entries commit. Navigation API commits now
reach browser history, and reentrant currententrychange/popstate handlers
cannot reorder entries or trigger traversal URL drift assertions.

Cover mixed Navigation, History, and Location sequences through CDP,
including nested callbacks, intercepted/precommit traversals, and cancellation.
2026-11-02 06:02:21 +08:00
ldm0 cde21f11d5 fix(dom): update document.open URLs from the entry document 2026-11-02 06:02:21 +08:00
ldm0 2bf4bf9264 fix(cdp): preserve session routing for child default bindings 2026-11-02 06:02:18 +08:00
ldm0 4a00394f88 fix(history): preserve queued same-document traversal steps
Queue each History back/forward/go delta as its own authorized traversal task and resolve the destination when that task runs. Keep the committed traversal position separate from synchronous history mutations, and use the canonical Window history for isolated-world calls. Preserve Navigation API result-bearing traversal behavior.

Cover consecutive and opposite deltas, initially out-of-range requests, synchronous pushState, canceled and reentrant traversals, child documents, and isolated worlds. Update old coalescing assertions and wait for actual browser-owned history commits in protocol tests.

Validation: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast (17584 passed, 13 skipped). Overlapping navigation WPT improves from 16/22 to 18/22, with both new cases passing all 8 subtests. Navigation API comparison preserves all 385 previously passing cases out of 432.

CDP smoke: 41/43 passed. The dom-input FileList upload failure reproduces on the parent binary; puppeteer could not start because Node is missing locally. Artifacts: target/wpt-history-traversal-20260908-lcpQpn/{before,confirmed,navigation-after,cdp,cdp-before}.
2026-11-02 06:01:31 +08:00
ldm0 768ba6e400 test(storage): cover first-party quota isolation and implicit OPFS 2026-11-01 05:19:55 +08:00
ldm0 244192dccb refactor(storage): remove unused cross-partition usage APIs 2026-11-01 05:19:55 +08:00
ldm0 f11c7cbf32 fix(storage): scope CDP quota usage to first-party StorageKey 2026-11-01 05:19:55 +08:00
ldm0 843ddcc3f2 refactor(storage): retire protocol cookie profiles and close partitions once 2026-11-01 04:03:38 +08:00