Commit Graph
2812 Commits
Author SHA1 Message Date
ldm0 ea1076e2db fix(cdp): preserve per-page output fences during Fetch teardown
Fix MOL-554 by keeping renderer output fences for different Pages as
independent predecessors of the existing protocol output work item.
Preserve command correlation when publishing cleanup and detach events
after every original renderer prefix has crossed protocol ingress.

Cover continued and outstanding Fetch requests across two Pages, and prove
that projecting one Page's cursor cannot release another Page's output.

Validation: cargo fmt --all; workspace all-target/all-feature Clippy;
Nextest 21,987 passed, 19 skipped; Playwright reproduction passes 3/3.
2026-11-03 10:48:27 +08:00
ldm0 6043f02345 fix(cdp): resume queued evaluations after history navigation 2026-11-03 10:46:29 +08:00
ldm0 24ad52ddd2 fix(webdriver): preserve node scope across Classic and BiDi 2026-11-03 09:09:03 +08:00
ldm0 52159a6a68 chore(release): update version to 1.1.21 2026-11-03 08:37:41 +08:00
ldm0 69bbcc237d fix(stylesheets): reject child integrity failures before CSSOM installation
Check SRI admission in the child stylesheet installer before preparing an
owner CSSStyleSheet. The later resource-result guard runs after installation
and otherwise leaves an empty sheet visible for rejected responses.

Keep error completion and load-delay release on the existing terminal path.
2026-11-03 08:33:33 +08:00
Neo 孫 aba4dd5641 test(renderer): keep backend node IDs unique across Documents
The process-wide allocator is already present on main. Exercise the shared
registry constructor with separate Documents that reuse a local DOM handle,
and verify exported IDs remain unique and cannot resolve in the other registry.
2026-11-03 08:33:33 +08:00
ldm0 13067101ce fix(stylesheets): limit child request sharing to in-flight loads
Remove completed responses from the frame stylesheet store. Later link and
inline import owners now enter Fetch again, so the existing cache decides
whether to reuse, revalidate or download a response, and failures can retry.

Use each request's load-delay token to match its completion before taking
the remaining subscribers. A duplicate completion cannot settle a later
request for the same signature, and revoked owners stay excluded.

Cover no-store, fresh max-age responses and network failure recovery for
both links and imports, including the parser's wait for each new completion.
2026-11-03 07:53:58 +08:00
ldm0 53533d3e99 fix(stylesheets): revoke stale child load subscriptions 2026-11-03 07:53:58 +08:00
ldm0 0f795df8ed fix(stylesheets): replay completed child loads for late owners 2026-11-03 07:53:58 +08:00
ldm0 8597efb12f fix(stylesheets): bind parser imports before releasing scripts 2026-11-03 07:53:58 +08:00
ldm0 eac226d361 fix(stylesheets): evaluate parser media in the owning document 2026-11-03 07:53:58 +08:00
ldm0 d7d045a45a refactor(css): share native Stylo media query evaluation 2026-11-03 07:53:58 +08:00
ldm0 3c8e9c64be test(fetch): eliminate port reservation races in connection failures 2026-11-03 07:53:58 +08:00
Johannes Pfeiffer 003c7a33b4 test: make connection and Unicode-range fixtures portable 2026-11-03 07:53:58 +08:00
Johannes Pfeiffer 3a785d5815 fix(stylesheets): recognize unconditional screen media lists 2026-11-03 07:53:58 +08:00
ldm0 b593f7e617 fix(webdriver): restore Classic opt-out and BiDi client workflows 2026-11-03 07:23:02 +08:00
ldm0 feb019b3c6 fix(fetch): enforce CORP before redirect and response delivery
fix(fetch): enforce CORP before redirect and response delivery.

Extracted from development commit db59e77d3c5 and adapted to main.

Validation (32 build jobs and test threads): cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast.
     Summary [ 132.611s] 22172 tests run: 22172 passed (9 slow), 20 skipped
2026-11-03 07:18:55 +08:00
ldm0 86ede9afdb fix(stylesheets): reject child integrity failures before CSSOM
Reject integrity-failed parser stylesheet responses in child Documents before preparing or installing an owner CSSStyleSheet. Complete the failed load and release its blocker through the existing terminal path.

Add eight end-to-end URL iframe/srcdoc cases covering initial and cached integrity rejection, matching hashes, CSSOM and computed style, dependent import suppression, and parser/DCL/iframe-load progress.

