v140 · service worker

SharedWorker script inherit controller for blob script URL

According to [Worker client case](https://w3c.github.io/ServiceWorker/#control-and-use-worker-client) (github), workers should inherit controllers for the blob URL. However, existing code allows only dedicated workers to inherit the controller, and shared workers do not inherit the controller. This is the fix to make Chromium behavior adjust to the specifica

concepts

  1. Blob SW Controller

    SharedWorkers created from a blob: URL now inherit the controlling Service Worker of the creating context. Required for offline-first apps that synthesise workers at runtime.

  2. SW Fetch Interception

    The concrete consequence: fetch() from inside a blob SharedWorker now routes through the page's SW for cache/offline/mocking. Side-by-side flow plus a live probe.

  3. Blob Controller

    Live probe that boots a blob SharedWorker and asks it whether navigator.serviceWorker.controller is present. Round-trip a fetch through the worker and see the SW header.

  4. Cache Flow

    Diagram of where a worker fetch actually goes — pre-140 the SW was bypassed; post-140 the same fetch hits the cache. Toggle the Chrome version to see the route change.

  5. Module Worker Chain

    A chain of blob-URL workers — page → blob worker → child blob worker — all with SW fetch interception visible in a log. Before Chrome 140: child blob workers bypassed the SW. After: every worker in the chain uses the same controller. Shows SW controller ID for each worker level.

why it shipped

Since the current implementation does not inherit a controller for the blob URLs, the SharedWorker's controller can be different from a controller it made the SharedWorker, and web developers may need to track it manually.

references