record import (cache) fix
authorDan Mills <thunder@mozilla.com>
Thu, 20 Nov 2008 09:14:42 +0900
changeset 45036 984947d2c9492f8759347ad1b2c244e1f9678471
parent 45035 f450255dc71031083768b341e9c4bd6fabfb93ae
child 45037 2e1d0b3d9e540bf5ee3312297f7767c4175868ee
push idunknown
push userunknown
push dateunknown
record import (cache) fix
services/sync/modules/base_records/crypto.js
--- a/services/sync/modules/base_records/crypto.js
+++ b/services/sync/modules/base_records/crypto.js
@@ -207,28 +207,29 @@ RecordManager.prototype = {
   _init: function RegordMgr__init() {
     this._log = Log4Moz.repository.getLogger(this._logName);
     this._records = {};
     this._aliases = {};
   },
 
   _import: function RegordMgr__import(url) {
     let self = yield;
+    let rec;
 
     this._log.trace("Importing record: " + (url.spec? url.spec : url));
 
     try {
-      let rec = new this._recordType(url);
+      rec = new this._recordType(url);
       yield rec.get(self.cb);
       this.set(url, rec);
-      self.done(rec);
     } catch (e) {
       this._log.debug("Failed to import record: " + e);
-      self.done(null);
+      rec = null;
     }
+    self.done(rec);
   },
   import: function RegordMgr_import(onComplete, url) {
     this._import.async(this, onComplete, url);
   },
 
   _get: function RegordMgr__get(url) {
     let self = yield;