issue 96 New styles have a URL of undefined
This commit is contained in:
parent
cfa80ee785
commit
b7aa8b4b81
|
@ -198,12 +198,12 @@ function saveStyle(o, callback) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// create a new record
|
// create a new record
|
||||||
if (!("updateUrl" in o)) {
|
// set optional things to null if they're undefined
|
||||||
o.updateUrl = null;
|
["updateUrl", "md5Url", "url"].filter(function(att) {
|
||||||
}
|
return !(att in o);
|
||||||
if (!("md5Url" in o)) {
|
}).forEach(function(att) {
|
||||||
o.md5Url = null;
|
o[att] = null;
|
||||||
}
|
});
|
||||||
t.executeSql('INSERT INTO styles (name, enabled, url, updateUrl, md5Url) VALUES (?, ?, ?, ?, ?);', [o.name, true, o.url, o.updateUrl, o.md5Url]);
|
t.executeSql('INSERT INTO styles (name, enabled, url, updateUrl, md5Url) VALUES (?, ?, ?, ?, ?);', [o.name, true, o.url, o.updateUrl, o.md5Url]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,8 @@ function getDatabase(ready, error) {
|
||||||
dbV12(stylishDb, error, ready);
|
dbV12(stylishDb, error, ready);
|
||||||
} else if (stylishDb.version == "1.2") {
|
} else if (stylishDb.version == "1.2") {
|
||||||
dbV13(stylishDb, error, ready);
|
dbV13(stylishDb, error, ready);
|
||||||
|
} else if (stylishDb.version == "1.3") {
|
||||||
|
dbV14(stylishDb, error, ready);
|
||||||
} else {
|
} else {
|
||||||
ready(stylishDb);
|
ready(stylishDb);
|
||||||
}
|
}
|
||||||
|
@ -51,6 +53,12 @@ function dbV13(d, error, done) {
|
||||||
}, error, function() { done(d)});
|
}, error, function() { done(d)});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function dbV14(d, error, done) {
|
||||||
|
d.changeVersion(d.version, '1.4', function (t) {
|
||||||
|
t.executeSql('UPDATE styles SET url = null WHERE url = "undefined";');
|
||||||
|
}, error, function() { done(d)});
|
||||||
|
}
|
||||||
|
|
||||||
function enableStyle(id, enabled) {
|
function enableStyle(id, enabled) {
|
||||||
getDatabase(function(db) {
|
getDatabase(function(db) {
|
||||||
db.transaction(function (t) {
|
db.transaction(function (t) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user