Commit Graph
271 Commits
Author SHA1 Message Date
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 ff19670cf9 fix(indexeddb): freeze request sources after argument conversion 2026-11-13 01:39:46 +08:00
ldm0 aef25efaba test(indexeddb): cover rename source identity and upgrade rollback
Exercise name validation, admitted reads and writes, value and key cursors, reused names, cross-realm aliases, and explicit or constraint-driven upgrade aborts in Window, child and Worker contexts.
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 f0c484b7d8 fix(indexeddb): validate clear before creating requests
Source-commit: dd415580ac
2026-11-12 17:25:11 +08:00
ldm0 e7ac1c1a4a refactor(fetch): share response state across workers and caches 2026-11-12 16:31:24 +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 c18562d71c fix(fetch): bind service worker requests before synthetic redirects
Capture the loader's browser cookie scope on the retained Service Worker
request before a synthetic redirect advances its SameSite restrictions.
Reuse the transport binding to preserve frame partition keys and Storage
Access settings without applying the network-only policy early.

Add a lightweight initial-blank popup regression with a direct network
control, a synthetic SW redirect, and server-side Cookie/Referer assertions.
2026-11-12 03:10:33 +08:00
ldm0 ef0a33ae73 fix(fetch): preserve browser scope and referrer across manual redirects
Bind the request retained by the CORS redirect loop to the loader's cookie
scope before dispatching single-hop transport copies. Reuse the transport
binding so frame partition keys and Storage Access settings stay intact.

Preserve the selected referrer before Cookie origin adaptation, including
an absent referrer. Keep this in Request::follow_redirect and remove the
navigation-only duplicate.

Add live-server regressions for inherited-origin iframe fetch and sync/async
XHR, plus a multi-hop referrer test with a permissive response policy.
2026-11-12 03:10:33 +08:00
ldm0 1ed7e997bb test(core): assert stylesheet readiness without timing thresholds 2026-11-12 02:01:08 +08:00
ldm0 e87c00c2ac test(core): gate async Fetch and XHR responses 2026-11-12 02:01:08 +08:00
ldm0 c6a9c7b118 fix(performance): preserve timing authorization in Cache Storage
Persist the Fetch timing-allow flag, propagate it through pending body completion, and restore it when building readable and opaque cached Response objects. Cover disk round trips and Window/Worker Cache API delivery with TAO and no-TAO controls.
2026-11-12 00:44:00 +08:00
ldm0 b3dd528d44 fix(performance): preserve Service Worker response timing metadata
Retain response type and timing authorization through Response materialization, clone, SW settlement, and direct Worker Fetch completion. Report delivered body bytes without a client network transfer, preserve forwarded CORS restrictions, and avoid re-filtering synthetic Default responses by their request URL.
2026-11-12 00:44:00 +08:00
ldm0 a6352fa05d fix(performance): record aborted Fetch resource timing
Publish one terminal entry in the Fetch relevant global before cancellation drops request state. Cover Window and Worker aborts before headers and during streaming, pre-aborted signals, borrowed iframe Fetch, and late completions.
2026-11-12 00:44:00 +08:00
ldm0 9062c68e7a fix(performance): attribute parser script loads to their document
Populate initiatorUrl for fresh same-origin parser script responses while retaining redaction for cached, foreign and unknown initiators. Add a shared browser fixture verifying Fetch source identity and separate parent/iframe timelines against Chromium.
2026-11-12 00:44:00 +08:00
ldm0 e4a8931249 fix(performance): record Window fetch resource timing
Retain request-time script attribution and publish Fetch entries at buffered or streaming body completion. Apply CORS and Timing-Allow-Origin visibility independently, and cover network failures, async provenance, lazy publication and cache states.
2026-11-12 00:44:00 +08:00
ldm0 b0af4f8e78 test(core): give navigation-grace deadline probes startup margin
Allow startup and scheduling margin in the existing navigation-grace regression by using a one-second fetch deadline with a five-second outer bound. Preserve the entered-decider assertion, ten-second grace, exact timeout reporting and subsequent owner-usability check.

Source-commit: bb39206697
2026-11-11 03:25:56 +08:00
ldm0 44386363ff test(document): reopen child streams after their initial load task
Run the existing child input-stream readiness regression after the initial load callback has returned. This exercises a fully loaded Document rather than an in-load document.open operation that resumes the current load.

