about summary refs log tree commit diff
path: root/app/javascript
diff options
context:
space:
mode:
authorAkihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>2018-05-16 04:42:31 +0900
committerEugen Rochko <eugen@zeonfederated.com>2018-05-15 21:42:31 +0200
commit17c1a62ec81e78f45c44882a5aba19ef8e7aeb44 (patch)
treeded32a253372a4c0ac0ed02430b7d79eeabe8148 /app/javascript
parent4511a10e6681a219e6f1bf64af9d89ec17ee3fbc (diff)
Consider only-if-cached in FetchEvent valid on non-Mozilla-Firefox browser (#7506)
Diffstat (limited to 'app/javascript')
-rw-r--r--app/javascript/mastodon/service_worker/entry.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/javascript/mastodon/service_worker/entry.js b/app/javascript/mastodon/service_worker/entry.js
index d28a2be6d..89414f100 100644
--- a/app/javascript/mastodon/service_worker/entry.js
+++ b/app/javascript/mastodon/service_worker/entry.js
@@ -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.