Commit Graph
151 Commits
Author SHA1 Message Date
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 bc153f0165 refactor(fetch): capture redirect requests at their source 2026-11-12 20:10:31 +08:00
user.email 09c3db3c5a fix(cdp): report dispatched requests across redirect hops 2026-11-12 20:10:31 +08:00
ldm0 7978356bfc refactor(fetch): introduce shared response metadata 2026-11-12 16:31:24 +08:00
ldm0 0e1b29aee6 refactor(fetch): isolate referrer sources from cookie context
Represent client, omitted, and explicit Fetch referrers directly. Capture
the client URL at request initialization and carry it into derived requests
without consulting the Cookie initiator when generating Referer.

Keep explicit selection independent of builder ordering and Cookie scope
updates. Retain redirect policy reduction so a later permissive policy
cannot restore an omitted referrer or stripped path.

Cover Window/Worker initialization order, Cookie initiator and scope
replacement, preflight inheritance from a different client, and navigation
default initialization.
2026-11-12 03:10:33 +08:00
ldm0 0cd6650015 refactor(cookies): separate site history from the current method
Keep method-independent site limits and redirect diagnostic history apart
from the current HTTP method. Compute SameSite outcomes and both diagnostic
tracks when read, with one canonical method input. Method overrides no
longer reverse-repair cached SameSite results or duplicated metadata.

Preserve explicit CrossSite restrictions, scope rebinding, partition keys,
and historical downgrade diagnostics. Keep cache key material unchanged
while moving consumers to the computed context API.

Cover method round trips without history mutation and retain distinct
diagnostics when different histories end with the same CrossSite result.
2026-11-12 03:10:33 +08:00
ldm0 dae236828a refactor(fetch): share HTTP redirect hop state updates
Commit Referer reduction, method/body rewriting, Cookie context advancement,
current URL, origin key and redirect count through one runtime helper.
Retain Request.url as the initial URL. Each transport still owns response
collection, caching and cancellation, while HTTPS upgrades stay separate.
2026-11-12 03:10:33 +08:00
ldm0 15a2aa1775 refactor(cookies): remove shadow context calculation and scope side effects
Run current-request tests through network_cookie_context and redirected tests
through follow_redirect, preserving Cookie header and diagnostic assertions.
Remove the test-only effective_cookie_context implementation.

Add an initiator-only update that preserves browser scope and partitioning.
Share per-track metadata operations, advance contexts without cloning URLs,
and use request-type accessors instead of constructing throwaway contexts.
2026-11-12 03:10:33 +08:00
ldm0 152fb34077 refactor(cookies): synchronize hop method when advancing redirect context
Require the actual next-hop method in advance_cookie_request_context and
update method safety and both metadata tracks before preserving site limits.
Remove the repeated synchronization from the five HTTP redirect branches;
pass the actual method through HTTPS upgrades and caller-followed redirects.

Cover GET-to-POST and POST-to-GET overrides starting from computed Lax/Unsafe
contexts, including explicit CrossSite limits. Check actual Cookie headers
in every transport, distinguishing fresh and aged default cookies from Lax.
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 80a07dfc05 fix(cookies): synchronize method context across redirects 2026-11-12 03:10:33 +08:00
ldm0 43214c7408 fix(cookies): preserve top-level navigation allowances across redirects 2026-11-11 19:19:03 +08:00
ldm0 f8d0ea287e refactor(fetch): remove diagnostic-only request mode errors
No production caller classifies RequestModeError. Use anyhow results, context and guards while retaining the same mode checks and diagnostics, and assert rejection details instead of downcasting in the test.
2026-11-09 12:55:13 +08:00
ldm0 bbddd8fc62 fix(fetch): preserve paused responses and explicit header replacements 2026-11-08 22:37:11 +08:00
ldm0 3fb2d06b6d refactor(fetch): preserve typed resource loading errors 2026-11-08 22:37:11 +08:00
ldm0 b1d443e1e3 fix(fetch): preserve resource dispatch when resuming interception 2026-11-08 22:37:11 +08:00
ldm0 e5a0f40e85 refactor(fetch): separate request admission from mode validation 2026-11-06 02:23:36 +08:00
ldm0 f4850f3cd7 fix(modules): check CSP before each redirect request 2026-11-06 00:36:55 +08:00
ldm0 a55f7ececc fix(cache): partition renderer resources by fetch destination 2026-11-05 14:32:38 +08:00
ldm0 f0763015dd fix(fetch): send the text module Accept default 2026-11-05 14:32:38 +08:00
ldm0 3cd910a4e5 refactor(navigation): move redirect state and share request overrides
Return the request executor and accumulated observation journal from an
unpaused redirect decision instead of cloning them for each hop. Keep the
same objects in PendingFetchNavigation only while a request is paused,
and remove Clone from NavigationInterception.

