浏览代码

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.
master
unarist 6 年前
committed by Eugen Rochko
父节点
当前提交
f1f846045f
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. +4
    -1
      app/javascript/mastodon/storage/modifier.js

+ 4
- 1
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) => {


正在加载...
取消
保存