Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IndexedDB check in Firefox with disabled cookies #1831

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion feature-detects/indexeddb.js
Expand Up @@ -16,7 +16,12 @@ define(['Modernizr', 'prefixed'], function(Modernizr, prefixed) {
// - Firefox shipped moz_indexedDB before FF4b9, but since then has been mozIndexedDB
// For speed, we don't test the legacy (and beta-only) indexedDB

var indexeddb = prefixed('indexedDB', window);
var indexeddb;
try {
indexeddb = prefixed('indexedDB', window);
} catch (e) {
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put the closing } on the same line

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually wouldn't we want to return false here since it won't work and to me that's the same as not supported.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could return, but we aren't inside of an addTest, so I don't think return false would be doing what you think it would be doing

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryanseddon how to do it technically now when PR is closed? Create new PR?


Modernizr.addTest('indexeddb', !!indexeddb);

if (!!indexeddb) {
Expand Down
7 changes: 6 additions & 1 deletion feature-detects/indexeddbblob.js
Expand Up @@ -15,12 +15,17 @@ define(['Modernizr', 'addTest', 'prefixed', 'test/indexeddb'], function(Moderniz

Modernizr.addAsyncTest(function() {
/* jshint -W053 */
var indexeddb = prefixed('indexedDB', window);
var indexeddb;
var dbname = 'detect-blob-support';
var supportsBlob = false;
var request;
var db;

try {
indexeddb = prefixed('indexedDB', window);
} catch (e) {
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here return false.


if (!(Modernizr.indexeddb && Modernizr.indexeddb.deleteDatabase)) {
return false;
}
Expand Down