storage: fallback on any IndexedDB-related failure

This commit is contained in:
tophf 2017-11-05 06:13:51 +03:00
parent 3c665aea08
commit 72714160bb

View File

@ -117,7 +117,9 @@ do {
chromeLocal.get('dbInChromeStorage')
.then(data =>
data && data.dbInChromeStorage && Promise.reject())
.then(() => dbExecIndexedDB('getAllKeys', IDBKeyRange.lowerBound(1), 1))
.then(() =>
tryCatch(dbExecIndexedDB, 'getAllKeys', IDBKeyRange.lowerBound(1), 1) ||
Promise.reject())
.then(({target}) => (
(target.result || [])[0] ?
Promise.reject('ok') :