зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1354536 - Part 2 - Add an option to ActivityStreamLinks.getHighlights() to allow results to be returned including favicons. r=Mardak
MozReview-Commit-ID: 5NCTCtooScy --HG-- extra : rebase_source : b01f5e74b29d43fc8635919f1618e0cf2980b85b
This commit is contained in:
Родитель
53ef359a19
Коммит
9cb7adbcfc
|
@ -1296,6 +1296,7 @@ var ActivityStreamLinks = {
|
|||
* @param {Object} aOptions
|
||||
* {bool} excludeBookmarks: Don't add bookmark items.
|
||||
* {bool} excludeHistory: Don't add history items.
|
||||
* {bool} withFavicons: Add favicon data: URIs, when possible.
|
||||
* {int} numItems: Maximum number of (bookmark or history) items to return.
|
||||
*
|
||||
* @return {Promise} Returns a promise with the array of links as the payload
|
||||
|
@ -1328,6 +1329,11 @@ var ActivityStreamLinks = {
|
|||
}
|
||||
}
|
||||
|
||||
if (aOptions.withFavicons) {
|
||||
return ActivityStreamProvider._faviconBytesToDataURI(
|
||||
await ActivityStreamProvider._addFavicons(results));
|
||||
}
|
||||
|
||||
return results;
|
||||
},
|
||||
|
||||
|
|
|
@ -478,6 +478,15 @@ add_task(async function getHighlights() {
|
|||
Assert.equal(links[0].type, "bookmark", "was history now bookmark");
|
||||
Assert.equal(links[1].url, bookmarks[1].url, "still have younger bookmark now second");
|
||||
Assert.equal(links[2].url, bookmarks[0].url, "still have older bookmark now third");
|
||||
|
||||
// Test the `withFavicons` option.
|
||||
links = await provider.getHighlights({ withFavicons: true });
|
||||
Assert.equal(links.length, 3, "We're not expecting a change in links");
|
||||
// We don't have the favicon service all bootstrapped and that's unnecessary
|
||||
// for this unit.
|
||||
Assert.ok("favicon" in links[0], "Link 1 should contain a favicon");
|
||||
Assert.ok("favicon" in links[1], "Link 2 should contain a favicon");
|
||||
Assert.ok("favicon" in links[2], "Link 3 should contain a favicon");
|
||||
});
|
||||
|
||||
add_task(async function getTopFrecentSites() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче