Back out 648e3888d9bd
authorDrew Willcoxon <adw@mozilla.com>
Fri, 20 Mar 2015 15:23:34 -0700
changeset 263732 a10307812cf83699cab915dacc4511596368397c
parent 263731 531fe47e635bfc99bea79bfd6f17577351d840f7
child 263733 07f9d9dd82d34edba808ccfb9448ea2bab3c6c11
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone39.0a1
backs out648e3888d9bde4602931496d3c439965dcc7a788
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
Back out 648e3888d9bd
browser/base/content/browser-readinglist.js
browser/components/readinglist/ReadingList.jsm
--- a/browser/base/content/browser-readinglist.js
+++ b/browser/base/content/browser-readinglist.js
@@ -287,17 +287,17 @@ let ReadingListUI = {
    */
   togglePageByBrowser: Task.async(function* (browser) {
     let uri = browser.currentURI;
     if (uri.spec.startsWith("about:reader?"))
       uri = ReaderParent.parseReaderUrl(uri.spec);
     if (!uri)
       return;
 
-    let item = yield ReadingList.itemForURL(uri);
+    let item = yield ReadingList.getItemForURL(uri);
     if (item) {
       yield item.delete();
     } else {
       yield ReadingList.addItemFromBrowser(browser, uri);
     }
   }),
 
   /**
--- a/browser/components/readinglist/ReadingList.jsm
+++ b/browser/components/readinglist/ReadingList.jsm
@@ -315,17 +315,17 @@ ReadingListImpl.prototype = {
     let record = {
       url: url,
       title: metadata.title,
       resolvedURL: metadata.url,
       excerpt: metadata.description,
     };
 
     if (metadata.previews.length > 0) {
-      record.preview = metadata.previews[0];
+      itemData.preview = metadata.previews[0];
     }
 
     return (yield this.addItem(record));
   }),
 
   /**
    * Adds a listener that will be notified when the list changes.  Listeners
    * are objects with the following optional methods:
@@ -846,30 +846,28 @@ ReadingListItemIterator.prototype = {
  * Normalizes the properties of a record object, which represents a
  * ReadingListItem.  Throws an error if the record contains properties that
  * aren't in ITEM_RECORD_PROPERTIES.
  *
  * @param record A non-normalized record object.
  * @return The new normalized record.
  */
 function normalizeRecord(nonNormalizedRecord) {
-  let record = {};
   for (let prop in nonNormalizedRecord) {
     if (!ITEM_RECORD_PROPERTIES.includes(prop)) {
       throw new Error("Unrecognized item property: " + prop);
     }
-    switch (prop) {
-    case "url":
-    case "resolvedURL":
-      record[prop] = normalizeURI(nonNormalizedRecord[prop]).spec;
-      break;
-    default:
-      record[prop] = nonNormalizedRecord[prop];
-      break;
-    }
+  }
+
+  let record = clone(nonNormalizedRecord);
+  if (record.url) {
+    record.url = normalizeURI(record.url).spec;
+  }
+  if (record.resolvedURL) {
+    record.resolvedURL = normalizeURI(record.resolvedURL).spec;
   }
   return record;
 }
 
 /**
  * Normalize a URI, stripping away extraneous parts we don't want to store
  * or compare against.
  *