Backout changeset ef21d6f2187d to correct bug number
authorEd Morley <bmo@edmorley.co.uk>
Fri, 07 Oct 2011 12:36:44 +0100
changeset 78975 ae27b467720cbab0b130073b7431181921b4e517
parent 78974 6bae7a490cb0746427dba87eb4b2c3255e95848a
child 78976 97f2cd5ea1ee1a16087ea792c340fd1786d10182
push id506
push userclegnitto@mozilla.com
push dateWed, 09 Nov 2011 02:03:18 +0000
treeherdermozilla-aurora@63587fc7bb93 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone10.0a1
backs outef21d6f2187d8746aa4e90879ac1e51841d11d14
Backout changeset ef21d6f2187d to correct bug number
toolkit/mozapps/extensions/AddonRepository.jsm
toolkit/mozapps/extensions/test/xpcshell/test_migrateAddonRepository.js
--- a/toolkit/mozapps/extensions/AddonRepository.jsm
+++ b/toolkit/mozapps/extensions/AddonRepository.jsm
@@ -1326,25 +1326,25 @@ var AddonDatabase = {
    */
   openConnection: function AD_openConnection(aSecondAttempt) {
     this.initialized = true;
     delete this.connection;
 
     let dbfile = FileUtils.getFile(KEY_PROFILEDIR, [FILE_DATABASE], true);
     let dbMissing = !dbfile.exists();
 
-    var tryAgain = (function() {
+    function tryAgain() {
       LOG("Deleting database, and attempting openConnection again");
       this.initialized = false;
       if (this.connection.connectionReady)
         this.connection.close();
       if (dbfile.exists())
         dbfile.remove(false);
       return this.openConnection(true);
-    }).bind(this);
+    }
 
     try {
       this.connection = Services.storage.openUnsharedDatabase(dbfile);
     } catch (e) {
       this.initialized = false;
       ERROR("Failed to open database", e);
       if (aSecondAttempt || dbMissing) {
         this.databaseOk = false;
--- a/toolkit/mozapps/extensions/test/xpcshell/test_migrateAddonRepository.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_migrateAddonRepository.js
@@ -1,21 +1,19 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
-const EXPECTED_SCHEMA_VERSION = 2;
-let dbfile;
 
 function run_test() {
   do_test_pending();
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
 
   // Write out a minimal database.
-  dbfile = gProfD.clone();
+  let dbfile = gProfD.clone();
   dbfile.append("addons.sqlite");
   let db = AM_Cc["@mozilla.org/storage/service;1"].
            getService(AM_Ci.mozIStorageService).
            openDatabase(dbfile);
 
   db.createTable("addon",
                  "internal_id INTEGER PRIMARY KEY AUTOINCREMENT, " +
                  "id TEXT UNIQUE, " +
@@ -80,61 +78,27 @@ function run_test() {
 
   Services.obs.addObserver({
     observe: function () {
       Services.obs.removeObserver(this, "addon-repository-shutdown");
       // Check the DB schema has changed once AddonRepository has freed it.
       db = AM_Cc["@mozilla.org/storage/service;1"].
            getService(AM_Ci.mozIStorageService).
            openDatabase(dbfile);
-      do_check_eq(db.schemaVersion, EXPECTED_SCHEMA_VERSION);
+      do_check_eq(db.schemaVersion, 2);
       do_check_true(db.indexExists("developer_idx"));
       do_check_true(db.indexExists("screenshot_idx"));
       db.close();
-      run_test_2();
+      do_test_finished();
     }
   }, "addon-repository-shutdown", null);
 
   Services.prefs.setBoolPref("extensions.getAddons.cache.enabled", true);
   AddonRepository.getCachedAddonByID("test1@tests.mozilla.org", function (aAddon) {
     do_check_neq(aAddon, null);
     do_check_eq(aAddon.screenshots.length, 1);
     do_check_true(aAddon.screenshots[0].width === null);
     do_check_true(aAddon.screenshots[0].height === null);
     do_check_true(aAddon.screenshots[0].thumbnailWidth === null);
     do_check_true(aAddon.screenshots[0].thumbnailHeight === null);
     AddonRepository.shutdown();
   });
 }
-
-function run_test_2() {
-  // Write out a minimal database.
-  let db = AM_Cc["@mozilla.org/storage/service;1"].
-           getService(AM_Ci.mozIStorageService).
-           openDatabase(dbfile);
-
-  db.createTable("futuristicSchema",
-                 "id INTEGER, " +
-                 "sharks TEXT, " +
-                 "lasers TEXT");
-
-  db.schemaVersion = 1000;
-  db.close();
-
-  Services.obs.addObserver({
-    observe: function () {
-      Services.obs.removeObserver(this, "addon-repository-shutdown");
-      // Check the DB schema has changed once AddonRepository has freed it.
-      db = AM_Cc["@mozilla.org/storage/service;1"].
-           getService(AM_Ci.mozIStorageService).
-           openDatabase(dbfile);
-      do_check_eq(db.schemaVersion, EXPECTED_SCHEMA_VERSION);
-      db.close();
-      do_test_finished();
-    }
-  }, "addon-repository-shutdown", null);
-
-  // Force a connection to the addon database to be opened.
-  Services.prefs.setBoolPref("extensions.getAddons.cache.enabled", true);
-  AddonRepository.getCachedAddonByID("test1@tests.mozilla.org", function (aAddon) {
-    AddonRepository.shutdown();
-  });
-}