Bug 895994 - Add a missing .bind(this) to ContactDB's upgrade code. r=gwagner a=leo+
authorReuben Morais <reuben.morais@gmail.com>
Thu, 25 Jul 2013 17:44:33 -0700
changeset 119808 d6e518d3ef287c7ba43635449b370753dd0a3822
parent 119807 7d759454371cf29ead9a496c517ec61e2a1a7bfe
child 119809 91e7d386f7543dac4aa8e761e5e567c01ec5449e
push id1005
push userreuben.morais@gmail.com
push dateFri, 26 Jul 2013 00:44:43 +0000
reviewersgwagner, leo
bugs895994
milestone18.1
Bug 895994 - Add a missing .bind(this) to ContactDB's upgrade code. r=gwagner a=leo+
dom/contacts/fallback/ContactDB.jsm
--- a/dom/contacts/fallback/ContactDB.jsm
+++ b/dom/contacts/fallback/ContactDB.jsm
@@ -88,17 +88,17 @@ this.ContactDB = function ContactDB(aGlo
 }
 
 ContactDB.prototype = {
   __proto__: IndexedDBHelper.prototype,
 
   _dispatcher: {},
 
   upgradeSchema: function upgradeSchema(aTransaction, aDb, aOldVersion, aNewVersion) {
-    function loadInitialContacts() {
+    let loadInitialContacts = function() {
       // Add default contacts
       let jsm = {};
       Cu.import("resource://gre/modules/FileUtils.jsm", jsm);
       Cu.import("resource://gre/modules/NetUtil.jsm", jsm);
       // Loading resource://app/defaults/contacts.json doesn't work because
       // contacts.json is not in the omnijar.
       // So we look for the app dir instead and go from here...
       let contactsFile = jsm.FileUtils.getFile("DefRt", ["contacts.json"], false);
@@ -137,17 +137,17 @@ ContactDB.prototype = {
         contact.id = idService.generateUUID().toString().replace('-', '', 'g')
                                                         .replace('{', '')
                                                         .replace('}', '');
         contact = this.makeImport(contact);
         this.updateRecordMetadata(contact);
         if (DEBUG) debug("import: " + JSON.stringify(contact));
         objectStore.put(contact);
       }
-    }
+    }.bind(this);
 
     if (DEBUG) debug("upgrade schema from: " + aOldVersion + " to " + aNewVersion + " called!");
     let db = aDb;
     let objectStore;
 
     let steps = [
       function upgrade0to1() {
         /**