Source-commit: 36456eeea3
2026-11-11 03:23:21 +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 2d55f52956 test(stylesheets): cover shared redirect paths and late CSP
Extend redirect-sibling coverage to main documents, shared intermediate
sheets and a policy delivered between the alias and direct requests.
Verify complete independent CSSOM paths, cycle termination, cascade and
request counts with the existing collector implementation.
2026-11-09 13:08:51 +08:00
ldm0 1ef5279e3e test(stylesheets): cover redirected sibling import isolation
Exercise linked and inline child stylesheet graphs in both sibling source
orders. Verify independent CSSOM children, owner links, final cascade, and
separate no-store responses with request-driven synchronization.

Allow an alias redirect under a CSP path allowlist while rejecting the direct
sibling request to its destination. Assert its violation and empty imported
sheet so response aliasing cannot bypass request-specific admission.
2026-11-09 13:08:51 +08:00
ldm0 741956c289 fix(stylesheets): check child inline CSP before import admission
Use the stylesheet owner's Document policy for the shared inline check and run
it when child parser style contents are complete. Reject blocked owners before
registering import work or acquiring a load-delay token, keeping rejected CSS
out of both CSSOM and the cascade.

Queue child violations through the existing exact Window task target instead
of executing author code during parser admission. Reuse the same owner-aware
policy path for declarative CSS modules.

Cover missing, incorrect and accepted nonces, meta policy, report-only policy,
plain styles, child event attribution, and parser/frame-load completion.
2026-11-09 13:08:51 +08:00
ldm0 a9517f0fee fix(stylesheets): preserve request policy during import graph loading
Prepare linked and inline requests at parser admission, then read the current
delivered Document policy for each newly discovered import. Each request keeps
its own policy through redirects, so later meta policies constrain new imports
without retroactively rejecting requests that were already admitted.

Reuse the existing meta policy registry and import collector. Register the
request and final URL of every completed sheet before expanding its imports,
and skip graph installation and repeated CSSOM refresh for links without
imports.

Cover dynamic and parser-delivered meta policies, same- and cross-origin
roots, inline imports, blocked data imports, and nested redirect cycles.
2026-11-09 13:08:51 +08:00
ldm0 e057516b42 fix(stylesheets): enforce child import policy and cycle identity
Retain the original root resource URL alongside the response parser base when
installing live import graphs, so a redirected link cannot import its root
response again through the original URL.

Capture the exact child Document's CSP for parser stylesheet graphs. Check
network and data imports before loading, apply policy to redirect targets, and
validate cached or Service Worker redirect chains for the current consumer.
Queue violations through the existing exact-Document Page task path and target
the child Document. Refused imports still settle parser and load blockers.

Use inherited native origins for local Documents' CSP self checks, independently
of their live base URL. Cover redirected cycles, linked and inline import graphs,
enforced/meta/report-only policies, redirect targets, data imports and srcdoc.
2026-11-09 13:08:51 +08:00
ldm0 7b377340d9 fix(stylesheets): finish child linked import graphs before parser scripts 2026-11-09 13:08:51 +08:00
ldm0 0da338c888 test(indexeddb): run realm matrices with independent command budgets 2026-11-08 02:01:17 +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 a3d76e11a1 fix(modules): unify CSP admission and honor preload integrity 2026-11-06 02:23:36 +08:00
ldm0 742f80a396 refactor(csp): keep module redirect checks in request context 2026-11-06 00:36:55 +08:00
ldm0 6c1d13bba7 fix(csp): keep module redirect targets private 2026-11-06 00:36:55 +08:00
ldm0 f4850f3cd7 fix(modules): check CSP before each redirect request 2026-11-06 00:36:55 +08:00
ldm0 58f6e9643a fix(modules): enforce destination-specific CSP for synthetic modules 2026-11-06 00:36:55 +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 a55f7ececc fix(cache): partition renderer resources by fetch destination 2026-11-05 14:32:38 +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 627e3165a5 fix(fetch): consume bodies on native receiver networking tasks 2026-11-04 15:08:29 +08:00
ldm0 f2d189f9fe fix(fetch): preserve and clone Request stream bodies 2026-11-04 15:08:29 +08:00
ldm0 8597efb12f fix(stylesheets): bind parser imports before releasing scripts 2026-11-03 07:53:58 +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 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
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 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