Commit Graph
143 Commits
Author SHA1 Message Date
ldm0 7fa20ba1a5 fix(cookies): restore Secure cookies independently of source scheme 2026-11-01 04:57:03 +08:00
ldm0 843ddcc3f2 refactor(storage): retire protocol cookie profiles and close partitions once 2026-11-01 04:03:38 +08:00
ldm0 5e6482996e feat(storage): open Cookie and localStorage databases on first use 2026-11-01 04:03:38 +08:00
ldm0 b5cf04a307 refactor(storage): switch SQLite namespaces without JSON migration 2026-11-01 04:03:38 +08:00
ldm0 4649cb1256 feat(storage): use partition SQLite cookies and localStorage by default 2026-11-01 04:03:38 +08:00
ldm0 dc75f53ea9 test(cdp): arm prepared document.open after parser EOF
Start the held Fetch from interactive readystatechange so the fixture establishes its intended defer-wait boundary. A speculative script request is not an EOF signal. Retain both normal/crashed modes and every history, adoption and result assertion without changing timeouts or retry policy.

Validation (32 build jobs / test threads, zero retries):

- `cargo fmt --all`
- `cargo clippy --workspace --all-targets --all-features -- -D warnings`
- `cargo nextest run --no-fail-fast`: Summary [ 140.487s] 22001 tests run: 22001 passed (9 slow), 19 skipped
2026-10-31 18:55:48 +08:00
ldm0 69bd05662d test(protocol): serialize shared cookie checkpoint writes 2026-10-30 20:27:08 +08:00
ldm0 045041566f fix(storage): use temporary disk backing without a profile 2026-10-30 15:53:29 +08:00
ldm0 907a27de0c fix(cdp): preserve prepared documents when enabling Page
Page.enable must acknowledge a native Document that is already running while protocol Page adoption waits for resources. Reuse the prepared-document lifecycle state instead of starting another lazy initial navigation, which can revoke the existing work and deadlock behind Fetch interception. The regression holds a script response, enables Page before adoption, verifies the original paused Fetch remains valid, and checks the final URL for both normal and crashed targets.
2026-10-30 04:14:12 +08:00
ldm0 9c71de3c9c fix(protocol): keep history stable across document.open
Use Page residence and the stable Document token to deduplicate native
history registration and Page adoption. Keep lifecycle epochs in native
execution and cancellation identities. Adopt a restarted epoch's reply
title instead of retaining a title published by its predecessor epoch.

Cover asynchronous document.open/write/close before DCL on reused and
crash-recovery Pages, checking history length/index and replacement
content/title without requiring unchanged entry ids.
2026-10-29 17:39:23 +08:00
ldm0 922419d5b2 fix(protocol): complete prepared Document policy and retirement
Dispatch late Fetch configuration and blocked URLs to the exact running native
Document before Page adoption. Apply admitted title facts to the published
history entry before later pushState operations can create another entry. The adoption path
retains the reply's exact Document identity even before native commit projection,
so journal and reply arrival order cannot register the same history entry twice.

Retire failed debugger-paused Worker targets and sessions when their prepared
owner is superseded, even after native destruction has already been deferred.
A new native commit also ends that deferral; stale Page destruction cannot
start it again. Reuse the existing retirement and session disposal paths.

Cover reused and crash-recovery Pages with four WebSocket regressions. Hold
response headers to enforce policy/title phases and require Worker retirement
before the replacement Document can commit.
2026-10-29 17:39:23 +08:00
ldm0 8087e48649 refactor(protocol): simplify Fetch dispatch and workflow state
Carry matching completion data in each Fetch operation instead of storing a
parallel dispatch kind. Restrict navigation termination to document work and
require native completion results directly, removing impossible fallbacks.

Move one owned workflow payload through execution, cancellation and recovery.
Derive renderer commit observation from its captured native Document.