Share the transport URL, method, headers, body and redirect-header update
between main and child documents without cloning the complete Request.
Rename the redirect execution switch to set_manual_redirects so its role
is distinct from Fetch pattern matching.
2026-11-05 04:20:11 +08:00
ldm0 9da6035ea3 fix(fetch): finish buffered raw redirects at response headers 2026-11-05 04:20:11 +08:00
ldm0 414e4b2f6d fix(fetch): reuse buffered cache hits and centralize effective cache policy 2026-11-05 03:12:07 +08:00
ldm0 6da5921956 fix(fetch): admit stale cache reuse and reject cache-only network misses
Build on native cache request controls to support force-cache and only-if-cached. Reuse eligible stale entries without validation and reject misses before connecting on every transport. Check cancellation before streaming cache admission, retaining Vary, partition and cached-redirect security checks. Native wire/cache regressions cover stale reuse, misses, privacy boundaries, redirects and pre-cancelled HTML/raw requests.

Extracted from development commit ff934e4f294.
Base: wpt/20261102-http-cache-request-controls (47ffbe16e8).

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 [ 139.288s] 22176 tests run: 22176 passed (9 slow), 20 skipped
2026-11-05 03:12:07 +08:00
ldm0 c9b4e85960 refactor(fetch): simplify Accept header preparation
Name the internal Accept-only operation explicitly and call FetchClient preparation directly from renderer request paths. Inline the Page header merger and move existing request fields into the overlay instead of cloning them.
2026-11-05 00:12:03 +08:00
ldm0 d919b82f94 refactor(fetch): prepare Accept before interception and transport 2026-11-05 00:12:03 +08:00
ldm0 ea74ec2e4c fix(fetch): honor configured Accept before ServiceWorker fallback 2026-11-05 00:12:03 +08:00
ldm0 aa97a96ceb refactor(fetch): type the default Accept policy 2026-11-05 00:12:03 +08:00
ldm0 fee29e0aba fix(fetch): expose default Accept before ServiceWorker interception 2026-11-05 00:12:03 +08:00
ldm0 28a33b90a1 fix(fetch): apply cache-mode request controls without replacing author fields
Preserve no-cache, reload and no-store as distinct native policies, emit their required intermediary cache controls, and map default conditional requests to no-store. Keep author-supplied fields, including empty values. Real wire/cache regressions cover headers, conditional requests and reload versus no-store persistence.

Extracted from development commit ff934e4f294.
Base: main (fe15e4b73e).

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 [ 170.542s] 22171 tests run: 22171 passed (9 slow), 20 skipped
2026-11-05 00:02:34 +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 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
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
ldm0 5e6482996e feat(storage): open Cookie and localStorage databases on first use 2026-11-01 04:03:38 +08:00
ldm0 1f0dc4e011 chore(browser-profile): update default Chrome version to 156.0.8078.74 2026-11-01 00:58:17 +08:00
ldm0 59b0aa9754 fix(worker): send typed Fetch Metadata for worker main scripts
Set SameOrigin mode and native Worker/SharedWorker destinations on dedicated, nested and shared worker main-script requests. Retain CORS mode for module imports and honor nested worker script-kind credentials.

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 [ 133.978s] 22032 tests run: 22032 passed (9 slow), 19 skipped
2026-10-31 21:23:14 +08:00
ldm0 75a0e87674 fix(fetch): restrict automatic Sec-Fetch-User to navigation
A retained top-level cookie context must not mark a non-navigation Fetch
as user-activated. Restore the navigation-mode guard at the shared emitter.

Cover absent initiators across CORS modes, restore HTTP and HTTPS Origin
redirect cases, assert exact redirect site metadata, and preserve explicit
embedder headers without duplication.
2026-10-31 21:23:14 +08:00
ldm0 3516e967a5 fix(fetch): gate Metadata headers on each trustworthy destination
Use one Fetch Metadata emission path for browser navigations and subresources. Suppress generated Sec-Fetch headers when the current destination is not potentially trustworthy, including after redirects, while retaining loopback and localhost HTTP support.

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 [ 152.548s] 22026 tests run: 22026 passed (9 slow), 19 skipped
2026-10-31 21:23:14 +08:00
ldm0 2dd72ca458 fix(performance): distinguish cached and validated resource transfers
The existing from_cache flag collapses fresh local responses and revalidated 304 responses into the same state, producing incorrect Resource Timing transferSize.

Carry explicit cache state through buffered and streamed fetches, navigation, subresource snapshots and response interception. Resource Timing reports zero transfer for local hits, validation overhead for merged 304 responses, and body bytes plus header overhead for network responses. Cover disk and memory cache state in the HTTP timing fixture and native response tests.
2026-10-31 20:06:00 +08:00
ldm0 5d65e521c5 refactor(protocol): supervise dedicated worker closure and command recovery
Run dedicated-worker close cleanup as an ordinary async workflow in the
existing in-flight entry. Join the original session disposal, reject new
attachments during retirement, and bind cleanup to the original worker and
session lifetimes. Preserve earlier captured auto-attach facts while retiring
any original binding they publish during close.

