mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-27 06:46:24 +01:00
Test if navigator.storage is present before using it (#7460)
This commit is contained in:
parent
d9b2f84c92
commit
f1ed855f96
@ -182,7 +182,9 @@ export function putStatuses(records) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function freeStorage() {
|
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) {
|
if (usage + storageMargin < quota) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user