Skip to content
Snippets Groups Projects
Commit f1f84604 authored by unarist's avatar unarist Committed by Eugen Rochko
Browse files

Fix ReferenceError when Cache API is missing (#6953)

Cache API is not supported on Safari 11.0 / iOS 11.

Since those caching is optional, this patch simply ignores it.
parent 41452e83
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,10 @@ import { autoPlayGif } from '../initial_state'; ...@@ -4,7 +4,10 @@ import { autoPlayGif } from '../initial_state';
const accountAssetKeys = ['avatar', 'avatar_static', 'header', 'header_static']; const accountAssetKeys = ['avatar', 'avatar_static', 'header', 'header_static'];
const avatarKey = autoPlayGif ? 'avatar' : 'avatar_static'; const avatarKey = autoPlayGif ? 'avatar' : 'avatar_static';
const limit = 1024; const limit = 1024;
const asyncCache = caches.open('mastodon-system');
// ServiceWorker and Cache API is not available on iOS 11
// https://webkit.org/status/#specification-service-workers
const asyncCache = window.caches ? caches.open('mastodon-system') : Promise.reject();
function put(name, objects, onupdate, oncreate) { function put(name, objects, onupdate, oncreate) {
return asyncDB.then(db => new Promise((resolve, reject) => { return asyncDB.then(db => new Promise((resolve, reject) => {
......
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