Commit Graph
172 Commits
Author SHA1 Message Date
ldm0 359c32095a refactor(network): separate request updates from transport observations 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 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 7c7c130d19 refactor(diagnostics): publish only completed error reports 2026-11-20 01:52:30 +08:00
ldm0 936886a80d refactor(diagnostics): initialize one subscription per browser 2026-11-20 01:52:30 +08:00
ldm0 242bcffeca feat(runtime): publish completed exception reports 2026-11-20 01:52:30 +08:00
ldm0 c36b90fad4 refactor(runtime): use one unbounded diagnostics subscription 2026-11-20 01:52:30 +08:00
Noz Wu 31ec48b69d feat(runtime): expose uncanceled runtime failures 2026-11-20 01:52:30 +08:00
ldm0 a679836d3c fix(runtime): preserve diagnostic origin and script request identity 2026-11-20 01:52:30 +08:00
Noz Wu c687399bac feat(runtime): publish exception and script load diagnostics 2026-11-20 01:52:30 +08:00
ldm0 1a770232e5 refactor(devtools): isolate page DOM frontend modules 2026-11-18 19:09:35 +08:00
ldm0 2206f32f40 refactor(devtools): isolate optional runtime modules 2026-11-18 19:09:35 +08:00
ldm0 2c4f149c30 fix(devtools): close optional configuration gates
Compile renderer tests without DevTools and run the standalone consumer against a local fixture. Route Service Worker client notifications through WorkerNavigator in worker realms.
2026-11-18 19:09:35 +08:00
ldm0 3ce8ad6cd8 feat(devtools): make external renderer automation optional 2026-11-18 19:09:35 +08:00
ldm0 5d222fe043 feat(browser): align disabled web security with Chromium instance policy 2026-11-18 00:10:43 +08:00
ldm0 47399e4ec6 fix(files): prepare shared directory selections off the protocol thread 2026-11-16 19:42:47 +08:00
ldm0 ed9ad079c2 refactor(worker): own fetch and XHR loading natively
Give each load a stable native network handle and single-use interception ports. Keep Worker Promise settlement separate from network completion, route observations to Worker targets, and remove the parent request table and continuation messages.

Cover cancellation, streaming, request overrides, authentication, CSP and Service Worker responses. Keep the bucket-deletion test transaction active until retirement instead of racing its normal auto-commit.
2026-11-16 15:23:35 +08:00
ldm0 1a752c0181 fix(webdriver): preserve raw key locations in actions 2026-11-15 16:56:15 +08:00
ldm0 6d5e8580b0 fix(input): preserve keyboard event location through dispatch 2026-11-15 16:56:15 +08:00
ldm0 abcff16028 fix(fetch): limit idle waiting to initial page readiness 2026-11-15 00:48:02 +08:00
ldm0 9247282d21 fix(fetch): complete idle liveness and deadline enforcement 2026-11-15 00:48:02 +08:00
ldm0 03776063e6 feat(fetch): add event-loop idle wait mode
Wait for user timers, native async operations, dedicated workers, WebSockets and receiving MessagePorts using their existing resource owners and Page task sources. Finish a microtask checkpoint before observing exhaustion, drain terminal callbacks, and follow replacement navigations through the shared idle wait driver.

Apply the existing absolute timeout to idle readiness and recheck after automation scripts. Keep internal AbortSignal timeouts and transferable-stream plumbing from independently retaining the loop. Add CLI and native observer regressions.
2026-11-15 00:48:02 +08:00
Noz Wu 3a2dbae84a feat(core): expose renderer output transport sender 2026-11-14 23:49:01 +08:00
ldm0 1fc3848c6c fix(download): stream child-frame attachments with sandbox checks 2026-11-14 23:13:54 +08:00
ldm0 aae86aac05 fix(fetch): apply effective request overrides before fulfillment
Apply accumulated URL, method, upload and scoped-header edits before fulfilling a request. Share RequestOverrides with continuation and centralize pending request snapshot updates, so a later session fulfilling 307/308 retains the effective request body and relative-URL base.
2026-11-14 16:35:43 +08:00
ldm0 6206b093c4 fix(fetch): carry exact interception class sets
Adapt the class-set work from #2704 to native synchronous XHR from #2729. Keep URL, stage and session matching with protocol owners while excluding unrelated resource classes before native routing.
2026-11-14 02:56:32 +08:00
ldm0 dbaf8d0617 fix(xhr): process interception decisions before response body EOF
Expose ordinary controlled hop headers with a cancellable pending body so
response pauses, redirects and initial auth challenges can advance before EOF.
Share native capture with Fetch body reads and scoped IO streams; retire the
original transfer on fail, fulfillment or stream close without Page reentry.

Add body-gated Window/Worker and sync/async regressions and preserve resumed
XHR streaming. Drain two existing protocol fixtures through actual stream EOF.
2026-11-13 22:37:15 +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 e8ce829d88 fix(xhr): enforce exact interception URLs for synchronous requests 2026-11-13 22:37:15 +08:00
ldm0 7131157013 refactor(renderer): capture Page window identity before document creation 2026-11-13 22:16:31 +08:00
ldm0 129b8cf640 refactor(renderer): unify read-only HTML document exports
Route page HTML, JSON and MHTML through SerializeDocument options and keep Markdown on its own command. Stream live frame Documents into srcdoc without cloning or editing DOM state, and remove copy-specific helpers. Finish core commands consistently and retain paired document metadata across auxiliary trace serialization.
2026-11-13 19:26:46 +08:00
ldm0 1ed0e2238e fix(cdp): apply late request policy before commit projection
A newly committed native Document can execute before its commit output has
been projected into protocol state. Routing Fetch.enable through the
projected binding then updates a loaded predecessor or no Page at all,
allowing requests to bypass interception after a successful ACK.

Address restricted request-policy updates to the synchronously admitted
renderer Page and wait for native completion. Reuse this route for Fetch
cleanup and blocked URLs without granting general unbound Document access.

Hold actual native commit publications in the regression and inspect the
exact evaluation output fence. Cover new/replaced Pages with interception
enable/disable and blocked URLs, with no external I/O in negative controls.
The original controlled reproducer fails 3/3 on the rebase baseline.

Validation: fmt; workspace/all-targets/all-features Clippy; 23,026 Nextest
passed, 20 skipped; three targeted tests x20 and 30 module tests x5, all
without retries.
2026-11-13 01:42:40 +08:00
ldm0 b8190ee87d refactor(indexeddb): address SQL schema by stable IDs
Use the persisted StoreId and IndexId in SQL commands, transaction scopes and renderer handles. Reserve IDs without waiting for the SQL owner and recover their counters with committed disk metadata.

Remove name-based request targets, separate renderer identity tokens and cursor name refresh. Cover concurrent reservations, abort, idle reconnect, catalog recovery, restart, stale IDs and old-name reuse.
2026-11-13 01:39:46 +08:00
ldm0 03050ca66d fix(fetch): retain native service worker navigation requests 2026-11-12 20:10:31 +08:00
ldm0 e363e2d81d fix(cdp): retain protocol body projections across redirects 2026-11-12 20:10:31 +08:00
ldm0 b20ff14ff9 refactor(inspector): derive response IDs and make parsing explicit 2026-11-12 03:32:12 +08:00
ldm0 32e0dfce3a test(core): isolate streamed raw response deadline checks
Keep the raw Page rejection on its streaming entry point while the server
holds the body, without racing a 100ms response-header budget.

Move the body-specific deadline case to prepared streaming headers and the
real body materializer. Retain the 100ms budget and typed body phase, and
assert transfer cancellation and channel release.
2026-11-12 03:10:33 +08:00
ldm0 e87c00c2ac test(core): gate async Fetch and XHR responses 2026-11-12 02:01:08 +08:00
guojinghua afd5b8fae3 feat(ace): expose typed page tasks and browser runtime hooks
Add opt-in ace-protocol support with AcePageTask and PageExtensionHost
for renderer-owner-thread inspection, native input, and screenshots.
Expose BrowserRuntimeHandle through a runtime-ready callback so embedders
can discover targets and submit tasks without CDP request/response envelopes.

