Avoid migrating WebSQL if it didn't exist #167

This commit is contained in:
Jason 2016-03-17 21:53:30 -05:00
parent 15407c4cde
commit 928d02df5c

View File

@ -31,6 +31,10 @@ var webSqlStorage = {
getStyles: function(callback) { getStyles: function(callback) {
webSqlStorage.getDatabase(function(db) { webSqlStorage.getDatabase(function(db) {
if (!db) {
callback([]);
return;
}
db.readTransaction(function (t) { db.readTransaction(function (t) {
var where = ""; var where = "";
var params = []; var params = [];
@ -92,7 +96,12 @@ var webSqlStorage = {
error(); error();
throw ex; throw ex;
} }
if (stylishDb.version == "1.0" || stylishDb.version == "") { if (stylishDb.version == "") {
// It didn't already exist, we have nothing to migrate.
ready(null);
return;
}
if (stylishDb.version == "1.0") {
webSqlStorage.dbV11(stylishDb, error, ready); webSqlStorage.dbV11(stylishDb, error, ready);
} else if (stylishDb.version == "1.1") { } else if (stylishDb.version == "1.1") {
webSqlStorage.dbV12(stylishDb, error, ready); webSqlStorage.dbV12(stylishDb, error, ready);