Commit Graph
216 Commits
Author SHA1 Message Date
ldm0 86f5f3d6ff test(cdp): bind failed navigation lifecycle to its document commit 2026-10-01 22:48:27 +08:00
ldm0 5c19ed1006 refactor(dom): resolve attribute references in the renderer handler 2026-10-01 16:51:46 +08:00
ldm0 eb2d679e44 refactor(automation): name semantic commands and renderer CDP calls 2026-10-01 16:51:46 +08:00
ldm0 f2cd0fd488 refactor(cdp): pass preload commands directly between phases 2026-10-01 16:51:46 +08:00
ldm0 4a5e28d119 refactor(test): share CDP completion with renderer events 2026-10-01 16:51:46 +08:00
ldm0 cb28d957e1 refactor(cdp): share CSS inventory notification payloads 2026-10-01 16:51:46 +08:00
ldm0 30b7d61eb4 refactor(cdp): project native terminals with other renderer records 2026-10-01 16:51:46 +08:00
ldm0 0b892ccb59 refactor(cdp): reuse Emulation admission and transient failures 2026-10-01 16:51:46 +08:00
ldm0 e36271e0d0 refactor(cdp): let preparation select supported native commands 2026-10-01 16:51:46 +08:00
ldm0 7cef1b4e51 refactor(cdp): remove single-variant DOM and AX work wrappers 2026-10-01 16:51:46 +08:00
ldm0 117dce412b refactor(cdp): share node lookups with explicit chain execution 2026-10-01 16:51:46 +08:00
ldm0 6e30806c72 refactor(cdp): register remote objects from the terminal payload 2026-10-01 16:51:46 +08:00
ldm0 0c3b9cd6d3 refactor(cdp): format native replies without adapter output plans 2026-10-01 16:51:46 +08:00
ldm0 75b191092d fix(cdp): keep DOM agent commands available while paused 2026-10-01 03:33:13 +08:00
ldm0 f62894ec3c refactor(cdp): publish Emulation replies with exact replay ownership
Use the shared frontend admission and native terminal path for renderer
configuration. Keep Browser replay policy on its captured owner, record
admitted idle state, and project a fallback only if publication lost.

Verify mixed native replies precede later Inspector replay and that
isolate-entering configuration waits for the suspended owner to resume.
2026-10-01 03:33:13 +08:00
ldm0 69b3f96239 refactor(cdp): publish DOM and debugger replies with ordered state updates
Migrate node queries, edits, focus, files, remote objects, DOMDebugger and
Autofill to renderer-owned terminals. Freeze document notifications and
object registry updates at the producer boundary, preserve object aliases,
and keep isolate-entering lookup chains on the owner turn.
2026-10-01 03:33:13 +08:00
ldm0 44011a899c refactor(cdp): publish CSS and accessibility replies at the renderer
Run native lookups and bounded continuations through the shared terminal
path. Publish stylesheet inventory notifications before ready responses,
and preserve exact owner routing in direct Page test fixtures.

Use the parsed fixture and stylesheet notification boundary to verify
Page and CSS commands preserve their independent isolate-entry requirements.
2026-10-01 03:33:13 +08:00
ldm0 a18314640a refactor(cdp): publish native terminals through the renderer journal
Share terminal authority with Inspector and publish ready native replies
after their renderer facts, independently of adapter polling. Keep typed
internal completions separate and settle caches against the exact residence.

Define exhaustive backend entry requirements for nested Main dispatch and
release Main and IO admission at backend entry. Bind native continuations
and preserve their owner lifecycle before terminal projection.

Migrate Page and DOMSnapshot through the generic operation boundary,
including live tree URLs, initial DocumentLoader identity, document capture
and isolated worlds. Cover cancellation, retirement and pause ordering,
and release held popup fixture routes before awaiting initialization.
2026-10-01 03:33:13 +08:00
ldm0 89863e976c fix(cdp): replay Runtime notifications before enable responses
Publish existing contexts, console messages and exceptions before the
Runtime.enable terminal for pages and workers. Check the enable boundary
without a compensating command, and retain deferred reply progress.
2026-10-01 03:33:13 +08:00
ldm0 ce2edbb9e1 fix(mime): unify JSON/font types and response header extraction
Accept text/json for JSON modules and use one is_json_mime classifier across
modules, documents, JSONPath, and resource inspection. Remove the module and
document aliases and recognize the seven registered application font types.

Use Fetch MIME extraction over the complete Content-Type header list for
script/style checks, workers, WebAssembly, ORB, and JSONPath. Derive classic
script charsets from the same MIME record, including charset inheritance and
resets when the MIME essence changes, while preserving BOM and fallback order.

Cover valid and invalid MIME types, header ordering, combined fields, quoted
commas, nosniff, and charset selection with regression tests.

