From cffde88361c3dcb424dfe0aeb9318453615d1a16 Mon Sep 17 00:00:00 2001 From: Akihiko Odaki Date: Sun, 13 May 2018 20:48:32 +0900 Subject: [PATCH] Test if navigator.storage is present before using it (#7460) --- app/javascript/mastodon/storage/modifier.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/javascript/mastodon/storage/modifier.js b/app/javascript/mastodon/storage/modifier.js index c2ed6f807e..db1d160583 100644 --- a/app/javascript/mastodon/storage/modifier.js +++ b/app/javascript/mastodon/storage/modifier.js @@ -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; }