Commit Graph
638 Commits
Author SHA1 Message Date
ldm0 b0706dbb19 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-22 02:01:55 +08:00
ldm0 61549c3ee6 fix(navigation): check renderer history traversals before fetching 2026-11-22 02:01:55 +08:00
ldm0 da11ddb2f5 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-22 02:01:55 +08:00
ldm0 91f630a125 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-22 02:01:55 +08:00
ldm0 076a1fdd6d fix(navigation): preserve history referrer policies at commit 2026-11-22 02:01:55 +08:00
ldm0 b6276cf303 fix(navigation): preserve inherited top-level about:blank state 2026-11-22 02:01:55 +08:00
ldm0 92dfa5ba5b fix(navigation): defer unload until document replacement 2026-11-22 02:01:55 +08:00
ldm0 d3017e3a3f fix(cdp): deliver current renderer notifications during navigation 2026-11-22 02:01:55 +08:00
ldm0 bd56b90042 fix(navigation): preserve documents on HTTP 204 and 205 responses 2026-11-22 02:01:55 +08:00
ldm0 1e5eff1cd5 test(navigation): preserve gated popup responses after stop 2026-11-22 02:01:55 +08:00
ldm0 4adbb01557 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-22 02:01:55 +08:00
ldm0 d0470f2483 fix(layout): adapt WPT input to explicit published snapshots 2026-11-22 02:01:54 +08:00
ldm0 5f8dafebfa fix(history): preserve traversal settlement and owner-scoped cancellation 2026-11-22 02:01:54 +08:00
ldm0 05292bca7f fix(navigation): validate child ancestor navigation permissions 2026-11-22 02:01:54 +08:00
ldm0 37648c6aa8 fix(navigation): complete popup document unload lifecycle 2026-11-22 02:01:54 +08:00
ldm0 0240a70280 fix(iframe): reject ancestor URLs during attribute navigation 2026-11-22 02:01:54 +08:00
ldm0 b4ddf12705 fix(navigation): check child beforeunload before loading 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 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 d80575eace fix(preload): consume document-owned preload responses 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
ldm0 0846e23778 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-22 02:01:53 +08:00
ldm0 9d6160d6da 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-22 02:01:52 +08:00
ldm0 6cc25077db 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-22 02:01:52 +08:00
ldm0 a7e8d20719 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-22 02:01:52 +08:00
ldm0 c7a76a6b6f 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-22 02:01:52 +08:00
ldm0 44ddf25b82 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-22 02:01:52 +08:00
ldm0 41dc7b5799 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-22 02:01:52 +08:00
ldm0 ef06a82185 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-22 02:01:52 +08:00
ldm0 e07bcd0433 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-22 02:01:52 +08:00
ldm0 aaf98c3e0c 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-22 02:01:52 +08:00
ldm0 387157ec4f 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-22 02:01:52 +08:00
ldm0 e200c392aa 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-22 02:01:52 +08:00
ldm0 a6bbe3570a 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-22 02:01:52 +08:00
ldm0 1378307a2e 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-22 02:01:52 +08:00
ldm0 5cccb4a791 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-22 02:01:52 +08:00
ldm0 c66fb4e2b1 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-22 02:01:52 +08:00
ldm0 7473a0fca6 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-22 02:01:52 +08:00
ldm0 934e2b766e fix(dom): update document.open URLs from the entry document 2026-11-22 02:01:52 +08:00
ldm0 7b4f4ceb58 fix(cdp): preserve session routing for child default bindings 2026-11-22 02:01:50 +08:00
ldm0 9760e04e2d 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-22 02:01:48 +08:00
ldm0 c4465be52f fix(cdp): preserve buffered Audits issues during replay 2026-11-20 12:40:22 +08:00
ldm0 1a4eeee66e fix(network): preserve worker redirect transport observations
Retain each manually followed HTTP hop's request/response ExtraInfo and
derive redirect availability from observed exchanges instead of a fixed flag.
Keep wire ExtraInfo when interception changes the logical response, and
preserve buffered redirect metadata without announcing requests twice.

Cover Worker fetch/XHR through two 302 Set-Cookie hops, including synthetic
first-hop redirects that must not produce transport ExtraInfo.
2026-11-20 02:23:32 +08:00
ldm0 359c32095a refactor(network): separate request updates from transport observations 2026-11-20 02:23:32 +08:00
ldm0 a5c8897cc8 fix(network): keep prepared cookies out of CDP transport headers
Retain admission cookie metadata in the typed automation event for BiDi, while deferring CDP Cookie headers and ExtraInfo to observed transport data.

Verify a Service Worker supplied iframe script executes without an HTTP script request or invented CDP Cookie header, and keep the prepared metadata available to BiDi.
2026-11-20 02:23:32 +08:00
ldm0 87c9d92c94 fix(network): retain worker request metadata updates
Keep repeated native request snapshots in the output queue so Fetch overrides refresh captured upload bodies. Mark which snapshots announce a new request and suppress duplicate CDP starts during metadata enrichment.

Check that chained binary, text and empty upload overrides preserve a single requestWillBeSent per request and session.
2026-11-20 02:23:32 +08:00