Validation:
- cargo fmt --all
- cargo clippy --workspace --all-targets --all-features -- -D warnings
- cargo nextest run --no-fail-fast: 19,005 passed, 16 skipped
- Focused WPT: Moli passes 9 cases / 261 subtests, including the three JSON
  regressions and all 31 script Content-Type extraction checks.
2026-09-29 23:17:46 +08:00
ldm0 fcfc477212 fix(cdp): normalize empty target creation URLs
Normalize an empty Target.createTarget URL to about:blank before constructing the renderer command so initial target metadata and navigation state agree. Regression coverage exercises default and browser-context target creation.

Validation: all branch checks passed. Summary [ 115.491s] 18922 tests run: 18922 passed (9 slow), 16 skipped
2026-09-29 18:25:21 +08:00
ldm0 83a78cf6e3 fix(document): decode main XML responses before parsing
Keep network XML response bytes intact through the existing raw-body renderer
path. Decode both network and external XML bodies with the shared response
decoder, then install the selected encoding before document bootstrap.
Remove the obsolete ready-body capture variant used by the old XML path.

Cover matching main-document and iframe text, namespaces, and characterSet for
Atom, RSS, and text/*+xml responses with Windows-1252 headers, XML declarations,
and UTF-16LE/BE BOMs. Exercise the external input as single-byte chunks and
verify that BOMs override a conflicting transport charset.

Validation:
- Before the fix, the network regression returned caf� / UTF-8 instead of
  café / windows-1252.
- cargo fmt --all
- cargo clippy --workspace --all-targets --all-features -- -D warnings
- Six focused XML tests passed.
- NEXTEST_TEST_THREADS=8 cargo nextest run --no-fail-fast:
  18,954 passed, 16 skipped.
2026-09-29 18:01:12 +08:00
ldm0 a3af75845d fix(document): preserve inherited encoding and XML MIME routing
Keep valid inherited text encodings ahead of heuristic detection while
preserving BOM, transport charset, and JSON default precedence. Share the
response decoder between streaming main documents, asynchronous child
loads, data URLs, and blocking child snapshots.

Classify navigation XML MIME types independently of DOMParser's allowlist,
including +xml subtypes in parser routing and text exclusions. Add
regressions for inherited UTF-8, literal encoding declarations, XML
namespaces, and DOMParser rejection of navigation-only XML types.

Validation:
- cargo fmt --all
- cargo clippy --workspace --all-targets --all-features -- -D warnings
- NEXTEST_TEST_THREADS=8 cargo nextest run --no-fail-fast
  18,952 passed, 16 skipped. Two existing timing tests failed under the
  default concurrency, then passed individually and in the full run above.
2026-09-29 18:01:12 +08:00
lanyue-llk 9d236a20ef fix(parser): preserve text document MIME and encoding semantics 2026-09-29 18:01:12 +08:00
ldm0 91a4480b8a fix(protocol): retain navigation ownership during response body reads
Keep request identity and cancellation in Fetch while read tasks exclusively own response data. Match completions to the registered read instead of reinserting transfers or replying to navigations from I/O completion.

Retire superseded reads immediately, drain reads on Fetch disable, and preserve typed read errors. Cover delayed successes, failures, request reuse, cancellation, and debugger-paused supersession.
2026-09-29 02:50:43 +08:00
ldm0 b406d462a5 test(network): activate blocked URL policy in parser script fixture
Enable Network before setting blocked URLs so the parser script is intercepted instead of depending on an external DNS or request failure. Wait through the scheduler and assert the exact script request fails with ERR_BLOCKED_BY_CLIENT while subsequent parsing continues.

An earlier full-suite run exposed the timeout. Validation after the fix: 20 exact-test stress iterations and three iterations of the 20-test blocked_urls module, all passing with flaky results treated as failures; cargo fmt --all; full workspace all-target all-feature Clippy with -D warnings; cargo nextest run --no-fail-fast (18833 passed, 16 skipped).
2026-09-29 02:36:54 +08:00
ldm0 3289d5b4c3 fix(scheduler): let replacement navigation pass load-blocked work
Centralize navigation dependency decisions for readiness probing and snapshot draining. Replacement actions can reach the owner that cancels the pending request even when earlier observations wait for that load, while exact owner authorization remains mandatory.

Keep retirement admission policy beside publication ownership. Extend coverage for stale owners, cancellation, reused frontend ids, duplicate terminals, and late results without reviving retired notifications or remote objects. The new queue regression fails before the scheduler fix.

Validation: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast (18833 passed, 16 skipped on the final change set).
2026-09-29 02:36:54 +08:00
ldm0 255238328f fix(protocol): retire superseded intercepted navigations
Only the current navigation can suspend renderer output; older jobs retain cleanup ownership without blocking the active document.

Retire target-owned request, auth and response interceptions on supersession, cancel streaming transports and reject stale body-read completion. Cover paused debuggers, overlapping navigations, target isolation and once-only terminal replies.
2026-09-28 20:11:15 +08:00
ldm0 94ac141e7c refactor(protocol): simplify renderer navigation state 2026-09-28 20:11:15 +08:00
ldm0 efe54b5fa7 fix(navigation): preserve typed cancellation causes 2026-09-28 20:11:15 +08:00
ldm0 f0a82869f0 refactor(protocol): claim navigation work before reserving pages 2026-09-28 20:11:15 +08:00
ldm0 c4d0cac89a refactor(renderer): own document replacement debugger lifecycle
Move old-document debugger termination into renderer preparation scopes instead of tracking protocol navigation IDs in DevTools. Reject superseded response jobs using exact navigation tokens and cancellation authority, and retire their renderer-channel suspension independently.

Cover response interception and supersession while paused, repeated pauses, and prepare commit/cancellation/drop cleanup. Verified cargo fmt --all, workspace all-targets all-features clippy with warnings denied, 18444 nextest tests, and 20 stress iterations of 127 focused tests.
2026-09-28 20:11:15 +08:00
ldm0 79ea1406fa fix(devtools): unblock navigation while the debugger is paused
Track provisional loads by navigation ID on the existing renderer target and explicitly finish debugger policy on commit or cancellation. Return the pause-loop exit reason and terminate paused old-document execution through V8 Inspector.

Defer intercepted-response document creation until continuation, removing the eager prepared-document paths. Preserve committed documents for aborted navigations and cover repeated pauses, multiple sessions, interception and supersession.

Validated cargo fmt --all, strict workspace clippy, and cargo nextest run --no-fail-fast: 18,429 passed, 13 skipped. New regressions also passed 20 stress iterations and three confirmed debugger-paused ippure navigation probes.
2026-09-28 20:11:15 +08:00
ldm0 bec8ccf87d Split runtime fetch tests by scenario 2026-09-28 18:40:05 +08:00
ldm0 b050a31e96 Split background staging tests by concern 2026-09-28 18:40:05 +08:00
ldm0 2dc8e22741 Split DOM protocol handling by command phase 2026-09-28 12:27:20 +08:00
ldm0 6a3859fc18 Split worker target projection by worker kind 2026-09-28 12:27:20 +08:00
ldm0 e19590cbbf Split Runtime evaluate tests by behavior 2026-09-28 12:27:20 +08:00
ldm0 a47b30ae5e test(protocol): split Page navigation tests 2026-09-28 00:14:19 +08:00
ldm0 8bfd5aca16 refactor(protocol): split Page domain responsibilities 2026-09-28 00:14:19 +08:00
ldm0 c92e8c60bc refactor(protocol): split runtime evaluation modules 2026-09-28 00:14:19 +08:00
ldm0 c82dfce9bd test(protocol): split connection dispatch tests 2026-09-28 00:14:19 +08:00
ldm0 b414c927a4 refactor(protocol): split runtime dispatcher responsibilities 2026-09-27 17:04:40 +08:00
ldm0 bf3ed110f7 fix(cdp): preserve correlated command responses after page replacement 2026-09-27 03:10:54 +08:00
ldm0 2510929533 fix(cdp): derive page metrics from initialized layout 2026-09-27 01:43:26 +08:00
ldm0 ddbf52a668 feat(layout): initialize shared geometry on first demand 2026-09-27 01:43:26 +08:00
ldm0 5357eb6229 fix(screenshot): keep viewport fallback in page metrics
Restore zero DOM dimensions before layout publication. Keep the viewport
fallback in Page.getLayoutMetrics so clients can construct a positive clip
without changing element geometry or screenshot command semantics.

Empty clips remain invalid regardless of layout publication state. CLI
screenshot_full continues to request FullDocument directly on its first capture.

Cover cold and published clip rejection, page-metric captures with DPR and
scale, and CLI full-document output without a preceding viewport capture.
Document and test the separate cold Playwright fullPage limitation.
2026-09-27 01:43:26 +08:00
ldm0 e8f3272499 test(cdp): await child load before runImmediately isolation probe
Install the navigation through the target owner and wait for the child frame load event before registering the preload. This keeps delayed child initialization from replaying a new-document script during the top-level isolation assertion.
2026-09-26 19:14:15 +08:00
ldm0 47dde09e3e fix(cdp): expose viewport metrics before layout publication
Read live viewport and document scroll state for Page.getLayoutMetrics without forcing layout. Use published content bounds when available and the viewport otherwise.

Cover first Playwright viewport and clipped screenshots without CDP prewarming, and remove screenshot prewarming from DPR/resize and concurrent-page smoke cases. Keep element geometry and input dependent on explicit layout publication.
2026-09-26 19:14:15 +08:00
ldm0 ff782ab21a fix(navigation): admit renderer navigation that supersedes a pending load 2026-09-26 06:00:11 +08:00