Wait for the recovered session/frame/loader load in the cancellation integration
test before querying the new realm; a navigation ACK can precede Page adoption.
2026-10-29 17:39:23 +08:00
ldm0 804bf1e357 fix(protocol): preserve native Document work before Page adoption
Capture weak command capabilities for the exact native Document behind early
Fetch pauses. Use them for request, response, authentication and cleanup work,
and restore pause records when dispatch is rejected.

Carry publication Page sources through owner-action projection. Register and
attach workers during handoff, revoke abandoned Page workers, and preserve
source identity for dialogs, choosers, popups and script navigation.

Record native navigation history once, retain observed URLs and titles at
adoption, and publish error-Document failure before its frozen frame commit.
Add controlled WebSocket regressions for handoff, cancellation and recovery.
2026-10-29 17:39:23 +08:00
ldm0 34bd52d306 fix(cdp): share nested target session routing policy 2026-10-29 17:39:23 +08:00
ldm0 2e5bcc6fc8 fix(cdp): preserve non-flat target session output routing 2026-10-29 17:39:23 +08:00
ldm0 7192c36264 refactor(protocol): simplify state access and dispatch 2026-10-29 17:39:23 +08:00
ldm0 06fcf9d91e refactor(protocol): finish synchronous owner migration
Run CDP, BiDi, Classic and test workflows through finite synchronous state
access and revocable weak handles. Remove the mailbox, Inline driver,
exclusive completion branches and unused Fetch/Runtime connection APIs.

Keep original document, attachment and call identities through owned waits.
Preserve terminal responses for retired documents, settle empty renderer
boundaries and retain Fetch request announcements until terminal delivery.
Keep body/resource I/O outside shared state and preserve typed error causes.

Validation: cargo fmt --all; full workspace/all-targets/all-features Clippy;
21,456 Nextest tests (19 existing skips); five ownership doctests; same-source
CLI with Playwright, Puppeteer and CDP/BiDi/Classic workflow checks;
1,024 complete navigations; 128 cancelled waits and 4,096 peer commands.
2026-10-29 17:39:23 +08:00
ldm0 acdbc9587e refactor(protocol): unify automation admission and own preload workflows
Admit finite commands synchronously and route every asynchronous automation
command through the existing controller. Remove the server's duplicated
owned-command selector and exclusive-connection fallback. Restrict the old
automation and Runtime/Page inline entry points to the test harness.

Prepare desired preload registries before waiting and retain each original
host and Document for ordered Native updates. Reuse target preload/channel
execution and completion-owned recovery without adding task registries.

Pass actual ingress receivers into BiDi realm, layout and frame inventories.
Keep their accepted output prefixes in the original command's event sources;
perform context and target descriptor inventories synchronously.

Preserve original pending navigation replies from admission queries and realm
replay before projecting subscription events. Give the header-only network
baseline fixture its own URL so late baseline events cannot select the
collector request. Keep the original body and success assertions.

Validation: cargo fmt --all; default CLI Clippy; workspace all-targets
all-features Clippy with -D warnings; cargo nextest run --no-fail-fast
(21,413 passed, 19 existing skips); five protocol doctests.
2026-10-29 17:39:23 +08:00
ldm0 97928d1dd5 refactor(protocol): own automation configuration and cookie workflows
Run Browser permission, Storage and Emulation automation commands through
one shared supervised workflow and typed result owner. Prepare policy and
Native work synchronously, wait outside protocol state, then adopt results
in finite state turns. Remove the old family-specific async wrappers and
share the Emulation completion logic with CDP.

Keep original Page host and binding authority beside each receipt. Freeze
cookie owner routing and defaults across target activation, reject writes
into recreated contexts, and retain native error sources until transport
projection. Preserve the Runtime output and cancellation contracts.
2026-10-29 17:39:23 +08:00
ldm0 39e6d90ab1 refactor(runtime): run automation commands as owned async workflows
Move all six neutral Runtime commands, including target/realm lookup,
node materialization, channels and locateNodes, into one ordinary async
workflow using finite state access and the existing command supervisor.
Remove the duplicated preparation/completion and server deferred-reply loops.

