Commit Graph
658 Commits
Author SHA1 Message Date
ldm0 754c138b07 fix(navigation): defer unload until document replacement 2026-11-24 14:34:56 +08:00
ldm0 0168c58ef6 fix(cdp): deliver current renderer notifications during navigation 2026-11-24 14:34:56 +08:00
ldm0 8131dc8070 fix(navigation): preserve documents on HTTP 204 and 205 responses 2026-11-24 14:34:56 +08:00
ldm0 a8d8fc3375 test(navigation): preserve gated popup responses after stop 2026-11-24 14:34:56 +08:00
ldm0 f299f98b39 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-24 14:34:56 +08:00
ldm0 af3609a0ad fix(layout): adapt WPT input to explicit published snapshots 2026-11-24 14:34:55 +08:00
ldm0 e5cf16f9a6 fix(history): preserve traversal settlement and owner-scoped cancellation 2026-11-24 14:34:55 +08:00
ldm0 5bc52e4511 fix(navigation): validate child ancestor navigation permissions 2026-11-24 14:34:55 +08:00
ldm0 30473677bd fix(navigation): complete popup document unload lifecycle 2026-11-24 14:34:55 +08:00
ldm0 01b0f1499d fix(iframe): reject ancestor URLs during attribute navigation 2026-11-24 14:34:54 +08:00
ldm0 c5aeb3ea16 fix(navigation): check child beforeunload before loading 2026-11-24 14:34:54 +08:00
ldm0 abcd51ca9a 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-24 14:34:54 +08:00
ldm0 3c17193ccb 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-24 14:34:54 +08:00
ldm0 ef5c20d476 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-24 14:34:54 +08:00
ldm0 e57e005e4e fix(navigation): retain Navigation across initial Window reuse 2026-11-24 14:34:23 +08:00
ldm0 6dd16ee4e5 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-24 14:34:22 +08:00
ldm0 b2e373536e 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-24 14:32:48 +08:00
ldm0 c28d8273ea fix(preload): consume document-owned preload responses 2026-11-24 14:32:20 +08:00
ldm0 b6718a3bfc test(protocol): await restored documents and focus events 2026-11-24 14:31:53 +08:00
ldm0 1a274e2010 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-24 14:31:52 +08:00
ldm0 de4fd8a353 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-24 14:31:52 +08:00
ldm0 ca833c7e86 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-24 14:31:52 +08:00
ldm0 9942fce571 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-24 14:31:52 +08:00
ldm0 c928320daa 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-24 14:31:52 +08:00
ldm0 a27d89fc39 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-24 14:31:52 +08:00
ldm0 cda12c2b71 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-24 14:31:52 +08:00
ldm0 c9c8997758 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-24 14:31:52 +08:00
ldm0 20eb762d19 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-24 14:31:23 +08:00
ldm0 2bfd23809a 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-24 14:31:23 +08:00
ldm0 f9ee6a3346 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-24 14:31:23 +08:00
ldm0 35b38ad2de 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-24 14:31:23 +08:00
ldm0 d07990e768 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-24 14:30:57 +08:00
ldm0 a508dd11a9 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-24 14:30:57 +08:00
ldm0 d42b264041 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-24 14:30:57 +08:00
ldm0 20e7b21c18 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-24 14:30:57 +08:00
ldm0 756a36f714 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-24 14:30:57 +08:00
ldm0 489acf85ba fix(dom): update document.open URLs from the entry document 2026-11-24 14:30:47 +08:00
ldm0 7e96db5576 fix(cdp): preserve session routing for child default bindings 2026-11-24 14:30:01 +08:00
ldm0 41302e913b fix(window): preserve browsing context opener semantics 2026-11-24 14:28:15 +08:00
ldm0 4232adafcd test(emulation): cover text scale changes before initial page adoption 2026-11-24 06:06:01 +08:00
ldm0 b217be228d fix(cssom): match media rules against their stylesheet document 2026-11-24 06:06:01 +08:00
ldm0 edaa3864bb fix(emulation): reset text scale on session detach 2026-11-24 06:06:01 +08:00
ldm0 f5caa272ec fix(style): resolve text scale per document 2026-11-24 06:06:01 +08:00
ldm0 85a0386045 feat(emulation): honor the operating system text scale
(cherry picked from commit 177b5f90d33865eff06c23521738b726deae76ac)
2026-11-24 06:06:01 +08:00
ldm0 43fd204b30 fix(emulation): apply current media settings when adopting the initial Page 2026-11-24 06:06:01 +08:00
ldm0 7840ae5c4c fix(emulation): preserve blur neighbors for transformed viewport capture 2026-11-24 06:06:01 +08:00
ldm0 89e27cbd0a fix(emulation): bound blurred vision and preserve clip neighbors 2026-11-24 06:06:01 +08:00
ldm0 386f574aab fix(emulation): preserve per-target media and vision overrides 2026-11-24 06:06:01 +08:00
ldm0 997a5440fb feat(emulation): render vision deficiency simulation
(cherry picked from commit b88fa7782613e4b104cbdaf014d837edb94bd545)
2026-11-24 06:06:01 +08:00
ldm0 2c2987b74f fix(paint): clip DevTools box highlights to their outer quads 2026-11-24 04:50:24 +08:00