The regression reproduced the empty-sheet bug at the previous PR head. Validation at 32 build jobs, test threads and Tokio workers: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast.
Summary [ 146.212s] 22163 tests run: 22163 passed (9 slow), 20 skipped
2026-11-03 07:16:23 +08:00
ldm0 85049ac2cf fix(stylesheets): validate integrity before installing CSSOM 2026-11-03 07:16:23 +08:00
ldm0 191e5fc166 refactor(protocol): make context preload IDs authoritative
Store DevToolsPreloadScriptId in BrowserContext preload registrations and keep registry_key unset there. Preserve typed IDs through registration, routing, removal and response projection.

Derive renderer keys through a shared descriptor projection for navigation and live updates, and derive removal keys from the same protocol ID. Extend the regression to verify that a previous renderer key cannot become a second stored identity.

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
ldm0 e5c74d4643 refactor(protocol): clarify context preload naming
Name mutable BrowserContext registrations context_preload_scripts and name the startup-plus-protocol projection context_document_start_script_descriptors. Update registration, removal, channel lookup and pending command names to match their ownership.

Keep startup scripts separate and preserve script IDs, renderer registry keys, diagnostic fields and execution order.

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
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 d9290e87ad feat(modules): support native text module imports
Support type: text through the shared module map, Window, child Documents and workers. Export UTF-8 decoded strings without executing their contents, preserve typed-module identity, and carry text request metadata through network, preload and Service Worker loaders. Regressions cover static/dynamic import sharing, BOM and invalid UTF-8, CORS, integrity, worker environments and unsupported-type rejection.

Extracted from development commit a6de018613.
Base: main (62e527cd34).

Validation (32 build jobs and test threads): cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast.
     Summary [ 146.817s] 22203 tests run: 22203 passed (9 slow), 20 skipped
2026-11-03 06:30:06 +08:00
Neo 孫 7ab8319998 fix(system-info): accept the frontend's browser session (SystemInfo always rejected over real connections)
The frontend router dispatches every command with a session: the client's
sessionId, or the frontend's own browser session when the client sent none.
SystemInfo.getInfo / getProcessInfo rejected any command with a session, so
over a real browser-endpoint connection they always answered "only supported
on the browser target" (unit tests passed because TestContext sends no
session). Measured: a fresh, never-attached browser-endpoint connection got
the error too.

Use the same rule as Target's browser-only operations: no session, or a
session whose route is the browser (`is_browser_session_id`). Page / frame
target sessions are still rejected (the existing two tests are unchanged).

Test: system_info_accepts_the_frontend_browser_session. Reverting the check
fails it. fmt / clippy -D warnings clean.
2026-11-03 06:13:21 +08:00
ldm0andneosun100 c94a52ffa7 fix(smoke): keep external endpoint discovery independent of local browsers
Limit protocol discovery checks to the selected endpoint. Run endpoint
identity comparisons and restart checks from the managed target-lifecycle
group, while preserving discovery, stability and invalid-path checks for
external endpoints.

Cover external protocol workers and managed-process restart behavior.

Co-authored-by: neosun100 <neosun100@users.noreply.github.com>
2026-11-03 05:53:28 +08:00
ldm0andneosun100 ac3bcc8db7 fix(fetch): apply request header guards before merging extra headers
Filter author-provided headers in Window and Worker fetch inputs for both
URL and Request override paths, using the guard selected by request mode.
Keep trusted extra HTTP headers separate from this filtering.

Add network coverage for header handling across fetch modes and input
forms, including Window/Worker behavior and trusted-header compatibility.

Co-authored-by: neosun100 <neosun100@users.noreply.github.com>
2026-11-03 05:53:28 +08:00
ldm0andneosun100 33ba7e5c46 test(server): reproduce cross-origin page takeover attempts
Load an attacker page in Moli and exercise browser CDP, page CDP and BiDi
WebSockets against the built binary. Verify that default cross-origin
connections fail while native clients continue to work.

Include same-origin, explicit allowlist and wildcard positive controls,
and verify that rebinding Host requests remain blocked. Support Chromium
as an optional attacker-page engine.

Co-authored-by: neosun100 <neosun100@users.noreply.github.com>
2026-11-03 05:53:28 +08:00
ldm0andneosun100 b6116eb8b8 fix(server): validate protocol Host and Origin before routing
Apply a shared guard before HTTP and WebSocket routing across CDP,
WebDriver Classic and BiDi. Accept any IP literal, or localhost and its
subdomains (including a trailing root dot). Treat an empty port as
unspecified.

Allow requests without Origin, from the bound server's HTTP origin, or
from explicitly allowlisted origins. Support repeated and comma-separated
--remote-allow-origins values and the '*' wildcard. Reject ambiguous
headers and keep Host validation independent of Origin exceptions.

Cover the HTTP routers, CDP and BiDi WebSocket handshakes, and WebDriver
text/plain session creation, including same-origin compatibility.

Co-authored-by: neosun100 <neosun100@users.noreply.github.com>
2026-11-03 05:53:28 +08:00
ldm0andneosun100 08e83bffc0 fix(cdp): randomize browser endpoints and page target identities
Generate a fresh browser WebSocket UUID per server and random 128-bit page
and tab target IDs for network CDP owners. Keep discovery URLs and protocol
target IDs consistent, and make clients discover endpoints instead of
relying on fixed paths.

Cover endpoint rotation, guessed and foreign ID rejection, and target
lifecycle behavior.

Co-authored-by: neosun100 <neosun100@users.noreply.github.com>
2026-11-03 05:53:28 +08:00
ldm0 8d536e4ca6 perf(dom): skip frame projection when no child contexts exist
perf(dom): skip frame projection when no child contexts exist.

Extracted from development commit aeccb884443 and adapted to main.

Validation (32 build jobs and test threads): cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast.
     Summary [ 142.740s] 22165 tests run: 22165 passed (9 slow), 20 skipped
2026-11-02 23:29:58 +08:00
ldm0 62e527cd34 fix(dom): distinguish declarative shadow roots from template contents
Determine whether a fragment is template contents from its actual native host instead of scanning parser template aliases. Preserve custom-element upgrades in declarative ShadowRoots and cover innerHTML, setHTMLUnsafe, cloning, import and adoption.
2026-11-02 23:28:55 +08:00
ldm0 ec83aaab72 fix(dom): restore copied document URL after cloned base removal
fix(dom): restore copied document URL after cloned base removal.

Extracted from development commit 77ef817c7e8 and adapted to main.

Validation (32 build jobs and test threads): cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast.
     Summary [ 140.724s] 22165 tests run: 22165 passed (9 slow), 20 skipped
2026-11-02 23:28:02 +08:00
ldm0 36af8cb57a fix(cdp): publish timer output while document loading remains pending
Only attach the source Document post-load fence when Load was already reached when selecting the timer. Publish timer notifications from open HTML streams promptly and retain the captured source snapshot when callbacks replace their Document.
2026-11-02 23:26:23 +08:00
ldm0 51d6d1ee3e fix(events): derive nullable CSS animation event associations
Expose the nullable readonly animation member on AnimationEvent and TransitionEvent using derived CSSAnimation/CSSTransition interface conversion and native payload snapshots. Preserve inherited/member getter order, exact native object identity, callee-realm errors and early rejection of author proxies or forged brands. Verified against the CSS Animations 2 and CSS Transitions 2 IDL definitions.

Extracted from development commit bf86d34d5ae17e2830c77648ceda25ec4a03c690.
Base: main (b30f39c580).

Validation (32 build jobs and test threads): cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast.
     Summary [ 147.256s] 22170 tests run: 22170 passed (9 slow), 20 skipped
2026-11-02 22:31:04 +08:00
ldm0 7e8b925824 test(indexeddb): cover queued transaction and wrapper collection
Verify active and queued SQLite transactions remain reachable until their SQL completion, then release their native wrapper records after GC. Retained finished transactions and detached objectStoreNames snapshots must preserve visible state while discarded transactions return native registry counts to zero.

Extracted from development commit f3fe5e2269cad98395c679d466f97209199a1151.
Base: main (b30f39c580).

Validation (32 build jobs and test threads): cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast.
     Summary [ 148.138s] 22171 tests run: 22171 passed (9 slow), 20 skipped
2026-11-02 22:30:05 +08:00
ldm0 f1f202ca25 test(indexeddb): cover retained pending upgrades after realm retirement
Retain a pending upgrade transaction from an isolated realm, retire that realm and verify the transaction retains its native identity only while JavaScript holds it. Force GC after releasing the last external reference to detect native roots of retired upgrade request/database handles.

Extracted from development commit 7698196f39.
Base: main (b30f39c580).

Validation (32 build jobs and test threads): cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast.
     Summary [ 148.190s] 22170 tests run: 22170 passed (9 slow), 20 skipped
2026-11-02 22:29:44 +08:00
ldm0 804223799d test(modules): cover CSS imports in unattached auxiliary Pages
Extend the opener-only popup completion regression to CSS synthetic modules alongside the existing JavaScript graphs and JSON. Exercise both initial about:blank and committed popup Documents without attaching a frontend to the auxiliary target, verify CSSStyleSheet identity and its rule, and assert both CSS requests reach the fixture. Preserve main's rejection of unsupported text module types.

Extracted from development commit 54189266c08bd7f23eb750d8b4a4f43566b0f2ae.
Base: main (b30f39c580).

Validation (32 build jobs and test threads): cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast.
     Summary [ 146.470s] 22169 tests run: 22169 passed (9 slow), 20 skipped
2026-11-02 22:29:28 +08:00
ldm0 cba18451c8 test(scripts): gate parser stylesheet after runtime load mutation
Release the parser-owned blocking stylesheet only after the runtime stylesheet load handler has applied its DOM marker. Use the existing fixture event gate and a dedicated signal route to establish the renderer/parser snapshot ordering explicitly, preserving the marker and event-order assertions without relying on two relative network delays.

Extracted from development commit f51d7c2c5e141b0926e262a35c3d21ff6cb79450.
Base: main (b30f39c580).

Validation (32 build jobs and test threads): cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast.
     Summary [ 147.438s] 22169 tests run: 22169 passed (9 slow), 20 skipped
2026-11-02 22:28:59 +08:00
ldm0 460096594e test(core): prove fetch deadlines interrupt an entered navigation grace
Warm the renderer before starting the short deadline and assert the lifecycle decider actually enters its successor-navigation grace path. Preserve the original 100 ms request timeout, 10-second grace and owner-recovery bounds.

Extracted from development commit 739748a5d14a9cfd0c5aff913146a238d97030c9.
Base: main (b30f39c580).

Validation (32 build jobs and test threads): cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast.
     Summary [ 147.288s] 22169 tests run: 22169 passed (9 slow), 20 skipped
2026-11-02 22:28:44 +08:00
ldm0 de15d018dd fix(cookies): enforce native SameSite contexts for script and network access
Apply per-cookie SameSite restrictions to script reads while preserving HttpOnly and privileged CDP access. Carry relationship and navigation shape into canonical insertion checks before mutation, including overwrite and expiry deletion. Keep Secure SameSite=None, top-level response allowances and precise rejection reports; remove the blanket cross-site document-cookie denial.

Extracted from development commit 1b521cee146.
Base: wpt/20261030-cookie-age-aware-samesite (a170fb14b8).

Validation (32 build jobs and test threads): cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast.
     Summary [ 150.549s] 22175 tests run: 22175 passed (9 slow), 20 skipped
2026-11-02 11:12:00 +08:00
ldm0 8f6648c1f9 fix(cookies): preserve unknown ages and streamline SameSite checks 2026-11-02 11:09:13 +08:00
ldm0 382c34c749 refactor(cookies): drop unreleased timestamp compatibility 2026-11-02 11:09:13 +08:00
ldm0 2e4fa728e8 refactor(cookies): store creation times as Unix microseconds 2026-11-02 11:09:13 +08:00
ldm0 7af087d8ab fix(import): preserve browser cookie creation timestamps 2026-11-02 11:09:13 +08:00
ldm0 66aec1d3b5 fix(cookies): report the canonical SameSite mode after overwrite 2026-11-02 11:09:13 +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 b30f39c580 fix(fetch): preserve combined Content-Type syntax in Body.blob()
fix(fetch): preserve combined Content-Type syntax in Body.blob().

Extracted from development commit 8123cb6e9f8 and adapted to main.

Validation (32 build jobs and test threads): cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast.
     Summary [ 138.308s] 22166 tests run: 22166 passed (9 slow), 20 skipped
2026-11-02 03:11:27 +08:00
ldm0 c33d3846a0 perf(sqlite): share Tokio task machinery across storage owners
Erase async task body types at RuntimeHandle::spawn so SQLite owner loops
share Tokio scheduler code. Keep blocking SQL work and results concrete,
and retain the existing task admission, failure collection and shutdown.

This boxes each submitted async task once; normal SQL commands do not gain
an additional box. The original Linux x86_64 release profile, followed by
strip --strip-all, decreases from 111026760 to 110965320 bytes (60 KiB).

Validation: cargo fmt --all; full workspace Clippy with all targets/features
and -D warnings; Nextest 22154 passed, 20 skipped; CDP smoke 92/92 on both
Moli and actual Chrome 145.
2026-11-02 03:10:27 +08:00
ldm0 fe15e4b73e fix(fetch): preserve raw Location bytes across redirect paths
fix(fetch): preserve raw Location bytes across redirect paths.

Extracted from development commit 7e5a9cbf8191b2ff2aa8afd9d6a298eb86e1aab1 and adapted to main.

Validation (32 build jobs and test threads): cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast.
     Summary [ 179.354s] 22167 tests run: 22167 passed (9 slow), 20 skipped
2026-11-02 02:03:43 +08:00