angular-cn/packages/service-worker/worker/testing
Alex Rickabaugh 396c2417d9 fix(service-worker): freshness strategy should clone response for cache (#19764)
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.

PR Close #19764
2017-10-18 11:18:34 -07:00
..
cache.ts fix(service-worker): freshness strategy should clone response for cache (#19764) 2017-10-18 11:18:34 -07:00
fetch.ts fix(service-worker): freshness strategy should clone response for cache (#19764) 2017-10-18 11:18:34 -07:00
mock.ts fix(service-worker): several misc fixes for corner cases 2017-10-05 13:27:31 -07:00
scope.ts fix(service-worker): several misc fixes for corner cases 2017-10-05 13:27:31 -07:00