Merge pull request #330 from humphd/cleanup-callback

Ensure test providers deal with missing callback early
This commit is contained in:
Alan K 2014-11-27 11:20:50 -05:00
commit 76d256f744
3 changed files with 7 additions and 1 deletions

View File

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

View File

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

View File

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