Skip to content
Snippets Groups Projects
Commit 4511a10e authored by Akihiko Odaki's avatar Akihiko Odaki Committed by Eugen Rochko
Browse files

Test if navigator.storage.estimate exists before using it (#7504)

parent 918cfd3b
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment