Commit Graph
273 Commits
Author SHA1 Message Date
ldm0 9fc99af093 fix(navigation): check renderer history traversals before fetching 2026-11-20 22:47:44 +08:00
ldm0 b79bc0495b 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-20 22:47:44 +08:00
ldm0 155890f3b1 fix(navigation): defer unload until document replacement 2026-11-20 22:47:43 +08:00
ldm0 942909f368 fix(focus): process autofocus candidates from child documents
Join child candidates to their active top-level Document's queue in connection
order. Revalidate ownership and ancestor fragments when flushing, and preserve
blocked candidates until their own Document's stylesheet readiness settles.

Construct focus transitions in the target Document's realm using the intrinsic
FocusEvent with its view, without consulting author constructors or inherited
initialization getters. Cover queue ownership, retirement, policies, stylesheet
wakes, and cross-realm focus event behavior.
2026-11-20 22:47:43 +08:00
ldm0 9eae4f7495 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-20 22:47:42 +08:00
ldm0 402de4c99b fix(navigation): let renderer requests supersede pending loads
Allow top-level navigation owner actions from the current Document through
the in-flight navigation gate so they can cancel the previous request.
Keep exact scheduler predecessors and Page residence validation in place.

Cover an unresponsive first request replaced by page JavaScript without
further client commands, and ensure only the replacement enters history.
2026-11-20 22:47:40 +08:00
ldm0 f77ed79182 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-20 22:47:40 +08:00
ldm0 44bcfc860a fix(editing): implement native execCommand text copying
execCommand("copy") previously returned the user-activation flag without
firing an event or updating the clipboard. Dispatch trusted beforecopy and
copy events, honor cancellation, and copy the receiver document's selection.

Keep text-control selections per document across focus changes and reject
nested editing commands per native document. Share Window activation state
with navigator.userActivation so copying remains available after the
activating call and expires without clearing sticky activation. Read fresh
layout for DOM selection text, preserve preformatted whitespace, and use
the browser profile's clipboard line endings.

Add nine regression tests and correct the BiDi activation regression test.
Validate 38 copy-command cases, 38 existing native shortcut cases, and nine
activation-state cases against Chromium. The copy-event WPT and all 32
selection line-break subtests now pass, with no regressions in 65 WPT cases.
2026-11-20 22:47:37 +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 c7569ab28f fix(network): seal cancelled script downloads before cache reuse
Close admission under the load mutex when the last consumer retires, before signalling transport cancellation. Reserve new consumers during cache lookup so callback installation cannot race the last cancellation, and discard late completion from cancelled downloads.

Cover cancellation before transport acknowledgement, late success, reserved consumers and same-turn iframe removal followed by a parent script using the same URL.
2026-11-20 02:23:32 +08:00
ldm0 ffd465e6ff fix(network): include child script cookies in BiDi admission
Prepare initial headers and cookie metadata through the child Document's
request client, including credentials and browser site-context policy.
BiDi beforeRequestSent and terminal events retain this request metadata.

Defer CDP ExtraInfo separately so admission cookie metadata does not consume
the single later transport ExtraInfo event. Test HTTP 200, HTTP 404 and
cross-origin anonymous script requests.
2026-11-20 02:23:32 +08:00
ldm0 f007717c47 fix(network): cancel discarded parser scripts before document.open transfer
Finish and cancel announced parser-script consumers before transferring
surviving Window loads into the replacement Document registry. Preserve
the original network request identity and ignore late source callbacks.

Test replacement content and networkIdle while the old response is held.
2026-11-20 02:23:32 +08:00
ldm0 28213784f0 fix(network): retire announced child scripts with their documents
Use Document resource-load leases and shared cache consumer cancellation
for announced child parser scripts. Finish the original request on
retirement, ignore late callbacks, and publish completion independently
of parser-runner lifetime when navigation is cancelled.

Track request ExtraInfo publication separately from enriched cookie
metadata so HTTP-error responses preserve one Cookie ExtraInfo event.

Cover held-response retirement, cancelled srcdoc, late source callbacks,
and repeated metadata enrichment with regression tests.
2026-11-20 02:23:32 +08:00
ldm0 6256a6fa28 fix(network): announce child parser script requests before completion 2026-11-20 02:23:32 +08:00
ldm0 3cfec23af6 refactor(target): decouple Browser sessions from Renderer readiness
Commit Browser attachment and withdrawal independently of native Page and
Inspector initialization. Keep shared initial builds on the target and bind
queued Main/IO work to its admitted session connection and native agent.

