diff --git a/dom/activities/ActivitiesService.jsm b/dom/activities/ActivitiesService.jsm index 7250523dba7..8632b6de77d 100644 --- a/dom/activities/ActivitiesService.jsm +++ b/dom/activities/ActivitiesService.jsm @@ -67,15 +67,18 @@ ActivitiesDb.prototype = { let self = this; + /** + * WARNING!! Before upgrading the Activities DB take into account that an + * OTA unregisters all the activities and reinstalls them during the first + * run process. Check Bug 1193503. + */ + function upgrade(currentVersion) { let next = upgrade.bind(self, currentVersion + 1); switch (currentVersion) { case 0: self.createSchema(aDb, next); break; - case 1: - self.upgradeSchemaVersion2(aDb, aTransaction, next); - break; } } @@ -94,47 +97,6 @@ ActivitiesDb.prototype = { aNext(); }, - upgradeSchemaVersion2: function(aDb, aTransaction, aNext) { - debug("Upgrading DB to version 2"); - - // In order to be able to have multiple activities with same name - // but different descriptions, we need to update the keypath from - // a hash made from {manifest, name} to a hash made from {manifest, - // name, description}. - // - // Unfortunately, updating the keypath is not allowed by IDB, so we - // need to remove and recreate the activities object store. - - let activities = []; - let objectStore = aTransaction.objectStore(STORE_NAME); - objectStore.openCursor().onsuccess = (event) => { - let cursor = event.target.result; - if (!cursor) { - aDb.deleteObjectStore(STORE_NAME); - - let objectStore = aDb.createObjectStore(STORE_NAME, { keyPath: "id" }); - - // indexes - objectStore.createIndex("name", "name", { unique: false }); - objectStore.createIndex("manifest", "manifest", { unique: false }); - - this.add(activities, () => { - debug("DB upgraded to version 2"); - aNext(); - }, () => { - dump("Error upgrading DB to version 2 " + error + "\n"); - }); - return; - } - - let activity = cursor.value; - debug("Upgrading activity " + JSON.stringify(activity)); - activity.id = this.createId(activity); - activities.push(activity); - cursor.continue(); - }; - }, - // unique ids made of (uri, action) createId: function actdb_createId(aObject) { let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]