Repository navigation
Conversation
|
Heads-up on the failed check: the HEAD release build compiled and uploaded the artifact fine, but the final |
Fetch.enable patterns with heterogeneous resource types collapsed the protocol-to-renderer channel to "intercept every class" because the channel could only carry one SubresourceResourceType or all of them. Synchronous XHR then hit the explicit interception ban (NetworkError before any I/O) even though no pattern named an XHR-like class, and phase-one script preloads were deferred for the same reason. Replace the Option<SubresourceResourceType> channel with a SubresourceInterceptionClasses bitset mirroring the distinct CDP Fetch interception classes (Fetch/EventSource/XHR share the XHR class; Audio/Video/Media/TextTrack share Media). Pattern sets now union their classes, so Image+Media+Font routes exactly those classes and synchronous XHR keeps its ordinary network path. Type-less patterns, empty pattern lists, and auth-capable configurations still widen to every class: auth matching is URL-granular and must never be silently cut by a class scope. An empty set means nothing routes, so the channel carries the class set alone without a separate enabled flag. Same-class patterns (Fetch+XHR+EventSource) behave as before, and Stylesheet/TextTrack-only patterns keep the existing renderer-disabled behavior. handleAuthRequests:true combined with typed patterns is now observed to widen the class set to every class, so synchronous XHR for that configuration reports the explicit interception failure instead of silently missing Fetch.authRequired pauses; previously the non-named classes simply bypassed auth interception. The renderer's should_intercept_subresource, worker state, phase-one and document.write script preload admission, and document fetch context seeds all read the class set; Chromium-verified dual-engine smoke coverage extends the fetch-font group with a synchronous XHR contract. Review fixes: class-precise document.write preload gate; negative auth-widening unit test; dead single-filter config entry point removed; (enabled, classes) tuple collapsed into the bare class set.
…terception class-set API Upstream commits added after fix/fetch-interception-resource-class-set branched still called set_fetch_subresource_interception(bool, Option<_>); scope them to SubresourceInterceptionClasses (for_resource_type / ALL).
4e42d6c to
d5c1d30
Compare
|
Updated the branch against current What: a mechanical port of the test call-sites upstream added after this branch diverged — 6 files, 13 calls of the old Why: this PR replaces that signature with the class-set API, so the plain merge applies cleanly textually but does not compile against current This should also give the PR a fresh CI run, replacing the previous one that failed on the artifact finalize step with a transient |
Fixes #2703
Problem
Fetch.enablewith heterogeneous resourceType patterns (e.g.Image+Media+Font) collapses in the protocol→renderer configuration channel to "intercept all classes" (fetch_subresource_interception_config_for_patternsearly-returns(true, None)), so the renderer treats XHR as interceptable and the deliberate sync-XHR interception prohibition fires falsely: pages doing a synchronous XHR throwNetworkError: Failed to execute 'send' on 'XMLHttpRequest'and the request never reaches the server. The same collapse produces a false positive for the Script class in phase-one speculative-preload admission. Full analysis and repro in #2703.Two implementation variants, why B
We considered two ways to fix this:
Option<SubresourceResourceType>("one or all") with an exact set of intercepted classes —SubresourceInterceptionClassesinmoli-page-types. Heterogeneous patterns scope the renderer precisely;enabledbecomes constructively equivalent to!classes.is_empty()(after review the channel was collapsed to carry the bare set). Bigger mechanical diff (~37 files), but one source of truth, the whole class of false positives disappears at once, and the representation finally matches whatFetch.enablepatterns actually are — arbitrary sets of resource types.We picked B: A would have left the same latent failure mode open and duplicated state through the whole config channel; B makes the invariant constructive and matches the direction the codebase is already moving (shared admission, unified policy engines). The wider diff is mechanical (carrier plumbing), the semantic surface is smaller than A's.
What's changed
SubresourceInterceptionClasses(bitflags over the 12 CDP Fetch interception classes; Fetch/EventSource/XHR →FETCH_LIKE, Media/TextTrack →MEDIA, CspReport →CSP_VIOLATION_REPORT, Dictionary →OTHER, rest 1:1), built as the union of pattern classes instead of the collapse; carried bare (no separateenabledboolean) through the whole channel:fetch_owner/target_session_owner→RendererPageCommand::SetFetchSubresourceInterception { classes }→moli-core(settings, navigation engine seeds and ~10 builders) →moli-renderer-v8(page VM, host environment, popups, dedicated/nested/shared/service workers, replay).ALLpreserved where the renderer must keep routing everything: type-less URL patterns (empty pattern list normalizes to one type-less pattern), auth interception (newauth_interception_can_match_any_urlmirrorsmatches_auth_required— this also fixes a pre-existing silent auth scope cut for typed patterns), and response-stage candidates (union over patterns of both stages).document.writespeculative script-preload scanning and phase-one admission are now class-precise (intercepts(Script)).Some(filter)branch became unreachable).Observable behavior change (intentional):
Fetch.enable{handleAuthRequests: true}combined with typed patterns now widens the renderer scope toALL(auth matches by URL, not by class), so sync XHR is honestly banned for that configuration instead of silently bypassing auth interception. Noted in the commit message.Testing
ALLcompleteness, phase-one Script precision, negative auth-widening mirror.Image+Media+Font(200, zeroFetch.requestPaused) on page and workers; the ban still fires with a real XHR pattern;Fetch.disableleaves same-session Network/BiDi intercept config active.ALL→ the ban message) using a URL that passes the url-policy/bad-port gates; worker mirror.moli-cdp-smokefetch-fontgroup (already the buggy heterogeneous configuration): new contractfetch_font_heterogeneous_sync_xhr— dual-engine (moli live binary + Chromium), sync XHR returns 200 with parseable body and norequestPaused.cargo fmt --all,cargo clippy --workspace --all-targets --all-features -- -D warnings,cargo nextest run --no-fail-fast(workspace). Known pre-existing failures on cleanmainare unchanged:domains::emulation::…context_locale_override…(environment-dependent), timing flakes inmoli-core/moli-renderer-v8that pass in isolation.Out of scope
Stylesheet/TextTrackinFetch.enablepatterns (tracked separately).