Separate minimum Inspector connect from ordered binding replay, and publish
unobserved initialization facts without snapshots or completion fences.
Retire Browser contributions immediately and supervise cleanup using the
original native authority, including failed or replaced connections.
2026-11-20 02:10:47 +08:00
ldm0 1a08aa3454 fix(target): supervise deferred Inspector initialization 2026-11-20 02:10:47 +08:00
coolswood ef4cc019b2 fix(scheduler): keep a closed deferred-attachment channel from preempting background inputs
The deferred attachment binding completion channel is owned by the
connection, so it closes as soon as the connection goes away (and in
tests, as soon as a hand-built receivers struct drops the sender). The
new receive arms sat ahead of the background-event and
renderer-publication arms in the biased select order without a
closed-channel guard, so a closed channel returned None immediately and
starved every input behind it.

Guard the arms with the same is_closed() check the protocol-work
completion arm already uses: a closed deferred channel cannot produce
further completions, so skipping it loses nothing.
2026-11-20 02:10:47 +08:00
coolswood f3504965ab fix(target): complete Target.attachToTarget while a JavaScript dialog is open
Chromium resolves Target.attachToTarget in ~0 ms even when the target
shows a modal alert/confirm/prompt; moli parked the attach response
behind the renderer's modal wait because the attachment binding apply
was awaited before the commit.

Defer the binding apply instead: a dialog that is already published for
the target (or one that opens while the apply waits) hands the
still-queued dispatch to a supervised background wait, and the attach
commits immediately. The apply settles once the renderer frees up and
its completion is consumed by the scheduler with the same failure
tolerance as the synchronous path, minus the response predecessor
fence that no longer orders anything after publication. Renderer FIFO
still keeps the new session's first command behind the bindings.

createTarget/setAutoAttach share the broader dispatch path and remain
follow-up work.
2026-11-20 02:10:47 +08:00
ldm0 e8520afc1c test(inspector): cover UTF-16 wire encoding and byte limits
Extracted from wpt-misc-fix commit 240cd573ed.
2026-11-19 14:10:00 +08:00
ldm0 fd61a88eab test(navigation): verify renderer replacement in Navigation API entries
Extracted from wpt-misc-fix commit b49269043e3ab8e9908a8e7ddc3c1791fec515f1.
2026-11-18 22:05:06 +08:00
ldm0 d9f30c7326 test(cdp): check popup navigation subscription replies
Extracted from wpt-misc-fix commit 83a83656b2442e3145b250e5a98199ca7c62a4b4.
2026-11-18 21:37:23 +08:00
ldm0 2bd6009e66 test(cdp): cover module completion after named popup reuse
Extracted from wpt-misc-fix commit 94e351cd05a2efe132f4c6b683b7ca6d9c0d8889.
2026-11-18 21:36:50 +08:00
ldm0 910122fb45 refactor(webdriver): move upload paths into file admission 2026-11-16 19:42:47 +08:00
ldm0 47399e4ec6 fix(files): prepare shared directory selections off the protocol thread 2026-11-16 19:42:47 +08:00
ldm0 f10e9c0bcf refactor(files): retain lazy file backings for selected uploads 2026-11-16 19:42:47 +08:00
ldm0 8b6e73d773 fix(files): support directory uploads and relative file paths 2026-11-16 19:42:47 +08:00
ldm0 5435b97e3f fix(cdp): publish runtime readiness for pipe sessions
Notify the embedder after the shared CDP owner is initialized and before
waiting for pipe input. Describe readiness in terms of the protocol
transport so the contract covers both TCP and pipe sessions.

Exercise the public pipe API with ace-protocol enabled: publish one usable
handle before any incoming CDP command, then revoke it after EOF. Repeat
for a second serving invocation. The new case times out without the hook.
2026-11-16 01:20:01 +08:00
sicko7947andClaude Sonnet 5.5 73eb3b005e feat(cli): serve one CDP session over Chromium's remote debugging pipe
`moli serve --remote-debugging-pipe` reads NUL-terminated CDP messages from
inherited file descriptor 3 and writes replies to descriptor 4, like
Chromium's flag of the same name. No listener is bound, so a parent process
can drive a private browser without choosing or exposing a port. The session
ends at EOF on the input pipe or on Browser.close.

- The CLI claims descriptors 3 and 4 once, after checking that both are pipes
  or sockets, and hands them to `ProtocolServer::serve_pipe` as `OwnedFd`.
