diff --git a/lib/PlacesProvider.js b/lib/PlacesProvider.js index f7d1f9951..278c3a061 100644 --- a/lib/PlacesProvider.js +++ b/lib/PlacesProvider.js @@ -196,15 +196,16 @@ Links.prototype = { let sqlQuery = `SELECT moz_places.url as url, moz_favicons.data as favicon, - mime_type as mimeType, + moz_favicons.mime_type as mimeType, moz_places.title, - frecency, - last_visit_date as lastVisitDate, + moz_places.frecency, + moz_places.last_visit_date as lastVisitDate, "history" as type, - moz_bookmarks.id as bookmark + moz_bookmarks.guid as bookmarkGuid, + moz_bookmarks.dateAdded / 1000 as bookmarkDateCreated FROM moz_places LEFT JOIN moz_favicons - ON favicon_id = moz_favicons.id + ON moz_places.favicon_id = moz_favicons.id LEFT JOIN moz_bookmarks ON moz_places.id = moz_bookmarks.fk WHERE hidden = 0 AND last_visit_date NOTNULL @@ -212,7 +213,8 @@ Links.prototype = { LIMIT :limit`; let links = yield this.executePlacesQuery(sqlQuery, { - columns: ["url", "favicon", "mimeType", "title", "lastVisitDate", "frecency", "type", "bookmark"], + columns: ["url", "favicon", "mimeType", "title", "lastVisitDate", + "frecency", "type", "bookmarkGuid", "bookmarkDateCreated"], params: {limit: limit} }); diff --git a/test/test-PlacesProvider.js b/test/test-PlacesProvider.js index d151da5a8..7341bb9ea 100644 --- a/test/test-PlacesProvider.js +++ b/test/test-PlacesProvider.js @@ -138,7 +138,7 @@ exports.test_Links_getRecentLinks = function*(assert) { yield PlacesTestUtils.addFavicons(faviconData); // insert a bookmark - yield Bookmarks.insert({url: "https://mozilla1.com/0", parentGuid: "root________", type: Bookmarks.TYPE_BOOKMARK}); + let bookmark = yield Bookmarks.insert({url: "https://mozilla1.com/0", parentGuid: "root________", type: Bookmarks.TYPE_BOOKMARK}); links = yield provider.getRecentLinks(); assert.equal(links.length, visits.length, "number of links added is the same as obtain by getRecentLinks"); @@ -147,7 +147,8 @@ exports.test_Links_getRecentLinks = function*(assert) { assert.equal(links[2].url, "https://mozilla3.com/2", "Expected 3-rd link"); assert.equal(links[3].url, "https://mozilla4.com/3", "Expected 4-th link"); assert.equal(faviconData[links[2].url], links[2].favicon, "favicon data is stored as expected"); - assert.ok(links[1].bookmark != null, "expected non-null bookmark for second link"); + assert.equal(links[1].bookmarkGuid, bookmark.guid, "expected bookmark guid for second link"); + assert.equal(links[1].bookmarkDateCreated, new Date(bookmark.dateAdded).getTime(), "expected bookmark date for second link"); assert.ok(!(links[0].bookmark || links[2].bookmark || links[3].bookmark), "other bookmarks are empty"); };