diff options
author | unarist <m.unarist@gmail.com> | 2018-03-29 21:57:02 +0900 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2018-03-29 14:57:02 +0200 |
commit | f1f846045f26518525d5484ed9e782b73086ebe4 (patch) | |
tree | 7338677bc53dd1b02e0edeb07c6bec85982d20e7 /app/javascript | |
parent | 41452e83028148b3ef6e5888e9bd3b16fd608ec7 (diff) |
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.
Diffstat (limited to 'app/javascript')
-rw-r--r-- | app/javascript/mastodon/storage/modifier.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/app/javascript/mastodon/storage/modifier.js b/app/javascript/mastodon/storage/modifier.js index 63e49fe6e..1bec04d0f 100644 --- a/app/javascript/mastodon/storage/modifier.js +++ b/app/javascript/mastodon/storage/modifier.js @@ -4,7 +4,10 @@ import { autoPlayGif } from '../initial_state'; const accountAssetKeys = ['avatar', 'avatar_static', 'header', 'header_static']; const avatarKey = autoPlayGif ? 'avatar' : 'avatar_static'; 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) { return asyncDB.then(db => new Promise((resolve, reject) => { |