Keep the original Page/host/binding authority, typed result, accepted output
and cancellation with their command owner. Recover failed Native output
before adoption, hand channel listeners over at script admission, and release
temporary locateNodes object groups on cancellation. Classic and BiDi use
the same owned wait and move-only completion receipt.

Validate direct-owner before-poll and held-Promise cancellation, ready loss,
recreated hosts, channel progress, context close and actual Native proxy
release. Run root fmt, full workspace Clippy and Nextest, doctests and the
same-source CLI, Playwright, BiDi and Puppeteer suites before committing.
2026-10-29 17:39:23 +08:00
ldm0 646d0206a5 refactor(protocol): route Target transports through ordinary command tasks
Decode legacy Target messages into ordinary commands with their real session,
renderer policy, cancellation and global reply route. Restore nested replies
for both immediate and background navigation completion without leaking ids.

Replace the raw command loop and exclusive Target execution body with the
shared owned command workflow. Retain accepted replies and renderer fences
across cancelled waiters and discarded state replies, and clear retired Fetch
lifetimes when the same in-flight entry transfers to protected recovery.
2026-10-29 17:39:23 +08:00
ldm0 835d08b590 refactor(page): own command waits and finite completion
Run Page composite commands in the existing supervised command workflow.
Prepare preload, stop, crash and close ownership at admission; keep native
waits outside state access and complete finite commands synchronously.

Share owned navigation commit, streaming response and retirement logic with
Fetch. Preserve current, nested and background navigation reply ownership,
including accepted terminals during later waits, cancellation and ready loss.
Keep stop cleanup scoped to its original request and retain crashed Pages
before awaiting shutdown.

Remove the child-navigation Owned/Inline split, redundant world phases and
old exclusive Page completion/activation wrappers. Carry typed native errors
and use finite state operations for output, attachment and listener updates.

Keep original Native child facts routable through the unbound Document
handoff without granting business access. Preserve their exact Document tree
through adoption and use the captured owner for events and response bodies
when foreground selection changes.

Validate controlled renderer-held peer progress and recovery, successor
navigation ownership, stale world attachments, full workspace checks, source
CLI compatibility, Playwright, Puppeteer and parallel targeted stress. Replace an old stylesheet fixture clock check with
a script-released CSS gate while preserving the parser/DOM ordering checks.
2026-10-29 17:39:23 +08:00
ldm0 ef4907475a refactor(target): own complete auto-attach policy workflows
Supervise existing-target sweeps, tab-child attachment and disable cascades in
the original command workflow. Keep initial Documents, binding updates and
session disposal waits outside connection borrows. Remove the old exclusive
sweep and detach loops; compatibility callers reuse the same async flow.

Retain installed policies by weak allocation identity so retired sweeps cannot
attach after disable, replacement or owner closure. Keep provisional sessions
in the original rollback transaction, remove actual commit receipts, and retain
recovery through waiter cancellation and discarded ready results.

Keep independent Page output on its original FIFO while completing the Browser
policy reply. Resolve provisional primaries through their exact Page source
until the frontend route commits, preserving existing sessions' responses.
Restrict retired frontend-release wrappers to tests and preserve typed
initial-Document error causes.

Run the BiDi slow-image HTTP fixture independently of the protocol executor,
retaining its original one-second completion budget and load assertions.

Validate controlled Native holds, synchronous XHR peer progress, replacement
policies, cancellation, ready loss and output order. Run required workspace
checks, parallel stress, and Playwright/Puppeteer against the current CLI.
2026-10-29 17:39:23 +08:00
ldm0 7b6530bf77 refactor(target): own creation and attachment completion waits
Run Target.createTarget and Target.attachToTarget completion in the original
supervised command workflow. Keep initial Document installation, binding
updates, surface activation, initial navigation and rollback outside connection
borrows, and reuse that flow in exclusive compatibility callers.

Commit the attachment in the consuming owner turn so a target or parent that
started closing cannot gain a late session. Retain newly admitted rollback in
the original command recovery scope and preserve attached-event-before-reply
ordering through cancellation and discarded ready results.

