- From: Armen Michaeli <notifications@github.com>
- Date: Thu, 22 Aug 2024 11:04:48 -0700
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/ServiceWorker/issues/1724@github.com>
https://w3c.github.io/ServiceWorker/#batch-cache-operations specifies the following step 4.2.3 under "Output": > If the result of running [Query Cache](https://w3c.github.io/ServiceWorker/#query-cache) with operation’s [request](https://w3c.github.io/ServiceWorker/#dfn-cache-batch-operation-request), operation’s [options](https://w3c.github.io/ServiceWorker/#dfn-cache-batch-operation-options), and addedItems [is not empty](https://infra.spec.whatwg.org/#list-is-empty), [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "[InvalidStateError](https://webidl.spec.whatwg.org/#invalidstateerror)" [DOMException](https://webidl.spec.whatwg.org/#idl-DOMException). I don't understand how would this be correct for a "put" operation? To explain my confusion, I'd expect querying of the cache for which `put` method has been called, to _maybe_ contain a cache hit for a matching request, meaning the "query cache" procedure _may_ return a non-empty list (if equivalent request was there). Why should the implementation throw an `InvalidStateError` then? Or am I reading the entire parable in wrong context? The later step 4.2.6.6 instructs to run the "query cache" procedure again: > Set _requestResponses_ to the result of running [Query Cache](https://w3c.github.io/ServiceWorker/#query-cache) with operation’s [request](https://w3c.github.io/ServiceWorker/#dfn-cache-batch-operation-request). Doesn't the above read more or less exactly like 4.2.3, while the latter already expects any result (an empty or non-empty list) while the former would have thrown had the cache querying returned a non-empty list? I must be readin the spec. wrong, but I just can't seem to squint my eyes the right way to see if I can make sense of the above for my part. -- Reply to this email directly or view it on GitHub: https://github.com/w3c/ServiceWorker/issues/1724 You are receiving this because you are subscribed to this thread. Message ID: <w3c/ServiceWorker/issues/1724@github.com>
Received on Thursday, 22 August 2024 18:04:52 UTC