Repository navigation
Intercept parser and nested-frame resources through Service Workers #312
Description
Parent: #308
Resource-plane epic: #266
Depends on: #310
Related CSS URL interception: #286 (separate)
Proven boundary
#310 routes resources connected by DOM mutation after the controlling Service Worker exists. Initial navigation parsing still loads parser-created external scripts and styles through the host loader, and a hydrated nested document loads its own parser resources without consulting the controller associated with that document/client generation. Unchanged VS Code creates the webview document and its extension prelude through these paths, so the resource plane remains incomplete even when dynamic element interception passes.
Scope
- Route initial parser-blocking classic scripts and external stylesheets through the document's active controlling Service Worker before host fallback.
- Route scripts, stylesheets, and images discovered while hydrating a same-origin nested frame through that nested document's active controller and client/navigation generation.
- Preserve parser ordering: stylesheet application and script execution complete before dependent parser work, followed by one
loadorerrorevent. - Preserve browser fallback semantics only for an unhandled FetchEvent. A handled rejection, invalid/oversized response, timeout, stopped worker, or retired navigation must fail closed.
- Keep parser progress asynchronous while the worker may message the controlled client for bytes. Do not block the client task queue or retain an obsolete document/frame generation.
- Reuse the request, destination, response body, admission, and queue bounds introduced by Add readable response and FetchEvent vertical #298/Add CacheStorage controlled fetch broker #303/Add TransformStream resource fallback #304/Intercept connected resources through Service Workers #310.
Acceptance
- WPT-derived and Chromium contracts cover initial parser-created script and stylesheet ordering, nested-frame script/style/image hydration,
Request.destination, URL/base resolution, one unhandled fallback, and handled rejection/error behavior. - Native contracts prove parser-dependent inline code observes the intercepted stylesheet/script results in browser order and a same-origin nested frame gets its own client identity and generation.
- Cross-origin/out-of-scope, traversal-shaped, retired-generation, malformed, >64 MiB, late, and duplicate worker responses cannot reach host fallback after
respondWith. - Navigation, frame removal, controller loss, unregister, and shutdown leave zero pending parser/frame resource requests and no retained document/client generation.
- A 64 KiB warm intercepted parser resource completes dispatch-to-ready at p95 <= 100 ms. A 100-cycle document/frame hydrate-remove test retains <= 8 MiB V8 heap and <= 64 MiB RSS after warm-up; publish native and Chromium timings.
- An unchanged Code-shaped nested webview prelude advances through initial external JS/CSS and a deterministic image without consumer-specific code. Full Markdown completion remains Stream and cache admitted Code OSS webview resources #266 until all resource-plane slices pass.
- CSS
url()interception/escape decoding stays in Decode CSS string and url() escapes before resource resolution #286 and a later Route connected web resources through controlling Service Workers #308 child. Do not change CSS metadata, parser, cascade, or generator paths.
Proposed stack entry
A focused PR based on feature/parser-resource-interception-266 / #310. Keep #308 open for CSS image URL interception and cumulative unchanged-product acceptance.
Activity
wieslawsoltes commentedon Sep 17, 2026
Landed on
mainvia #321 atd7720a63aa7cd22842771f66fc7df830c944c5f1(native implementation stack #319, dynamic connected-resource prerequisite #310).Validation on the exact promotion source:
webscene_native_service_worker_parser_resources: passed;controlled-parser-frame-resources: 4/4;The landed contract covers controlled initial parser styles/scripts, nested-frame style/script/image hydration, request destinations and client identity, unhandled fallback, fail-closed handled failures, synchronous frame retirement, 100 hydrate/remove cycles, and bounded latency/heap/RSS. CSS
url()resource interception remains separately owned.wieslawsoltes commentedon Sep 18, 2026
Reopened for the existing Linux parser-resource contract timeout in main NuGet run 35320520086.
webscene_native_service_worker_parser_resourcesreaches the test executable but its filtered binary invocation does not complete (10.41 s). The same exact timeout is present on the closest completed predecessorbea90e8ein run 35288000024. The macOS contract passes in 1.74 s now and 1.69 s on that predecessor. Exact preceding main348ea440was canceled before a complete matrix, and348ea440..1cf8bc52contains no runtime/parser changes.This is therefore #312 contract/lifecycle ownership, not a new #343 regression and not a reason to open a duplicate issue. The Linux hang/retirement path needs isolated reproduction while preserving the existing parser/frame semantics and numeric lifecycle gates. The unrelated #238 CSS failures remain out of scope.
wieslawsoltes commentedon Sep 18, 2026
Linux requalification dependency #355 is resolved via merged PR #357 at
69d929f6fd0ca030c1394c921bebedad603f84b3. The exact Linux package build now compiles the V8 native test target and reaches this issue's parser-resource test, which still reproduces the existing 10.41 s async invocation timeout. That retains #312 as the runtime/fixture owner and removes the intervening #347 GCC capture failure.wieslawsoltes commentedon Sep 18, 2026
Completed by #354, merged as
15d55a4c07d742fc3ba5f4290dfa87b082a04b70.The Linux-only timeout was a contract-fixture scheduling defect: synchronous
document.open/write/closeon an about:blank frame reentered parser-blocking Service Worker handling, so the host could not schedule the retirement-completion evaluation. The corrected contract navigates a controlled frame document, removes it from the pending request callback, and yields between lifecycle cycles. Production runtime behavior was unchanged.Exact-head evidence:
Child #355 supplied the independent Linux compilation portability repair and is already closed without the planned label.