Update Based on group debugging it's likely you're testing your IDB code in a window-less Firefox environment. Because IDB depends on the window to create it's sandboxed security environment, you cannot run IDB in such an environment.
Interestingly, I'm able to reproduce the Firefox "TypeError: indexedDB is null" @Christoph mentions when using JSFiddle for both prefixed and unprefixed indexedDB
interfaces.
Same code, reproduced below, works fine in Chrome. And, strangely, works fine in FF when executed directly from the console
var DB_NAME = 'dbName';
var DB_VERSION = 1;
var DB_STORE_NAME = 'dbStore';
var db;
try {
var req = self.indexedDB.open(DB_NAME, DB_VERSION);
req.onsuccess = function (evt) {
db = this.result;
console.log('success', evt.target.result);
};
req.onerror = function (evt) {
console.error("error", evt);
};
req.onblocked = function (evt) {
console.log('blocked', evt);
};
} catch (err) {
console.error(err.name, err.message);
}
Try running your code in a FF console and see if you can confirm. And in the meantime, I'm curious, in what environment are you seeing this error?