Box composite waits at their invocation boundaries to keep the legacy actor
stacks bounded. Remove obsolete exclusive background-surface, initial-navigation
and uncommitted-session-disposal wrappers. Preserve Native binding output fences;
use the actual session registry for primary and attached bindings.

Validate controlled Native holds, ready-loss and closing interleavings, an
explicit WebSocket synchronous-XHR gate with peer progress, full workspace
checks, parallel stress, and real clients against the source-built CLI.
2026-10-29 17:39:23 +08:00
ldm0 cf65787bdd refactor(runtime): own production command completion waits
Route production scheduler command completion through finite state access and
owned workflows. Move Page Inspector response and Runtime.disable binding waits
outside connection borrows, retaining the original deferred-reply registry,
renderer correlations, output fences and command recovery context. Reuse the
same completion flow in compatibility callers, including Worker completion.

Make protocol-local DOMStorage flushing synchronous and remove its private
prepared payload/slot pipeline and obsolete async projection wrappers. Preserve
typed Native binding failures and their source context. Fence child lifecycle
observation against output already published before its ready response,
without widening unrelated command response boundaries.

Synchronize await correlation snapshots with renderer lease rotation and
consumption so context teardown retires the current call.

Use one async I/O worker per CLI HTTP fixture rather than a CPU-sized pool
in each parallel test process. Keep existing timeout and behavior assertions.

Validate held Native progress, cancelled waiters and lost ready replies, full
workspace checks, protocol doctests, parallel stress, and the source-built CLI
with explicit Worker promise barriers across three Worker types and two clients.
2026-10-29 17:39:23 +08:00
ldm0 952bc98cbb refactor(protocol): supervise remaining scheduler owner workflows
Run main-document lifecycle and download emission plus popup navigation through the existing owner-work supervisor. Retain each exact load interest in the scheduler queue until output handoff, and remove the adapter's private load tasks and completion channel.

Limit production ready-work completion to finite observations. Reuse the renderer navigation workflow and fenced output finalizer for compatibility callers. Classify explicit child frame navigation by its original owner instead of attachment observation timing, preserving Native validation and the parent document.

Validation: root cargo fmt, full workspace Clippy, full Nextest and protocol doctests; source-built CLI compatibility and controlled popup replacement and independent load/cancellation scenarios; parallel stress of owned output and child navigation.
2026-10-29 17:39:23 +08:00
ldm0 a028ac0de8 refactor(protocol): own Page output projection and navigation handoffs
Run complete Page and Worker publications in supervised async workflows with finite state access. Keep each original cursor and Runtime FIFO reservation until output handoff, and remove the duplicate renderer ingress and slot drivers.

Reuse owned Fetch continuations, popup and initial-document installation, navigation and close workflows. Preserve exact load dependencies, independent Native fences, Input automation predecessors, and cancellation output before replacement load. Retain released Runtime output in its existing route FIFO and retire closed Page resources only after their original output tail is projected.

Validation: root cargo fmt, full workspace Clippy, full Nextest and protocol doctests; source-built CLI compatibility, history/Fetch, real clients and worker lifecycle smoke; parallel stress of the observed races.
2026-10-29 17:39:23 +08:00
ldm0 1bef4725c6 refactor(protocol): own natural worker projection and shared task progress
Keep SharedWorker and ServiceWorker publication cursors outstanding until their retained output is handed off once. Run cleanup and binding replay as ordinary async workflows through finite state access; share the same business bodies with Page retirement and existing projection callers.

Move owner-work supervision from the CDP actor into the common scheduler. Cursor waits continue processing state operations and task terminals, and background navigation stays Running through its final publication. Store Runtime output barriers on the connection, reserve each active route projection's FIFO position, and make finite projection leaves synchronous.

Validation: cargo fmt --all; full workspace/all-targets/all-features Clippy with -D warnings; root Nextest (21,034 passed, 19 skipped); five state-access doctests. Fixed-source CLI checks cover Fetch continuations, Playwright, BiDi, all three Worker runtime kinds, natural and command-driven Worker retirement, and background navigation metadata.
2026-10-29 17:39:23 +08:00
ldm0 96ffdbfdfa refactor(protocol): own runtime helpers and popup activation waits
Run internal Inspector helpers and realm inventory through finite state
operations, preserving native error causes and the original session, host,
Page and renderer-call identities through completion and cancellation.
Separate navigation Page installation from retirement of the previous Page.

