Bug 1476309 - use RemoteSettings for Tippy Top #4241
Conversation
|
LGTM! @leplatrem, could you also take a look at this please (the client side change of bug 1437671)? The key change of this patch is that we use RemoteSettings to replace the old JSON Tippytop manifest (manually sync'd to its origin on S3). Note that since the Tippytop functionality is not sensitive to the data latency (add/update/delete) in Activity Stream, we completely rely on the default syncing strategy of RS. We've also removed the memory cache for the Tippytop manifest, and implemented the lookup directly on top of Would love to hear your thoughts on those changes. |
|
It looks good ! Nice refactor indeed :) |
| @@ -246,21 +152,27 @@ this.FaviconFeed = class FaviconFeed { | |||
| } | |||
| } | |||
|
|
|||
| async getSite(domain) { | |||
| const sites = await this.tippyTop.get({filters: {"domain": domain}}); | |||
leplatrem
Jul 16, 2018
Contributor
nitpick: could also be shortened as this.tippyTop.get({filters: {domain}});
nitpick: could also be shortened as this.tippyTop.get({filters: {domain}});
| let iconUri = Services.io.newURI(sitesByDomain[domain].image_url); | ||
| const site = await this.getSite(getDomain(url)); | ||
|
|
||
| if (site) { |
leplatrem
Jul 16, 2018
Contributor
nitpick: since the rest of the function is useless when site is null, maybe:
if (!site) {
return;
}
nitpick: since the rest of the function is useless when site is null, maybe:
if (!site) {
return;
}| it("should lazy init _tippyTop", async () => { | ||
| assert.isUndefined(feed._tippyTop); | ||
| await feed.getSite("example.com"); | ||
| assert.ok(feed._tippyTop); | ||
| }); |
leplatrem
Jul 16, 2018
Contributor
An alternative to this would be to store records in the local db:
const collection = await RemoteSettings("tippytop").openCollection();
await collection.create({
domain,
image_url: `${url}/icon.png`
});
But this may require to setup IndexedDB in your tests suite, which may not be obvious
An alternative to this would be to store records in the local db:
const collection = await RemoteSettings("tippytop").openCollection();
await collection.create({
domain,
image_url: `${url}/icon.png`
});But this may require to setup IndexedDB in your tests suite, which may not be obvious
@ncloudioj to test it out, you need to change the prefs for RS. I just run the following in the browser console: