diff --git a/tests/lib/indexeddb.js b/tests/lib/indexeddb.js index 251729f..77ff3ea 100644 --- a/tests/lib/indexeddb.js +++ b/tests/lib/indexeddb.js @@ -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; diff --git a/tests/lib/memory.js b/tests/lib/memory.js index 19d25b6..ccfa2cd 100644 --- a/tests/lib/memory.js +++ b/tests/lib/memory.js @@ -4,6 +4,8 @@ function MemoryTestProvider(name) { var that = this; function cleanup(callback) { + callback = callback || function(){}; + that.provider = null; callback(); } diff --git a/tests/lib/websql.js b/tests/lib/websql.js index 9bc7c93..5d2a189 100644 --- a/tests/lib/websql.js +++ b/tests/lib/websql.js @@ -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();