Re: [w3c/ServiceWorker] Clarify CacheStorage behavior in data: URL workers (Issue #1644)

BrianJDrake left a comment (w3c/ServiceWorker#1644)

The basic issue here is that the call into the Storage Standard fails on opaque origins, and the consequences of the failure are not defined in this specification. It’s not just about `data:` URL workers: I came across the same issue while trying to understand how storage can be made available to the `file` scheme, contrary to the current specification (whatwg/storage#195).

A few extra notes:

1. The caches part of this specification now calls [obtain a local storage bottle map](https://storage.spec.whatwg.org/#obtain-a-local-storage-bottle-map) instead of calling [obtain a storage key](https://storage.spec.whatwg.org/#obtain-a-storage-key) directly, but that doesn’t really change the issue here.

2. Link [2] in the issue description is broke (the &#8216;dfn-&#8217; prefix needs to be removed): <https://w3c.github.io/ServiceWorker/#relevant-name-to-cache-map>.

    The linked definition is:

    > The ***relevant name to cache map*** for a [`CacheStorage`](https://w3c.github.io/ServiceWorker/#cachestorage) object is the [name to cache map](https://w3c.github.io/ServiceWorker/#dfn-name-to-cache-map) associated with the result of running [obtain a local storage bottle map](https://storage.spec.whatwg.org/#obtain-a-local-storage-bottle-map) with the object&#8217;s [relevant settings object](https://html.spec.whatwg.org/multipage/webappapis.html#relevant-settings-object) and "`caches`".

3. The [`caches`](https://w3c.github.io/ServiceWorker/#global-caches-attribute) getter steps do not link to this definition:

    > ***caches*** getter steps are to return [this](https://webidl.spec.whatwg.org/#this)&#8217;s associated [`CacheStorage`](https://w3c.github.io/ServiceWorker/#cachestorage) object.

4. That leads the reader to this seemingly redundant text in the [`CacheStorage` section](https://w3c.github.io/ServiceWorker/#cachestorage-interface):

    > The user agent *must* create a [`CacheStorage`](https://w3c.github.io/ServiceWorker/#cachestorage) object when a [`Window`](https://html.spec.whatwg.org/multipage/nav-history-apis.html#window) object or a [`WorkerGlobalScope`](https://html.spec.whatwg.org/multipage/workers.html#workerglobalscope) object is created.
    >
    > A [`CacheStorage`](https://w3c.github.io/ServiceWorker/#cachestorage) object represents the [name to cache map](https://w3c.github.io/ServiceWorker/#dfn-name-to-cache-map) associated with the result of running [obtain a local storage bottle map](https://storage.spec.whatwg.org/#obtain-a-local-storage-bottle-map) with its [relevant settings object](https://html.spec.whatwg.org/multipage/webappapis.html#relevant-settings-object) and "`caches`".

5. Other storage API specifications explicitly handle failures in obtaining storage bottle maps (whether due to opaque origins or otherwise). This specification should too.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/1644#issuecomment-5975680503
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/ServiceWorker/issues/1644/5975680503@github.com>

Received on Sunday, 4 October 2026 02:14:04 UTC