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.
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.
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.
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.
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.
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.
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.
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.
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.
`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>
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.
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.
/json/protocol served V8's js_protocol verbatim (Schema, Runtime, Debugger,
Console, Profiler, HeapProfiler), while the dispatcher implements 29 more
domain groups (Page, DOM, Network, Target, Input, Emulation, ...). Clients
that gate calls on the advertised protocol refused commands Moli supports.
- Derive strum::VariantNames on the action enums the dispatcher parses
methods against, and expose moli_protocol::implemented_cdp_commands()
(domain -> wire command names). Generated from the implementation, so
it cannot drift.
- /json/protocol merges that list into the V8 schema once (OnceLock):
V8 domains keep full schemas and gain any missing command names;
Moli-implemented domains list command names only, with a description
saying parameter schemas are not published.
- The embedded CDP_PROTOCOL_JSON constant is unchanged, so
embedded_protocol_preserves_the_complete_vendored_schema still holds.
Tests: wire names (getFullAXTree, getDOMStorageItems, navigate; 29
domains) and the discovery endpoint test now asserts Page / DOM /
Network / Target / Runtime / Input and Page.navigate are advertised.
Reverting to the verbatim V8 schema fails it ("must advertise Page").
fmt and clippy -D warnings clean for both crates.
Keep the socket actor responsive while a context-targeted Runtime command waits for its Document. Retain the original host and session binding until admission can validate and dispatch in one finite owner turn. Cover close, replacement, navigation completion, session end and disconnect in standalone and Classic-attached BiDi, including exact-once responses and revoked identities.