- The WebSocket writer is generic over any message sink, so the pipe shares
  its bounded queue and stall handling.
- Shutdown follows `serve_listener`: stop the CDP owner, drain, then flush
  storage on a blocking worker inside the shared shutdown budget, reporting a
  failed flush.
- An inbound message is limited to the WebSocket transport's 64 MiB and is
  rejected as soon as it exceeds that.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-16 01:20:01 +08:00
ldm0 342b83fd6e fix(webdriver): preserve reverse key release order 2026-11-15 16:56:15 +08:00
ldm0 1a752c0181 fix(webdriver): preserve raw key locations in actions 2026-11-15 16:56:15 +08:00
ldm0 dd9e8a4ddf fix(window): preserve active auxiliary BarProp visibility during close
Source-commit: f252bdf404
2026-11-15 01:29:28 +08:00
ldm0 1fc3848c6c fix(download): stream child-frame attachments with sandbox checks 2026-11-14 23:13:54 +08:00
ldm0 0e3dae13cd refactor(inspector): own helper leases and remove legacy tracking 2026-11-14 02:13:16 +08:00
ldm0 95dbc88a4f refactor(cdp): keep event validation at build and test time 2026-11-14 00:44:58 +08:00
ldm0 6650c81e73 fix(cdp): finish event migration and report rejected batches 2026-11-14 00:44:58 +08:00
ldm0 59c47a2f93 fix(cdp): enforce advertised event names at frontend output 2026-11-14 00:44:58 +08:00
ldm0 f4d868c244 refactor(cdp): require typed local event construction 2026-11-14 00:44:58 +08:00
ldm0 efbeb470e5 fix(cdp): abort document requests handed off to downloads 2026-11-13 22:44:23 +08:00
ldm0 9e357b95e4 feat(xhr): keep network interception live during synchronous sends
Route intercepted Window and dedicated Worker XHR through shared native
request, authentication and response decisions. One-shot pause ports let the
existing protocol/session machinery continue, fail or fulfill a request
without queueing a Page command behind its suspended JavaScript stack.

Publish native network facts across an explicit synchronous-wait scope, preserve
normal asynchronous streaming delivery, and cancel loads before owner
teardown. Remove the synchronous-only URL-rule copy and retain the canonical
protocol matcher, session chains and request identities.

Cover Page task suspension, independent protocol decisions, binary overrides,
CORS preflight, authentication, redirects, streaming, multi-session cleanup,
Worker termination and target close. Await actual callback/command identities
where network acknowledgements no longer imply Page delivery has finished.
2026-11-13 22:37:15 +08:00
ldm0 d9e3622aa4 fix(bidi): ignore fragments in string interception rules 2026-11-13 22:37:15 +08:00
ldm0 e8ce829d88 fix(xhr): enforce exact interception URLs for synchronous requests 2026-11-13 22:37:15 +08:00
ldm0 b27aeb1c8f fix(network): report only actual response interception pauses 2026-11-13 22:37:15 +08:00
ldm0 5a6cdc5e86 fix(protocol): acknowledge stop-loading before Native cleanup 2026-11-13 21:26:12 +08:00
ldm0 084e4930c6 test(protocol): observe self-close completion from the live opener 2026-11-13 21:26:12 +08:00
ldm0 724f86fbd6 fix(webdriver): bound Classic alert navigation waits 2026-11-13 21:26:12 +08:00
ldm0 c376d468c4 fix(webdriver): return HTTP 500 for timeout errors 2026-11-13 21:26:12 +08:00
ldm0 963ad1a942 fix(webdriver): interrupt Classic navigation waits for live dialogs 2026-11-13 21:26:12 +08:00
ldm0 d5220c536b fix(protocol): keep existing dialogs handleable during navigation 2026-11-13 21:26:12 +08:00
ldm0 4a9ed35dd5 fix(protocol): keep command progress local to sessions and input owners
Give BiDi commands independent admission, Native and navigation waits instead
of retaining the socket turn or a single Runtime slot. Share input state by
top-level host, retain its performActions queue, and allow release/control work
during pauses without applying future input state early.

Keep CDP navigation queues local to their sessions, project independent output
while another page is modal, and recover Worker network ownership from its
original session. Preserve exact host bindings, renderer/load predecessors,
original Runtime results and actual realm-retirement ordering.

Validate with cargo fmt --all, workspace Clippy (all targets/features, warnings
denied), and cargo nextest run --no-fail-fast: 23,068 passed, 20 existing skips.
2026-11-13 21:26:12 +08:00