Ensure test providers deal with missing callback early

This commit is contained in:
David Humphrey (:humph) david.humphrey@senecacollege.ca 2014-11-27 10:30:57 -05:00
parent b1cf2d7dfb
commit 4cdcca1a8d
3 changed files with 7 additions and 1 deletions

View File

@ -17,6 +17,8 @@ function IndexedDBTestProvider(name) {
var that = this;
function cleanup(callback) {
callback = callback || function(){};
if(!that.provider || _done) {
return callback();
}
@ -27,7 +29,6 @@ function IndexedDBTestProvider(name) {
that.provider.db.close();
}
callback = callback || function(){};
var request = indexedDB.deleteDatabase(name);
function finished() {
that.provider = null;

View File

@ -4,6 +4,8 @@ function MemoryTestProvider(name) {
var that = this;
function cleanup(callback) {
callback = callback || function(){};
that.provider = null;
callback();
}

View File

@ -12,9 +12,12 @@ function WebSQLTestProvider(name) {
var that = this;
function cleanup(callback) {
callback = callback || function(){};
if(!that.provider || _done) {
return callback();
}
// Provider is there, but db was never touched
if(!that.provider.db) {
return callback();