Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

Update addAll() to reflect new behavior #19

Merged
merged 2 commits into from
Apr 6, 2016

Conversation

NekR
Copy link

@NekR NekR commented Apr 4, 2016

Make addAll() fail on responses other than OK in Firefox < 46 and Chrome < 50.
Also, if addAll() had to be fixed even though native exists--polyfill add()
method too. More details at w3c/ServiceWorker#823

Also bumped version to 4.0.0 since it's kind of breaking change. Let me know if this PR seems messy for you, because I have a bit of such feeling (e.g. userAgent checks),

Make addAll() fail on responses other than OK in Firefox < 46 and Chrome < 50.
Also, if addAll() had to be fixed even though native exists--polyfill add()
method too. More details at w3c/ServiceWorker#823
@@ -62,6 +81,10 @@ if (!Cache.prototype.addAll) {
// (don't think this is possible to polyfill due to opaque responses)
return Promise.all(
responses.map(function(response, i) {
if (!response.ok) {
throw new NetworkError('Incorrect response status');
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of the responses should cache if any are !ok, could you check all of them before calling .put?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, sure.

@NekR
Copy link
Author

NekR commented Apr 4, 2016

Not sure if Github sends notifications for new commits, so pinging, just in case.

@jakearchibald
Copy link
Collaborator

LGTM, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants