Bug 1606928 - Modify the Top Sites API to store a favicon for “Tippy Top Sites". r=Mardak,dao

This patch uses the favicons as actually served by the sites. I tried to get 32x32 versions where possible, but a few are smaller and larger. There's also a mix of .ico and .png. I think the inconsistency is acceptable, and even desirable, seeing as these are the actual icons that would appear in the UrlbarView should they appear in the user's frecency results.

Differential Revision: https://phabricator.services.mozilla.com/D60421

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Harry Twyford 2020-02-05 13:18:55 +00:00
Родитель 4c46b448a8
Коммит 32eca717ec
28 изменённых файлов: 71 добавлений и 38 удалений

Просмотреть файл

@ -35,6 +35,7 @@ var gExceptionPaths = [
// https://github.com/mozilla/activity-stream/issues/3053
"resource://activity-stream/data/content/tippytop/images/",
"resource://activity-stream/data/content/tippytop/favicons/",
// These resources are referenced by messages delivered through Remote Settings
"resource://activity-stream/data/content/assets/remote/",

Просмотреть файл

@ -254,7 +254,7 @@ add_task(async function test_topSites_newtab_visits_favicons() {
url: "https://amazon.com",
title: "@amazon",
favicon:
"resource://activity-stream/data/content/tippytop/images/amazon@2x.png",
"resource://activity-stream/data/content/tippytop/favicons/amazon.ico",
},
{
type: "url",
@ -273,35 +273,35 @@ add_task(async function test_topSites_newtab_visits_favicons() {
url: "https://www.youtube.com/",
title: "youtube",
favicon:
"resource://activity-stream/data/content/tippytop/images/youtube-com@2x.png",
"resource://activity-stream/data/content/tippytop/favicons/youtube-com.png",
},
{
type: "url",
url: "https://www.facebook.com/",
title: "facebook",
favicon:
"resource://activity-stream/data/content/tippytop/images/facebook-com@2x.png",
"resource://activity-stream/data/content/tippytop/favicons/facebook-com.ico",
},
{
type: "url",
url: "https://www.reddit.com/",
title: "reddit",
favicon:
"resource://activity-stream/data/content/tippytop/images/reddit-com@2x.png",
"resource://activity-stream/data/content/tippytop/favicons/reddit-com.png",
},
{
type: "url",
url: "https://www.wikipedia.org/",
title: "wikipedia",
favicon:
"resource://activity-stream/data/content/tippytop/images/wikipedia-org@2x.png",
"resource://activity-stream/data/content/tippytop/favicons/wikipedia-org.ico",
},
{
type: "url",
url: "https://twitter.com/",
title: "twitter",
favicon:
"resource://activity-stream/data/content/tippytop/images/twitter-com@2x.png",
"resource://activity-stream/data/content/tippytop/favicons/twitter-com.ico",
},
];
@ -347,7 +347,7 @@ add_task(async function test_topSites_newtab_visits_favicons_limit() {
url: "https://amazon.com",
title: "@amazon",
favicon:
"resource://activity-stream/data/content/tippytop/images/amazon@2x.png",
"resource://activity-stream/data/content/tippytop/favicons/amazon.ico",
},
{
type: "url",

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.2 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.1 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 5.3 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 17 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 958 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.6 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 5.3 KiB

Двоичные данные
browser/components/newtab/data/content/tippytop/favicons/ebay.ico Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 5.3 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 5.3 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 454 B

Двоичные данные
browser/components/newtab/data/content/tippytop/favicons/ok-ru.ico Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 5.3 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 5.3 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.0 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.6 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 302 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.7 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.7 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 826 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 348 B

Просмотреть файл

@ -2,106 +2,127 @@
{
"title": "aliexpress",
"url": "https://www.aliexpress.com/",
"image_url": "aliexpress-com@2x.png"
"image_url": "images/aliexpress-com@2x.png",
"favicon_url": "favicons/aliexpress-com.ico"
},
{
"title": "allegro",
"url": "https://www.allegro.pl/",
"image_url": "allegro-pl@2x.png"
"image_url": "images/allegro-pl@2x.png",
"favicon_url": "favicons/allegro-pl.ico"
},
{
"title": "amazon",
"urls": ["https://www.amazon.ca/", "https://www.amazon.co.uk/", "https://www.amazon.com/", "https://www.amazon.de/", "https://www.amazon.fr/"],
"image_url": "amazon@2x.png"
"image_url": "images/amazon@2x.png",
"favicon_url": "favicons/amazon.ico"
},
{
"title": "avito",
"url": "https://www.avito.ru/",
"image_url": "avito-ru@2x.png"
"image_url": "images/avito-ru@2x.png",
"favicon_url": "favicons/avito-ru.ico"
},
{
"title": "baidu",
"url": "https://www.baidu.com/",
"image_url": "baidu-com@2x.png"
"image_url": "images/baidu-com@2x.png",
"favicon_url": "favicons/baidu-com.ico"
},
{
"title": "bbc",
"url": "https://www.bbc.co.uk/",
"image_url": "bbc-uk@2x.png"
"image_url": "images/bbc-uk@2x.png",
"favicon_url": "favicons/bbc-uk.ico"
},
{
"title": "bing",
"url": "https://www.bing.com/",
"image_url": "bing-com@2x.png"
"image_url": "images/bing-com@2x.png",
"favicon_url": "favicons/bing-com.ico"
},
{
"title": "duckduckgo",
"url": "https://www.duckduckgo.com/",
"image_url": "duckduckgo-com@2x.png"
"image_url": "images/duckduckgo-com@2x.png",
"favicon_url": "favicons/duckduckgo-com.ico"
},
{
"title": "ebay",
"urls": ["https://www.ebay.com", "https://www.ebay.co.uk/", "https://ebay.de"],
"image_url": "ebay@2x.png"
"image_url": "images/ebay@2x.png",
"favicon_url": "favicons/ebay.ico"
},
{
"title": "facebook",
"url": "https://www.facebook.com/",
"image_url": "facebook-com@2x.png"
"image_url": "images/facebook-com@2x.png",
"favicon_url": "favicons/facebook-com.ico"
},
{
"title": "google",
"url": "https://www.google.com/",
"image_url": "google-com@2x.png"
"image_url": "images/google-com@2x.png",
"favicon_url": "favicons/google-com.ico"
},
{
"title": "leboncoin",
"url": "http://www.leboncoin.fr/",
"image_url": "leboncoin-fr@2x.png"
"image_url": "images/leboncoin-fr@2x.png",
"favicon_url": "favicons/leboncoin-fr.png"
},
{
"title": "ok",
"url": "https://www.ok.ru/",
"image_url": "ok-ru@2x.png"
"image_url": "images/ok-ru@2x.png",
"favicon_url": "favicons/ok-ru.ico"
},
{
"title": "olx",
"url": "https://www.olx.pl/",
"image_url": "olx-pl@2x.png"
"image_url": "images/olx-pl@2x.png",
"favicon_url": "favicons/olx-pl.ico"
},
{
"title": "reddit",
"url": "https://www.reddit.com/",
"image_url": "reddit-com@2x.png"
"image_url": "images/reddit-com@2x.png",
"favicon_url": "favicons/reddit-com.png"
},
{
"title": "twitter",
"url": "https://twitter.com/",
"image_url": "twitter-com@2x.png"
"image_url": "images/twitter-com@2x.png",
"favicon_url": "favicons/twitter-com.ico"
},
{
"title": "vk",
"url": "https://vk.com/",
"image_url": "vk-com@2x.png"
"image_url": "images/vk-com@2x.png",
"favicon_url": "favicons/vk-com.ico"
},
{
"title": "wikipedia",
"url": "https://www.wikipedia.org/",
"image_url": "wikipedia-org@2x.png"
"image_url": "images/wikipedia-org@2x.png",
"favicon_url": "favicons/wikipedia-org.ico"
},
{
"title": "wykop",
"url": "https://www.wykop.pl/",
"image_url": "wykop-pl@2x.png"
"image_url": "images/wykop-pl@2x.png",
"favicon_url": "favicons/wykop-pl.png"
},
{
"title": "yandex",
"url": "https://www.yandex.com/",
"image_url": "yandex-com@2x.png"
"image_url": "images/yandex-com@2x.png",
"favicon_url": "favicons/yandex-com.png"
},
{
"title": "youtube",
"url": "https://www.youtube.com/",
"image_url": "youtube-com@2x.png"
"image_url": "images/youtube-com@2x.png",
"favicon_url": "favicons/youtube-com.png"
}
]

Просмотреть файл

@ -8,10 +8,9 @@ const { XPCOMUtils } = ChromeUtils.import(
XPCOMUtils.defineLazyGlobalGetters(this, ["fetch", "URL"]);
const TIPPYTOP_PATH = "resource://activity-stream/data/content/tippytop/";
const TIPPYTOP_JSON_PATH =
"resource://activity-stream/data/content/tippytop/top_sites.json";
const TIPPYTOP_URL_PREFIX =
"resource://activity-stream/data/content/tippytop/images/";
function getDomain(url) {
let domain;
@ -51,7 +50,8 @@ this.TippyTopProvider = class TippyTopProvider {
processSite(site) {
const tippyTop = this._sitesByDomain.get(getDomain(site.url));
if (tippyTop) {
site.tippyTopIcon = TIPPYTOP_URL_PREFIX + tippyTop.image_url;
site.tippyTopIcon = TIPPYTOP_PATH + tippyTop.image_url;
site.favicon = TIPPYTOP_PATH + tippyTop.favicon_url;
site.backgroundColor = tippyTop.background_color;
}
return site;

Просмотреть файл

@ -16,14 +16,14 @@ describe("TippyTopProvider", () => {
{
title: "facebook",
url: "https://www.facebook.com/",
image_url: "facebook-com.png",
image_url: "images/facebook-com.png",
background_color: "#3b5998",
domain: "facebook.com",
},
{
title: "gmail",
urls: ["https://www.gmail.com/", "https://mail.google.com"],
image_url: "gmail-com.png",
image_url: "images/gmail-com.png",
background_color: "#000000",
domain: "gmail.com",
},

Просмотреть файл

@ -115,11 +115,6 @@ class ProviderTopSites extends UrlbarProvider {
// are stored in `label`, so prefer it. Search top sites currently
// don't have titles but `hostname` instead.
title: link.label || link.title || link.hostname || "",
// Default top sites don't have a favicon property. Instead they
// have tippyTopIcon, a 96x96pt image used on the newtab page.
// We'll use it as the favicon for now, but ideally default top
// sites would have real favicons. Non-default top sites (i.e.,
// those from the user's history) will have favicons.
favicon: link.favicon || link.tippyTopIcon || null,
}));

Просмотреть файл

@ -154,3 +154,19 @@ browser/chrome/browser/content/browser/aboutlogins/third-party/app-store/app_nb.
browser/chrome/browser/content/browser/aboutlogins/third-party/app-store/app_nn.png
browser/chrome/browser/content/browser/aboutlogins/third-party/play-store/play_nb.png
browser/chrome/browser/content/browser/aboutlogins/third-party/play-store/play_nn.png
# Bug 1606928 - There's no reliable way to connect Top Sites favicons with the favicons in the Search Service
browser/chrome/browser/res/activity-stream/data/content/tippytop/favicons/bbc-uk.ico
browser/chrome/browser/search-extensions/bbc-alba/favicon.ico
browser/chrome/browser/res/activity-stream/data/content/tippytop/favicons/allegro-pl.ico
browser/chrome/browser/search-extensions/allegro-pl/favicon.ico
browser/chrome/browser/res/activity-stream/data/content/tippytop/favicons/amazon.ico
browser/chrome/browser/res/activity-stream/data/content/tippytop/favicons/ebay.ico
browser/chrome/browser/search-extensions/ebay/favicon.ico
browser/chrome/browser/res/activity-stream/data/content/tippytop/favicons/twitter-com.ico
browser/chrome/browser/search-extensions/twitter/favicon.ico
browser/chrome/browser/res/activity-stream/data/content/tippytop/favicons/bing-com.ico
browser/chrome/browser/search-extensions/bing/favicon.ico
browser/chrome/browser/res/activity-stream/data/content/tippytop/favicons/duckduckgo-com.ico
browser/chrome/browser/search-extensions/ddg/favicon.ico
browser/chrome/browser/res/activity-stream/data/content/tippytop/favicons/google-com.ico
browser/chrome/browser/search-extensions/google/favicon.ico