Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Heads Up: Cache API .add()/.addAll() non-backward compatible change

99 views
Skip to first unread message

Ben Kelly

unread,
Feb 5, 2016, 11:23:46 AM2/5/16
to dev-pl...@lists.mozilla.org
All,

We just landed a change to the Cache API .add()/.addAll() methods here:

https://bugzilla.mozilla.org/show_bug.cgi?id=1244764

These methods essentially perform a fetch() and then a cache.put().
Previously they would happily store a 40x or 50x response from the fetch()
in the Cache. This surprised many developers.

Cache .add() and .addAll() will now reject with a TypeError if any Response
status is not in the 200 range.

An additional side effect of this is that these methods will always reject
for cross-origin no-cors requests resulting in opaque responses since these
responses hide the status code. They always return a status of 0. The
blink team did some measurements and confirmed this is a very rare thing
right now in the wild. So we decided it was a reasonable breaking change
to make.

Chrome has landed the same fix and will ship it in M50 in the april'ish
time frame:


https://github.com/slightlyoff/ServiceWorker/issues/823#issuecomment-179394502

I plan to uplift this change to FF46 so that we will also ship in april.

Please let me know if you have any concerns.

Thanks!

Ben
0 new messages