Route popup activation through the existing supervised owner-work path. An
activation waiting on a pending Document commit now leaves the actor free to
consume that commit and discovery control requests. Reuse the same native
wait and terminal output after cancellation or ready-result loss.

Make CLI readiness regressions wait for the initialized successor DOM and
exercise a shared deadline with stages that each fit a fresh budget, including
a direct-load success control and exact timeout-phase/output assertions.
2026-10-29 17:39:23 +08:00
ldm0 0380308056 refactor(protocol): own Fetch navigation and cleanup workflows
Keep intercepted document requests, authentication, captured responses and native
commit/adoption in ordinary async workflows with exact navigation ownership.
Move child lifecycle waits and Fetch.disable cleanup out of actor completion,
retain source response obligations through cancellation, and preserve ACK timing.

Prepare owned session policy/script/worker cleanup and a synchronous state owner
with weak handles and compile-time borrowing constraints. Retain explicit legacy
inline drivers until disposal, frontend control and adapter paths migrate.
Preserve typed error contexts and share the inline Fetch driver with BiDi adapters
so they cannot wait on their own unserviced state mailbox.

Validation: cargo fmt --all; complete workspace Clippy with all targets/features
and warnings denied; root nextest 20,941 passed, 19 skipped; protocol doctests
1 positive and 4 compile-fail cases passed.
2026-10-29 17:39:23 +08:00
ldm0 35d808c00b refactor(protocol): own prepared navigation commit waits
Separate synchronous renderer commit admission from owned reply waits and exact Page adoption. Supervise prepared-document commits in the existing navigation owner, preserve native commit visibility and reject superseded replies and cleanup.

Service finite state requests in CDP, BiDi and Classic drivers while legacy connection ownership is retained. Share wait supervision with command dispatch and decode Fetch disable acknowledgements without refreshing a replacement Page.

Validation: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast (20918 passed, 19 skipped); 12 CLI CDP scenarios and Playwright routing smoke passed.
2026-10-29 17:39:23 +08:00
ldm0 f3f34ac30c refactor(fetch): own navigation waits and revoke retired handler work
Move response-header and authentication-body waits out of connection-owned
completion processing. Retain command context and output permits across pending
rounds, and capture owned request inputs with exact navigation cancellation.

Keep the source navigation response obligation when its Fetch frontend exits.
Revoke unfinished waits and queued successes when a handler is disabled, without
reviving old work on re-enable. Authorize failed-page cleanup using the exact
request, protocol Page residence, and renderer Page identity.

Validation: cargo fmt, full workspace Clippy with warnings denied, and complete
Nextest (20,908 passed, 19 skipped). Also verified 343 focused regressions,
controlled CLI before/after cases, 12 CDP smoke scenarios, and Playwright routing.
2026-10-29 17:39:23 +08:00
ldm0 0c765c19f8 fix(fetch): avoid deadlocks when continuing intercepted documents
Reuse streaming response background navigation after request and authentication interception so parser-blocking scripts can progress without wedging other CDP clients. Cover document-only and all-request interception with authentication handling on and off. Fixes #2006.
2026-10-29 17:39:23 +08:00
ldm0 863f997a99 refactor(protocol): publish frame facts independently of CDP subscriptions
Maintain Frame identity and lifecycle facts without Page observer flags. Project
CDP notifications separately, replay existing BiDi contexts from the core index,
and capture detached subtrees before teardown. Cover the public behavior against
Chrome and update event-based fixtures to subscribe or observe renderer state.
2026-10-29 03:28:47 +08:00
ldm0 422ab481fc refactor(protocol): share frame ownership through a canonical index 2026-10-29 03:28:47 +08:00
ldm0 d4f4a27d32 refactor(protocol): unify document lifecycle facts across projections 2026-10-29 03:28:47 +08:00
ldm0 db0e4923d4 fix(bidi): isolate iframe request IDs and initialize first subscriptions 2026-10-29 03:28:47 +08:00
ldm0 678a726145 fix(bidi): preserve background iframe event ownership 2026-10-29 03:28:47 +08:00
ldm0 7b94c7459e fix(storage): honor BiDi cookie partition descriptors 2026-10-28 19:32:35 +08:00
ldm0 dda02d5e11 fix(storage): preserve cookie identities in BiDi deletion 2026-10-28 05:54:01 +08:00
ldm0 62d12aa353 fix(modules): snapshot the current Document completion owner
Extracted from wpt-misc-fix (31bc1e27d59e).

