From 4cdcca1a8d23dfaef529c419ec99a6d88d70f955 Mon Sep 17 00:00:00 2001 From: "David Humphrey (:humph) david.humphrey@senecacollege.ca" Date: Thu, 27 Nov 2014 10:30:57 -0500 Subject: [PATCH] Ensure test providers deal with missing callback early --- tests/lib/indexeddb.js | 3 ++- tests/lib/memory.js | 2 ++ tests/lib/websql.js | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) 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();