Bug 1149896 - Avoid warnings when using sendAsyncMessage on a ReadingListItem object. r=adw, a=sledru
authorMark Hammond <mhammond@skippinet.com.au>
Wed, 08 Apr 2015 11:15:23 +1000
changeset 258403 bbbb9f84cf98
parent 258402 bf83a8535bf4
child 258404 6ab02e48d0c2
push id4659
push userryanvm@gmail.com
push date2015-04-09 15:23 +0000
treeherdermozilla-beta@58dca3f7560a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersadw, sledru
bugs1149896
milestone38.0
Bug 1149896 - Avoid warnings when using sendAsyncMessage on a ReadingListItem object. r=adw, a=sledru
browser/components/readinglist/ReadingList.jsm
--- a/browser/components/readinglist/ReadingList.jsm
+++ b/browser/components/readinglist/ReadingList.jsm
@@ -341,17 +341,17 @@ ReadingListImpl.prototype = {
 
     log.debug("Adding item with guid: ${guid}, url: ${url}", record);
     yield this._store.addItem(record);
     log.trace("Added item with guid: ${guid}, url: ${url}", record);
     this._invalidateIterators();
     let item = this._itemFromRecord(record);
     this._callListeners("onItemAdded", item);
     let mm = Cc["@mozilla.org/globalmessagemanager;1"].getService(Ci.nsIMessageListenerManager);
-    mm.broadcastAsyncMessage("Reader:Added", item);
+    mm.broadcastAsyncMessage("Reader:Added", item.toJSON());
     return item;
   }),
 
   /**
    * Updates the properties of an item that belongs to the list.
    *
    * The passed-in item may have as few or as many properties that you want to
    * set; only the properties that are present are updated.  The item must have
@@ -422,17 +422,17 @@ ReadingListImpl.prototype = {
     item.list = null;
     item._deleted = true;
     // failing to remove the item from the map points at something bad!
     if (!this._itemsByNormalizedURL.delete(item.url)) {
       log.error("Failed to remove item from the map", item);
     }
     this._invalidateIterators();
     let mm = Cc["@mozilla.org/globalmessagemanager;1"].getService(Ci.nsIMessageListenerManager);
-    mm.broadcastAsyncMessage("Reader:Removed", item);
+    mm.broadcastAsyncMessage("Reader:Removed", item.toJSON());
     this._callListeners("onItemDeleted", item);
   }),
 
   /**
    * Finds the first item that matches the given options.
    *
    * @param optsList See Options Objects.
    * @return The first matching item, or null if there are no matching items.