Skip to content

Intercept connected resources through Service Workers - #310

Merged
wieslawsoltes merged 1 commit into
mainfrom
feature/parser-resource-interception-266
Sep 17, 2026
Merged

wieslawsoltes merged 1 commit into
mainfrom
feature/parser-resource-interception-266

Conversation

@wieslawsoltes

@wieslawsoltes wieslawsoltes commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Problem

Merged #303/#304 route explicit fetch() through a claimed Service Worker, while dynamically connected script, stylesheet, and image elements still read directly from the host loader. Unchanged webview code can therefore establish a controller but bypass it for resource elements.

Result

  • Starts a bounded FetchEvent request before host prefetch for connected script, stylesheet, and image elements, carrying the browser request destination and controlled client generation.
  • Keeps the DOM task queue available while the worker resolves or messages its client; completion wakes the runtime instead of blocking the controlled page.
  • Uses the worker body for successful handled responses, falls through only when unhandled, and dispatches element error without host fallback for handled rejection, invalid status, timeout, or retired clients.
  • Retires pending worker fetch promises when their client generation disappears and preserves the existing 32-request/64 MiB bounds.
  • Adds a WPT-derived native/Chromium contract and a 100-cycle native script/style/image, navigation, latency, heap, and RSS gate.

Part of #308 and #266. #308 remains open for parser-blocking initial document resources, nested frame hydration, and CSS url() image interception. #266 retains range/cache-validator, local-resource security, and exact unchanged Markdown product completion.

Validation

@wieslawsoltes
wieslawsoltes force-pushed the feature/parser-resource-interception-266 branch from 3f66237 to e68ebdf Compare September 17, 2026 18:50
@wieslawsoltes

Copy link
Copy Markdown
Collaborator Author

Rebased cleanly onto current main b69f931d after #313. Exact-head native rebuild passed. The focused 100-cycle connected-resource gate passes with p95 0.259 ms, flat V8 heap (1,183,164 bytes), bounded RSS (38,387,712 → 49,299,456 bytes), and pending-fetch navigation retirement in 68.8 ms. The CSS metadata generator suite on the new base independently passes 6/6 plus --check.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant