Merge m-c to inbound.
authorRyan VanderMeulen <ryanvm@gmail.com>
Thu, 18 Apr 2013 15:40:18 -0400
changeset 129234 f8d27fe5d7c04b396b6798255b35aa384401e04c
parent 129233 f72c639ba397be34f785c6b14ab2d500f49df303 (current diff)
parent 129192 d1847d734c77f27ff11050b940f1d349a91f45c8 (diff)
child 129241 64d6d002e888b13d7ab4ed466aed528ca301e737
child 129242 022a5ed6195b457ee8caef8a5b3972ede82fc9f9
child 129259 3231056b600db918eb4b0cf5066ff67826b6e69b
push id24562
push userryanvm@gmail.com
push dateFri, 19 Apr 2013 01:24:04 +0000
treeherdermozilla-central@f8d27fe5d7c0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge m-c to inbound.
--- a/dom/contacts/ContactManager.js
+++ b/dom/contacts/ContactManager.js
@@ -383,18 +383,16 @@ function ContactManager()
 {
   if (DEBUG) debug("Constructor");
 }
 
 ContactManager.prototype = {
   __proto__: DOMRequestIpcHelper.prototype,
   _oncontactchange: null,
 
-  _cursorData: {},
-
   set oncontactchange(aCallback) {
     if (DEBUG) debug("set oncontactchange");
     let allowCallback = function() {
       if (!this._oncontactchange) {
         cpmm.sendAsyncMessage("Contacts:RegisterForMessages");
       }
       this._oncontactchange = aCallback;
     }.bind(this);
@@ -453,17 +451,20 @@ ContactManager.prototype = {
         if (req) {
           let result = this._convertContacts(contacts);
           Services.DOMRequest.fireSuccess(req.request, result);
         } else {
           if (DEBUG) debug("no request stored!" + msg.requestID);
         }
         break;
       case "Contacts:GetAll:Next":
-        let data = this._cursorData[msg.cursorId];
+        let data = this.getRequest(msg.cursorId);
+        if (!data) {
+          break;
+        }
         let result = contacts ? this._convertContacts(contacts) : [null];
         if (data.waitingForNext) {
           if (DEBUG) debug("cursor waiting for contact, sending");
           data.waitingForNext = false;
           let contact = result.shift();
           this._pushArray(data.cachedContacts, result);
           this.nextTick(this._fireSuccessOrDone.bind(this, data.cursor, contact));
         } else {
@@ -659,26 +660,25 @@ ContactManager.prototype = {
     let allowCallback = function() {
       cpmm.sendAsyncMessage("Contacts:Find", {requestID: this.getRequestId({request: request, reason: "find"}), options: options});
     }.bind(this)
     this.askPermission("find", request, allowCallback);
     return request;
   },
 
   createCursor: function CM_createCursor(aRequest) {
-    let id = this._getRandomId();
     let data = {
       cursor: Services.DOMRequest.createCursor(this._window, function() {
         this.handleContinue(id);
       }.bind(this)),
       cachedContacts: [],
       waitingForNext: true,
     };
+    let id = this.getRequestId(data);
     if (DEBUG) debug("saved cursor id: " + id);
-    this._cursorData[id] = data;
     return [id, data.cursor];
   },
 
   getAll: function CM_getAll(aOptions) {
     if (DEBUG) debug("getAll: " + JSON.stringify(aOptions));
     let [cursorId, cursor] = this.createCursor();
     let allowCallback = function() {
       cpmm.sendAsyncMessage("Contacts:GetAll", {
@@ -689,17 +689,17 @@ ContactManager.prototype = {
   },
 
   nextTick: function nextTick(aCallback) {
     Services.tm.currentThread.dispatch(aCallback, Ci.nsIThread.DISPATCH_NORMAL);
   },
 
   handleContinue: function CM_handleContinue(aCursorId) {
     if (DEBUG) debug("handleContinue: " + aCursorId);
-    let data = this._cursorData[aCursorId];
+    let data = this.getRequest(aCursorId);
     if (data.cachedContacts.length > 0) {
       if (DEBUG) debug("contact in cache");
       let contact = data.cachedContacts.shift();
       this.nextTick(this._fireSuccessOrDone.bind(this, data.cursor, contact));
       if (data.cachedContacts.length < CONTACTS_SENDMORE_MINIMUM) {
         cpmm.sendAsyncMessage("Contacts:GetAll:SendNow", { cursorId: aCursorId });
       }
     } else {