mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 960741 - Messages app fails to upgrade database (JS exception in upgradeSchema14) after updating from 1.2 to 1.3. r=gene
This commit is contained in:
parent
3f6b3b3be4
commit
527b087402
@ -191,7 +191,18 @@ MobileMessageDB.prototype = {
|
||||
break;
|
||||
case 13:
|
||||
if (DEBUG) debug("Upgrade to version 14. Fix the wrong participants.");
|
||||
// A workaround to check if we need to re-upgrade the DB schema 12. We missed this
|
||||
// because we didn't properly uplift that logic to b2g_v1.2 and errors could happen
|
||||
// when migrating b2g_v1.2 to b2g_v1.3. Please see Bug 960741 for details.
|
||||
self.needReUpgradeSchema12(event.target.transaction, function(isNeeded) {
|
||||
if (isNeeded) {
|
||||
self.upgradeSchema12(event.target.transaction, function() {
|
||||
self.upgradeSchema13(event.target.transaction, next);
|
||||
});
|
||||
} else {
|
||||
self.upgradeSchema13(event.target.transaction, next);
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 14:
|
||||
if (DEBUG) debug("Upgrade to version 15. Add deliveryTimestamp.");
|
||||
@ -902,6 +913,29 @@ MobileMessageDB.prototype = {
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Check if we need to re-upgrade the DB schema 12.
|
||||
*/
|
||||
needReUpgradeSchema12: function(transaction, callback) {
|
||||
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
|
||||
|
||||
messageStore.openCursor().onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (!cursor) {
|
||||
callback(false);
|
||||
return;
|
||||
}
|
||||
|
||||
let messageRecord = cursor.value;
|
||||
if (messageRecord.type == "mms" &&
|
||||
messageRecord.deliveryInfo === undefined) {
|
||||
callback(true);
|
||||
return;
|
||||
}
|
||||
cursor.continue();
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Fix the wrong participants.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user