Skip to content

Commit

Permalink
Fix exception in indexedDB check on Safari (#2336)
Browse files Browse the repository at this point in the history
  • Loading branch information
rejas committed Oct 20, 2018
1 parent a747f33 commit c1a3e04
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions feature-detects/indexeddb.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,15 @@ define(['Modernizr', 'prefixed', 'addTest'], function(Modernizr, prefixed, addTe
} catch (e) {
}

if (!!indexeddb) {
if (indexeddb) {
var testDBName = 'modernizr-' + Math.random();
var req = indexeddb.open(testDBName);
var req;
try {
req = indexeddb.open(testDBName);
} catch (e) {
addTest('indexeddb', false);
return;
}

req.onerror = function(event) {
if (req.error && (req.error.name === 'InvalidStateError' || req.error.name === 'UnknownError')) {
Expand Down

0 comments on commit c1a3e04

Please sign in to comment.