New issue
Advanced search Search tips

Issue 610154 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Aug 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

ServiceWorker caches.match API can return null OR throw for missing items

Reported by jftuc...@gmail.com, May 8 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36

Steps to reproduce the problem:
1. Register a service worker
2. Setup a write-through cache based on any of the online guides
3. Add .then(res => { console.log(res); return res }) as a final operation in the promise chain, after the catch

What is the expected behavior?
A resource is always returned

What went wrong?
Examples that use 'catch' work most of the time, but occasionally return null. Examples that use if(!res) fail with DOMExceptions.

Did this work before? N/A 

Chrome version: 50.0.2661.94  Channel: stable
OS Version: OS X 10.11.3
Flash Version: Shockwave Flash 21.0 r0

It seems to only be possible to make this stable by doing:

caches.match(req).then((res) => { if (!res) throw 'error'; return res }).catch(... write-through logic ...)

this feels messy.

I read the spec and it looks like caches.match should always error on missing items, so I'm not clear on how empty responses are returned - they don't appear in my cache.

This does not happen reliably for all files, but instead appears to occur for particular items in a repetitive way, (that cause either a null or a domexception but not both), but not consistently for file types or origins.
 
Components: -Blink Blink>ServiceWorker
Components: -Blink>ServiceWorker Blink>Storage>CacheStorage

Comment 3 by dmu...@chromium.org, May 31 2016

Cc: gavinp@chromium.org
Hey Gavin, do you recall if/why this is possible?

Comment 4 by dmu...@chromium.org, May 31 2016

Cc: -gavinp@chromium.org dmu...@chromium.org
Owner: gavinp@chromium.org
Status: Assigned (was: Unconfirmed)

Comment 5 by jsb...@chromium.org, Jul 25 2016

Cc: -dmu...@chromium.org
Labels: Needs-Feedback
Owner: ----
Status: Unconfirmed (was: Assigned)
caches.match() should resolve to undefined if there was no match, and only reject if the request construction fails.

Do you have a repro where it rejects?

(Note that we recently fixed  issue 610349 , but that's only if options.cacheName is used)


Status: WontFix (was: Unconfirmed)
Closing due to lack of response. :(

We'd love a repro or more details here, though!

Sign in to add a comment