From: Akihiko Odaki Date: Tue, 15 May 2018 12:24:50 +0000 (+0900) Subject: Clone response before using when caching web page (#7498) X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=3705cd8322e4b49f5d75806be724decd0362fc90;p=mastodon.git Clone response before using when caching web page (#7498) --- diff --git a/app/javascript/mastodon/service_worker/entry.js b/app/javascript/mastodon/service_worker/entry.js index 5ad03caf2..9a3911b2a 100644 --- a/app/javascript/mastodon/service_worker/entry.js +++ b/app/javascript/mastodon/service_worker/entry.js @@ -30,8 +30,8 @@ self.addEventListener('fetch', function(event) { event.respondWith(asyncResponse.then(response => { if (response.ok) { - return asyncCache.then(cache => cache.put('/', response)) - .then(() => response.clone()); + return asyncCache.then(cache => cache.put('/', response.clone())) + .then(() => response); } throw null;