Validation: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast (32 build jobs / test threads).
Summary [ 120.444s] 20908 tests run: 20908 passed (9 slow), 19 skipped
2026-10-27 06:21:09 +08:00
ldm0 ede9b19f82 fix(webdriver): generate UUID v4 Classic session IDs 2026-10-27 00:54:20 +08:00
ldm0 f12f497bf1 feat(cdp): expose Moli version in discovery
Read the CLI package version at build time and publish it as Moli-Version in /json/version. Verify discovery and CLI version consistency.
2026-10-23 15:56:41 +08:00
ldm0 d0f8c2b924 perf(protocol): declare routes once with a trailing-slash layer
Declare each protocol path once and normalize supported trailing slashes
before Router matching. Generate the final-parameter compatibility aliases
needed for empty captures and preserve queries, request contents, discovery
paths and method errors. Registered matches fall from 131 to 76.

Resolve Router state before creating the outer make-service so new
connections clone the completed service. Cover aliases, shared sessions,
POST bodies, request preservation and method-not-allowed responses.

Validation on the unchanged final source tree: cargo fmt --all;
cargo clippy --workspace --all-targets --all-features -- -D warnings;
cargo nextest run --no-fail-fast (20,505 passed, 18 existing skips).
2026-10-21 23:16:23 +08:00
ldm0 8942523b9e fix(inspector): make debugger pauses opt-in at session creation 2026-10-21 19:20:21 +08:00
ldm0 c55bd183fe refactor(cdp): dispatch browser close through normal frontend routing
Send Browser.close through the ordinary command channel and Router session
validation before handling it in the protocol actor. Route its response through
the existing pending-command table and confirm writer flush before submitting
InstanceCommand::Shutdown, without scheduling renderer work.

Remove the socket shortcut, CdpFrontendSessionLookup, and shared Arc/Weak routing
state. Inject one instance control handle into both server admission and owner
lifecycle, keeping native shutdown on the same state.

Cover response ID/session restoration and route consumption; retain failed
flush, invalid/foreign session, pending-promise, and instance cleanup coverage.
2026-10-20 20:47:16 +08:00
ldm0 9464659788 refactor(server): route browser shutdown through instance control
Expose protocol-independent InstanceCommand and BrowserInstanceControl with a
native serve_with_control entry. Keep shutdown coordination in the server and
CDP session validation and response flush in a dedicated adapter, bypassing
renderer work without creating another actor or shutdown state.

Parse each CDP envelope once and check live frontend-owned session routes
through a weak registry view. Match Chromium Browser.close on browser, page,
tab, and worker sessions; ignore params and reject null or foreign session IDs.
Update optional-session test requests to omit absent routes.

Add native and pending-promise lifecycle regressions and cross-engine smoke
coverage for acknowledgment ordering, natural process exit, and isolation.
2026-10-20 20:47:16 +08:00
BibekPathak 6ce547ed8e test(cdp): verify Browser.close process exit and profile reopen 2026-10-20 20:47:16 +08:00
neng c99d2914c7 Support instance-scoped CDP Browser.close shutdown 2026-10-20 20:34:45 +08:00
ldm0 992b9f1104 feat(window): expose native BarProp objects and popup visibility 2026-10-13 14:55:08 +08:00