Commit Graph
286 Commits
Author SHA1 Message Date
ldm0 9d20a41c00 fix(cdp): preserve navigation ownership and inspector response order
Forward lossless CDP wire messages through native ownership workflows. Preserve exact earlier console output before terminal replies, and let old Inspector commands receive context-destruction results before their response routes retire.

Validation: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast. Checks cover the integrated workspace with 32-way concurrency and no automatic retries.
2026-11-21 20:03:39 +08:00
ldm0 87184b44c9 fix(indexeddb): retain native wrapper identity and abort ordering
Cache canonical object-store and index wrappers in their owner realms, release caches with native lifetimes, and retain pending-request AbortError ordering when cloning aborts a transaction. Exercise real auxiliary-page connection retirement.

Validation: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast. Checks cover the integrated workspace with 32-way concurrency and no automatic retries.
2026-11-21 20:03:39 +08:00
ldm0 ed68279a45 fix(inspector): retain native UTF-16 routing and binding errors
Reuse the native InspectorJson transport and schema-specific handle ownership. Preserve independent frontend IDs/session routing, bounded raw wire output, pause balance and automation sidecars with complete additional regressions.

Decode binding error text strictly for the scalar consumer while preserving its original error code and avoiding success state updates. Keep opaque Inspector payloads unchanged.
2026-11-21 20:03:38 +08:00
ldm0 0ad33d8371 fix(csp): retain inherited self for script element admission
Check enforced and report-only script URLs against the policy's retained self URL while preserving the protected Document URL in violation reports. This lets initial about:blank popup script elements load same-origin modules without widening cross-origin policy.

Strengthen the real auxiliary-target regression with inherited script-src/connect-src self and an unchanged about:blank URL. Cover positive and negative script policies plus reporting for blank, srcdoc and data Documents.

Validation: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast (23552 passed, 18 existing skips; 32 threads, no retries).
2026-11-21 20:03:37 +08:00
ldm0 1b41bee644 fix(runtime): integrate main event dispatch and font ownership
Preserve shared listener registry identity across document.open, use explicit target/ancestor listener filters, and retain canonical EventTarget inheritance after the main rebase. Drive font and streamed-navigation tests through their native completion queues and align event-order expectations with pinned Chromium 152 observations.
2026-11-21 20:03:37 +08:00
ldm0 0cdb045b94 fix(navigation): resolve response MIME before document commit
Classify a bounded response prefix before replacing the active Document. Replay original chunks exactly once through the shared raw-document pipeline, retaining raw headers separately from computed MIME. Apply the same decision to streaming, captured and complete child responses.

Keep the old owner running while MIME is undecided. Cancel provisional navigation on stopLoading, propagate transport errors and route unsupported content to downloads before reporting navigation success. Allocate streaming-response navigation state lazily.

Add 13 native regressions for split signatures, replay and observer ownership, cancellation, old-document liveness, inert text, computed metadata and binary text downloads. Make the existing NUL literal-text fixture explicitly nosniff, preserving its assertions, and separately cover browser-confirmed binary download behavior.

Validation: fmt; all-target/all-feature workspace clippy; 22634 nextest passes with 32 threads and zero retries; original WPT 245/251 retained plus 3/3 added coverage. Pinned Chromium controls verify 12 MIME cases and 38 commit phases, 32 navigation cases, 36 frame metadata cases and 5 binary text/nosniff cases. No new original-WPT passes are claimed. Response-stage MIME overrides, image document.open DOM and Blob child-origin gaps remain follow-up work.
2026-11-21 20:03:35 +08:00
ldm0 a7c870c35d fix(cdp): preserve renderer stream order before Runtime replies
Queue unconstrained replies behind earlier frozen output from the same
renderer stream. Keep exact load barriers when draining Runtime fences
and allow independent streams to advance without overtaking their own
output. Regress timer console ordering for root and child evaluate and
callFunctionOn through real flattened WebSockets.
2026-11-21 20:03:32 +08:00
ldm0 9a36a33a50 fix(runtime): reconcile native origin state after main rebase
Preserve shared document.domain state and retired-realm token invalidation
when initial document environments cross Page hosts. Restore the bootstrap
fallback state and cover retained auxiliary functions after navigation.

Remove duplicate interface registrations introduced by the overlapping main
changes and retain both existing and new interface regression modules.
2026-11-21 20:03:32 +08:00
ldm0 77977f8382 fix(dom): preserve adopted wrappers across isolated worlds 2026-11-21 20:03:31 +08:00
ldm0 cd65bf24de fix(dom): preserve native ownership across Page adoption
Move native subtrees while retaining wrappers, collections, styles, canvas resources, and event registrations. Resolve borrowed EventTarget methods through the native node owner and retain callback realms across adoption.

Add real CDP Page regressions for repeated adoption, native receiver validation, retained views, and closed producer realms. Validated with workspace fmt, all-target/all-feature Clippy, and 32-thread nextest (21695 passed, 16 skipped).
2026-11-21 20:03:31 +08:00
ldm0 455864dcc6 fix(navigation): preserve paused lifecycle ordering after main rebase
Use the upstream owner-settlement API and publish nested command output at
the shared completion boundary. Inspector callbacks can already publish the
pending prefix while an owner remains paused; fence the concrete published
tail even when settlement has no new batch. This keeps beforeunload output
ahead of navigation fetch without closing the suspended command recorder.

Include before-fetch messages and completion details in the existing
paused-navigation regression assertions, and format replayed imports.

Validation: cargo fmt --all; workspace/all-target/all-feature Clippy with
warnings denied; nextest 20,797 passed, 16 skipped, 32 threads, zero retries.
Both paused beforeunload regressions also passed 10 consecutive rounds.
2026-11-21 20:03:28 +08:00
ldm0 9e8aeca9ad fix(parser): adapt text document integration after rebase 2026-11-21 20:03:28 +08:00
ldm0 a659d544ec fix(navigation): reconcile paused lifecycle after main rebase
Run tree beforeunload from the existing Inspector scope so navigation can
start its request while the old script remains paused. Bind the active
Page per owner-task poll and preserve the beforeunload output prefix and
navigation fence without completing a suspended Runtime command.

Keep document-replacement termination pauses internal while preserving
real output and balancing pauses already reported to frontend sessions.
Keep intentional pagehide/unload callbacks debuggable during replacement.
Cover root/child lifecycle ordering, 204 recovery, resumable unload,
multiple sessions and cancellation between pause notification and loop entry.
2026-11-21 20:03:27 +08:00
ldm0 5218dd0acc fix(navigation): check renderer history traversals before fetching 2026-11-21 20:03:26 +08:00
ldm0 6a33dcbcac 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-21 20:03:26 +08:00
ldm0 a4797cf02d fix(navigation): defer unload until document replacement 2026-11-21 20:03:26 +08:00
ldm0 f7cdc7db3a 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-21 20:03:25 +08:00
ldm0 8cda7f9715 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-21 20:03:24 +08:00
ldm0 9ee1e8a336 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-21 20:03:23 +08:00
ldm0 632cf2b125 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-21 20:03:23 +08:00
ldm0 f76a7c0436 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-21 20:03:20 +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