Skip to content

Keep the private CacheStorage bridge callable after worker bootstrap #385

Description

@wieslawsoltes

Parent: #266

Proven failure

Exact WebScene b5b51017ab1888ecdadbb638590afa645ee5f62a deletes the private native Service Worker control hook after bootstrap, but the product-neutral Cache and CacheStorage methods still resolve that deleted global at call time. The unchanged Code OSS v6 worker reaches cache.match() on its first streamed Markdown resource and fails natively with:

ReferenceError: __webSceneServiceWorkerGlobalControl is not defined

Chrome 153 passes the unchanged pinned Markdown resource fixture. WebScene's focused service-worker-markdown-resources gate reproduces the native failure before resource delivery.

Focused scope

  • Capture and use the already-private native control closure for CacheStorage operations after the bootstrap global is removed.
  • Keep the hook absent from the worker global object and inaccessible to product code.
  • Prove unchanged Code v6 streamed resource caching plus the existing WPT-derived cache replacement contract, including fresh match, validator/304, replacement continuity, delete, quota/error isolation, 100 cycles, latency, memory, and teardown.
  • Preserve existing origin/registration cache partitioning, admission, CSP, resource status, streaming/body bounds, filesystem/network authority, and host callbacks.

Collision boundary

Owned paths are the Service Worker cache bootstrap include, its focused native regression gate, and the existing dedicated CacheStorage contract/profile only if the browser-visible privacy assertion is missing. This child excludes nested-document #267, interaction #268, File System work #382, CSS #381/PR #384, consolidation #76, AppScene, and vscode-demo.

Acceptance

  • Chrome and native pass the pinned CacheStorage replacement contract and unchanged Code v6 Markdown resource path.
  • The internal control hook is absent from globalThis while every exposed Cache/CacheStorage method remains callable.
  • Malformed/cross-origin/cross-registration data cannot acquire or widen authority; existing quota and bounded-body rejection remain fail-closed.
  • The 100-cycle cache and worker replacement gates stay within 100 ms p95, <=8 MiB V8 heap growth, <=64 MiB retained RSS, and leave no live cache/fetch operations after unregister/shutdown.

Refs #264
Refs #227

Activity

  1. wieslawsoltes commented on Sep 18, 2026

    @wieslawsoltes
    CollaboratorAuthor

    Owned from exact main b5b51017ab1888ecdadbb638590afa645ee5f62a on feature/webview-resource-next-266.

    Reproduction: Chrome 153 passes the pinned unchanged Markdown v6 fixture in 1.894 s. Native service-worker-markdown-resources fails at the first cache-backed streamed resource with ReferenceError: __webSceneServiceWorkerGlobalControl is not defined. The bootstrap correctly removes this private host hook from globalThis, but the public Cache/CacheStorage methods later look it up by that deleted global name instead of using the captured closure.

    #385 owns only closure use plus a privacy regression assertion and exact unchanged-worker/cache gates. It preserves origin/registration partitioning, CSP, admission, status/range/validator semantics, quotas, stream/body bounds, and all filesystem/network authority.

    Collision audit: open PR #384 owns CSS supports-rule files; #382 owns File System durable grants; #267/#268 own nested-document and interaction behavior; #76 owns compatibility docs. This slice owns webscene_v8_runtime_service_workers.inc, its CacheStorage/unchanged-Markdown focused tests, and the existing cache replacement contract/profile only if needed. It excludes those active lanes, AppScene, consolidation, and vscode-demo.

  2. wieslawsoltes commented on Sep 18, 2026

    @wieslawsoltes
    CollaboratorAuthor

    Completed in #387, merged as d4dc4fc10d98edd2a8a45a2901692c614d084652.

    The Cache and CacheStorage methods now retain the private native control closure after bootstrap removes the temporary global hook. Product worker code cannot observe the hook, while unchanged Code OSS v6 can cache its first streamed Markdown resource and continue through replacement/validator reuse. Origin and registration partitioning, CSP, admission, quotas, range/validator behavior, stream/body bounds, and filesystem/network authority are unchanged.

    Final evidence:

    • unchanged Code v6 native Markdown resource gate passed; cache replacement completed 100 cycles at 0.349 ms p95 with one body stream and flat V8 heap, and CSS-image delivery completed 100 cycles at 0.199 ms p95;
    • CacheStorage replacement contract passed Chrome 153 5/5 and native 5/5 while asserting the private bridge is absent from globalThis;
    • native resource-plane gate passed 100 cycles at 0.133 ms p95 with flat heap; range/cache passed 100 warm cycles at 0.185 ms p95 and a 32 MiB batch in 9.92 ms;
    • exact-head Linux, macOS, portable V8, NativeAOT Avalonia 11/12, and native Linux document contracts all passed;
    • Keep the private CacheStorage bridge callable after worker bootstrap #385 is closed and remains natively attached to Stream and cache admitted Code OSS webview resources #266; NuGet and redundant postmerge runs were canceled.

    No nested-document, interaction, File System, CSS, AppScene, consolidation, or vscode-demo paths changed.

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