]> cat aescling's git repositories - mastodon.git/commitdiff
Test if navigator.storage is present before using it (#7460)
authorAkihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>
Sun, 13 May 2018 11:48:32 +0000 (20:48 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Sun, 13 May 2018 11:48:32 +0000 (13:48 +0200)
app/javascript/mastodon/storage/modifier.js

index c2ed6f807e5b508ab05ac885aae263fcf125a5cd..db1d1605836075c4bd7c713aa4a5bbdaf91615fc 100644 (file)
@@ -182,7 +182,9 @@ export function putStatuses(records) {
 }
 
 export function freeStorage() {
-  return navigator.storage.estimate().then(({ quota, usage }) => {
+  // 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 }) => {
     if (usage + storageMargin < quota) {
       return null;
     }