Return command contexts, typed events, exact renderer boundaries and actual
terminals to the original scope on cancellation or discarded results. Resume
admitted cleanup rather than restarting it, and finish precise resource cleanup
after a workflow panic. Settle pending worker calls at close admission so the
original Target-detached terminal stays before the close acknowledgement.

Preserve the existing typed FetchCancelled cause when cancellation ends curl
through its write callback, keeping the original transport error and metadata.

Validation: cargo fmt --all; full workspace/all-targets/all-features Clippy;
root nextest 21,007 passed /19 skipped; five state-access doctests; 70 focused
cleanup tests; 32 stress rounds for raw/Digest and HTML typed cancellation.
Final-source CLI checks passed: worker close 3/3 with two sessions, held promise
and peer progress; CDP 12/12, captured/auth 7/7, child navigation, Playwright, and
debugger-held activation/Page.close/Target.close. All 4,805 Rust/Cargo input
hashes remained identical across final checks, CLI build and staging.
2026-10-29 17:39:23 +08:00
ldm0 9268deff09 refactor(protocol): own teardown and command completion workflows
Move session disposal, frontend teardown, target activation and closure waits
out of connection borrows into supervised workflows. Retain exact binding
identities and command output ownership through cancellation and discarded
ready results.

Complete Native and finite query results synchronously and run Input
download and file chooser completion as owned async work. Preserve response
and renderer publication order, and release the actor while Tab auto-attach
joins an existing initial-document installation.

Make the meta-refresh shutdown regression wait for its successor document
before asserting exact DOM output.

Validation: cargo fmt --all; full workspace Clippy with warnings denied;
cargo nextest run --no-fail-fast (20,973 passed, 19 skipped); real CLI,
Playwright, paused-renderer, Fetch-close and Input checks.
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 5d34b770d1 fix(fetch): scope redirect authorization to credential origins
Filter configured and request Authorization headers against the initial
transfer origin at the shared outgoing-header boundary. Remove the
unconditional Basic auth fallback that bypassed the origin guard.

Bind native server credentials when supplied and enforce that scope for
Basic and libcurl-managed authentication, preserving proxy credentials
and explicit auth responses to later redirect targets.

Cover all three HTTP transports, mutable caller-managed redirect URLs,
same-origin and foreign Digest challenges, and fresh destination grants.
2026-10-28 00:24:55 +08:00
ldm0 638fa6dc7e fix(fetch): gate HTTP cache on effective literal cookies
Share literal Cookie selection between header emission and cache eligibility.
Unbound data, out-of-scope hosts and credentials-suppressed literals no longer
disable the disk cache. Requests that actually send cookies still bypass
lookup and storage, preserving any earlier public entry.

Cover raw and HTML streams with fresh network runtimes and both request-level
and configured Cookie data, including credentials omit and cross-origin
same-origin requests.
2026-10-28 00:24:55 +08:00
ldm0 ded7899eda fix(fetch): give configured cookie data a default host scope
Keep serve --cookie DATA and bind its default host at the first HTTP(S)
top-level navigation. Share the binding across cloned configurations and
network runtimes so frames, workers, later pages and browser contexts cannot
claim or expand it. Subrequests use host-only matching; scoped top-level
transfers retain curl-compatible redirect propagation.

Keep literal data separate from the Cookie Store and preserve credentials
checks, imported cookie scopes and request-level CLI cookie behavior.

Bind at navigation entry before Service Worker interception as well as at
HTTP runtime admission, so synthetic responses do not delay the scope choice.
2026-10-28 00:24:55 +08:00
ldm0 b6d1f46486 fix(fetch): honor credentials mode for literal cookies
Apply the Cookie Store credentials decision to both configured and
request-specific literal Cookie data. This excludes browser omit requests
and cross-origin same-origin requests, including credentialless OPTIONS
preflights, while CLI fetches retain their Include credentials policy.

Cover both configuration sources, every fetch transport and the actual
renderer preflight followed by a credentialed request.
2026-10-28 00:24:55 +08:00
ldm0 4b87174bc7 fix(fetch): scope explicit cookies to the initial redirect origin
Filter CLI Cookie headers at the shared outgoing-header boundary using the
initial URL hostname, scheme and effective port. Keep the configured header
list intact so returning to the initial origin restores curl behavior.
Literal Cookie data and per-target Cookie Store selection stay separate.

Cover default and per-request headers, casing and duplicates, redirected
header restoration, all fetch transports and CLI cookie combinations.
2026-10-28 00:24:55 +08:00
ldm0 daee1e9eaa fix(fetch): preserve explicit cookie headers in CLI requests 2026-10-28 00:24:55 +08:00
ldm0 580cde7fa2 fix(fetch): complete cookie inputs and unify export finalization 2026-10-28 00:24:55 +08:00