Reuse supervised page workflows for output ordering, input effects, and
target/document lifetime checks. Recover lost waiters without replaying
admitted tasks, and revoke runtime access on browser shutdown.
2026-11-10 20:26:30 +08:00
ldm0 0551e4afb7 fix(renderer): use shared dialog waiting mode for every Page
A VM created while dialog waiting was enabled cached that value locally. The
cached true value survived disabling or detaching the final Page observer,
so later dialogs could still wait after the shared context flag was false.

Read the BrowserContext shared switch for every dialog. Remove the VM-local
Boolean, its constructor snapshot, the ScriptVm/JsContextHost setters, and the
obsolete Page setter and renderer command. Page domain commands now rely on
the existing shared subscription aggregation.

Cover enabled-at-construction VMs and interleaved disable/detach across two
Pages and different sessions. Verify that confirm returns without a modal wait
while a native handler remains available to handle the prompt. Keep standalone
headless dialog fallback coverage through the shared switch.
2026-11-07 01:22:11 +08:00
ldm0 736dbc385b refactor(renderer): keep main-world initialization demand driven 2026-11-06 00:05:30 +08:00
ldm0 504b3fa816 perf(renderer): initialize document main worlds on first script demand
Keep the native Document and per-Page isolate live while deferring the main Window Context, V8 Inspector and wrapper templates. Activate through existing script and automation boundaries, preserve native lifecycle and history state, and provide an explicit eager initialization flag.
2026-11-06 00:05:30 +08:00
ldm0 cf79aa002d refactor(navigation): share document request execution
Reuse NavigationInterception for main, child-frame and auxiliary document requests, replacing the protocol-only PreparedNavigationRequest wrapper. Reevaluate main-document Fetch interception per redirect and share per-session hop identities.

Preserve Service Worker clients through response handling, publish source retirement before waiting for headers, and keep transport failures on the existing error-document path.
2026-11-05 04:20:11 +08:00
ldm0 b92221fecd fix(fetch): preserve child navigation interception across redirects 2026-11-04 22:18:04 +08:00
ldm0 de4cc98f47 fix(serve): preserve startup scripts across protocol lifecycles
Capture startup scripts before creating navigation engines and install them when each BrowserContext is created. Keep CLI scripts outside mutable protocol preload registries so engine resets and protocol removals preserve startup policy.

Pass complete runtime configuration through BiDi and Classic entry points. Add six regression tests covering protocol navigation, iframes, late contexts, new windows, preload removal and engine reset.

Validation: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast (22,197 passed, 20 skipped).
2026-11-03 07:13:38 +08:00
Neo 孫 686d9d6c57 fix(serve): honor --document-start-script in protocol-server pages
`moli fetch` reads configured document-start scripts straight from
BrowserConfig, but `moli serve` builds its pages from
NavigationRuntimeConfig, which never carried them, so the flag was a
silent no-op in serve mode.

- NavigationRuntimeConfig gains `document_start_scripts`, populated in
  From<&BrowserConfig>; the two exhaustive destructurings mark it as not
  engine state.
- BrowserContextState::bind_page_navigation_engines seeds each configured
  script into the context's default document-start registry (the same
  registry BiDi addPreloadScript uses), once per context.

Verified: unit test for the config hop; end to end, a script that
increments a counter reads 1 after each of two navigations (upstream
binary: script never runs).
2026-11-03 07:13:38 +08:00
ldm0 8b0701deeb fix(cookies): apply age-aware Lax-by-default request policy
Record and preserve cookie creation time across updates, browser imports and cache persistence. Apply modern Lax-by-default request inclusion, including the age-bounded unsafe top-level navigation allowance; keep explicit Lax and Strict semantics, raw cookie visibility and diagnostic exclusion reasons. Cover age boundaries, updates, imports, persistence and navigation contexts.
2026-11-02 11:09:13 +08:00
ldm0 244192dccb refactor(storage): remove unused cross-partition usage APIs 2026-11-01 05:19:55 +08:00
ldm0 a598b45216 refactor(storage): remove unused persistence APIs 2026-11-01 04:03:38 +08:00