Bug 1133429 - [ReadingList] Store image URL in the ReadingList sqlite database. r=markh, a=KWierso. a=readinglist
authorJared Wein <jwein@mozilla.com>
Thu, 19 Mar 2015 15:50:38 -0700
changeset 248442 7ed35febcb504b460ceed21b8e4aaa565150a9e3
parent 248441 73a88d5a05d3ced5caf3b51c85773defe86eacc1
child 248443 6f97fe51dff7a52045be7c7b33960ac0c31ee4a5
push id7837
push userjwein@mozilla.com
push dateFri, 27 Mar 2015 00:27:16 +0000
treeherdermozilla-aurora@cb0db44ce60e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarkh, KWierso, readinglist
bugs1133429
milestone38.0a2
Bug 1133429 - [ReadingList] Store image URL in the ReadingList sqlite database. r=markh, a=KWierso. a=readinglist
browser/components/readinglist/ReadingList.jsm
browser/components/readinglist/SQLiteStore.jsm
--- a/browser/components/readinglist/ReadingList.jsm
+++ b/browser/components/readinglist/ReadingList.jsm
@@ -37,16 +37,17 @@ let log = Log.repository.getLogger("read
 const ITEM_BASIC_PROPERTY_NAMES = `
   guid
   lastModified
   url
   title
   resolvedURL
   resolvedTitle
   excerpt
+  preview
   status
   favorite
   isArticle
   wordCount
   unread
   addedBy
   addedOn
   storedOn
@@ -298,22 +299,18 @@ ReadingListImpl.prototype = {
     let metadata = yield getMetadataFromBrowser(browser);
     let itemData = {
       url: url,
       title: metadata.title,
       resolvedURL: metadata.url,
       excerpt: metadata.description,
     };
 
-    if (metadata.description) {
-      itemData.exerpt = metadata.description;
-    }
-
     if (metadata.previews.length > 0) {
-      itemData.image = metadata.previews[0];
+      itemData.preview = metadata.previews[0];
     }
 
     let item = yield ReadingList.addItem(itemData);
     return item;
   }),
 
   /**
    * Adds a listener that will be notified when the list changes.  Listeners
@@ -913,14 +910,14 @@ function getMetadataFromBrowser(browser)
     mm.addMessageListener("PageMetadata:PageDataResult", handleResult);
     mm.sendAsyncMessage("PageMetadata:GetPageData");
   });
 }
 
 Object.defineProperty(this, "ReadingList", {
   get() {
     if (!this._singleton) {
-      let store = new SQLiteStore("reading-list-temp.sqlite");
+      let store = new SQLiteStore("reading-list-temp2.sqlite");
       this._singleton = new ReadingListImpl(store);
     }
     return this._singleton;
   },
 });
--- a/browser/components/readinglist/SQLiteStore.jsm
+++ b/browser/components/readinglist/SQLiteStore.jsm
@@ -199,17 +199,18 @@ this.SQLiteStore.prototype = {
         isArticle BOOLEAN,
         wordCount INTEGER,
         unread BOOLEAN,
         addedBy TEXT,
         addedOn INTEGER,
         storedOn INTEGER,
         markedReadBy TEXT,
         markedReadOn INTEGER,
-        readPosition INTEGER
+        readPosition INTEGER,
+        preview TEXT
       );
     `);
     yield conn.execute(`
       CREATE INDEX items_addedOn ON items (addedOn);
     `);
     yield conn.execute(`
       CREATE INDEX items_unread ON items (unread);
     `);