Skip to content

Intercept parser and nested-frame resources through Service Workers #312

Description

@wieslawsoltes

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 load or error event.
  • 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    vscode-oss/plannedPlanned for the AppScene/WebScene VS Code OSS integration

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions