Clone response before using when caching web page (#7498)

rebase/4.0.0rc2
Akihiko Odaki 2018-05-15 21:24:50 +09:00 committed by Eugen Rochko
parent 7fe2993b87
commit 3705cd8322
1 changed files with 2 additions and 2 deletions

View File

@ -30,8 +30,8 @@ self.addEventListener('fetch', function(event) {
event.respondWith(asyncResponse.then(response => { event.respondWith(asyncResponse.then(response => {
if (response.ok) { if (response.ok) {
return asyncCache.then(cache => cache.put('/', response)) return asyncCache.then(cache => cache.put('/', response.clone()))
.then(() => response.clone()); .then(() => response);
} }
throw null; throw null;