New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sw bugs #19764

Closed
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
4 participants
@alxhub
Contributor

alxhub commented Oct 17, 2017

No description provided.

@googlebot googlebot added the cla: yes label Oct 17, 2017

@mary-poppins

This comment has been minimized.

Show comment
Hide comment
@mary-poppins

mary-poppins commented Oct 17, 2017

@alxhub alxhub requested a review from IgorMinar Oct 17, 2017

@mary-poppins

This comment has been minimized.

Show comment
Hide comment
@mary-poppins

mary-poppins commented Oct 17, 2017

@mary-poppins

This comment has been minimized.

Show comment
Hide comment
@mary-poppins

mary-poppins commented Oct 18, 2017

alxhub added some commits Oct 10, 2017

fix(service-worker): freshness strategy should clone response for cache
When Cache.put() is called with a Response, it consumes the response. If
the Response is used for any other purpose (such as satisfying the
original FetchEvent) it must be cloned first.

A bug exists in the mocks used for SW tests, where this condition is not
validated. The bodies of MockResponses can be utilized repeatedly without
erroring in the same way that a real browser would. This bug is fixed by
this commit, which causes tests for the freshness strategy of data caching
to start failing.

The cause of this failure is a second bug in the data caching code, where
the Response is not cloned prior to being passed to Cache.put(). This is
also fixed.
fix(service-worker): PushEvent.data has to be decoded
PushEvent.data is not the data object itself, but an instance representing
the data in wire format, with methods to synchronously decode it to JSON,
ArrayBuffer, etc. NGSW assumes all push data is in JSON format.
@mary-poppins

This comment has been minimized.

Show comment
Hide comment
@mary-poppins

mary-poppins commented Oct 18, 2017

tbosch added a commit that referenced this pull request Oct 18, 2017

fix(service-worker): PushEvent.data has to be decoded (#19764)
PushEvent.data is not the data object itself, but an instance representing
the data in wire format, with methods to synchronously decode it to JSON,
ArrayBuffer, etc. NGSW assumes all push data is in JSON format.

PR Close #19764

@tbosch tbosch closed this in 396c241 Oct 18, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment