]> cat aescling's git repositories - mastodon.git/commitdiff
Consider only-if-cached in FetchEvent valid on non-Mozilla-Firefox browser (#7506)
authorAkihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>
Tue, 15 May 2018 19:42:31 +0000 (04:42 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Tue, 15 May 2018 19:42:31 +0000 (21:42 +0200)
app/javascript/mastodon/service_worker/entry.js

index d28a2be6d73e42afd85266c9eba05d28bc23646f..89414f1006f8f6d93534ac27fd75a5ee4e110693 100644 (file)
@@ -13,7 +13,8 @@ function fetchRoot() {
   return fetch('/', { credentials: 'include' });
 }
 
-const invalidOnlyIfCached = navigator.userAgent.match(/Firefox\/(\d+)/)[1] < 60;
+const firefox = navigator.userAgent.match(/Firefox\/(\d+)/);
+const invalidOnlyIfCached = firefox && firefox[1] < 60;
 
 // Cause a new version of a registered Service Worker to replace an existing one
 // that is already installed, and replace the currently active worker on open pages.