Bug 1133429 - [ReadingList] Store image URL in the ReadingList sqlite database. r=markh, a=KWierso.
authorJared Wein <jwein@mozilla.com>
Thu, 19 Mar 2015 15:50:38 -0700
changeset 251835 ad7b242dfaf79224da1436055855f635c99fd6fd
parent 251834 cc408bbacbd940ca014f00aa70644c2e3aff4d29
child 251836 6f2e247fb7b7be87a825ebaa97b35126d5faf9d8
push id1156
push userpbrosset@mozilla.com
push dateFri, 20 Mar 2015 16:00:24 +0000
reviewersmarkh, KWierso
bugs1133429
milestone39.0a1
Bug 1133429 - [ReadingList] Store image URL in the ReadingList sqlite database. r=markh, a=KWierso.
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);
     `);