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 03:15:08 +0900
committerEugen Rochko <eugen@zeonfederated.com>2018-05-15 20:15:08 +0200
commit4511a10e6681a219e6f1bf64af9d89ec17ee3fbc (patch)
treea9bf4cf16892d5c21539d108dd69564406530fb2 /app/javascript
parent918cfd3be600b50d7e1a034f8b1e953eb748e641 (diff)
Test if navigator.storage.estimate exists before using it (#7504)
Diffstat (limited to 'app/javascript')
-rw-r--r--app/javascript/mastodon/storage/modifier.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/javascript/mastodon/storage/modifier.js b/app/javascript/mastodon/storage/modifier.js
index db1d16058..a42b6ab12 100644
--- a/app/javascript/mastodon/storage/modifier.js
+++ b/app/javascript/mastodon/storage/modifier.js
@@ -184,7 +184,8 @@ export function putStatuses(records) {
 export function freeStorage() {
   // navigator.storage is not present on:
   // Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.100 Safari/537.36 Edge/16.16299
-  return 'storage' in navigator && navigator.storage.estimate().then(({ quota, usage }) => {
+  // estimate method is not present on Chrome 57.0.2987.98 on Linux.
+  return 'storage' in navigator && 'estimate' in navigator.storage && navigator.storage.estimate().then(({ quota, usage }) => {
     if (usage + storageMargin < quota) {
       return null;
     }