Bug 1261223 - Synced Tabs now uses HiDPI default favicons. r=markh
authorEdouard Oger <eoger@fastmail.com>
Tue, 05 Apr 2016 09:36:00 -0400
changeset 330409 95f5751ef3200b208d6f38d13b27c268e7e18152
parent 330408 29d5a4175c8b74f45482276a53985cf2568b4be2
child 330410 1709e72eedc79a1953aa8c2712f6c9c604542172
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarkh
bugs1261223
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1261223 - Synced Tabs now uses HiDPI default favicons. r=markh
browser/components/syncedtabs/TabListView.js
browser/themes/shared/syncedtabs/sidebar.inc.css
services/sync/modules/SyncedTabs.jsm
services/sync/tests/unit/test_syncedtabs.js
--- a/browser/components/syncedtabs/TabListView.js
+++ b/browser/components/syncedtabs/TabListView.js
@@ -237,18 +237,20 @@ TabListView.prototype = {
     }
     if (item.focused) {
       itemNode.focus();
     }
     itemNode.dataset.url = item.url;
 
     itemNode.querySelector(".item-title").textContent = item.title;
 
-    let icon = itemNode.querySelector(".item-icon-container");
-    icon.style.backgroundImage = "url(" + item.icon + ")";
+    if (item.icon) {
+      let icon = itemNode.querySelector(".item-icon-container");
+      icon.style.backgroundImage = "url(" + item.icon + ")";
+    }
   },
 
   onClick(event) {
     let itemNode = this._findParentItemNode(event.target);
     if (!itemNode) {
       return;
     }
 
--- a/browser/themes/shared/syncedtabs/sidebar.inc.css
+++ b/browser/themes/shared/syncedtabs/sidebar.inc.css
@@ -79,20 +79,31 @@ body {
 .item.selected:focus > .item-title-container {
   background-color: Highlight;
   color: HighlightText;
 }
 
 .client .item.tab > .item-title-container {
   padding-inline-start: 35px;
 }
+
 .item.tab > .item-title-container {
   padding-inline-start: 20px;
 }
 
+.item.tab > .item-title-container > .item-icon-container {
+  background-image: url("chrome://mozapps/skin/places/defaultFavicon.png");
+}
+
+@media (min-resolution: 1.1dppx) {
+.item.tab > .item-title-container > .item-icon-container {
+    background-image: url("chrome://mozapps/skin/places/defaultFavicon@2x.png");
+  }
+}
+
 .item-icon-container {
   min-width: 16px;
   max-width: 16px;
   min-height: 16px;
   max-height: 16px;
   margin-right: 5px;
   margin-left: 5px;
   background-size: 16px 16px;
--- a/services/sync/modules/SyncedTabs.jsm
+++ b/services/sync/modules/SyncedTabs.jsm
@@ -68,17 +68,17 @@ let SyncedTabsInternal = {
       icon = tab.icon;
     }
     if (!icon) {
       try {
         icon = (yield PlacesUtils.promiseFaviconLinkUrl(url)).spec;
       } catch (ex) { /* no favicon avaiable */ }
     }
     if (!icon) {
-      icon = PlacesUtils.favicons.defaultFavicon.spec;
+      icon = "";
     }
     return {
       type:  "tab",
       title: tab.title || url,
       url,
       icon,
       client: client.id,
       lastUsed: tab.lastUsed,
--- a/services/sync/tests/unit/test_syncedtabs.js
+++ b/services/sync/tests/unit/test_syncedtabs.js
@@ -152,18 +152,18 @@ add_task(function* test_clientWithTabsIc
     },
   });
 
   let clients = yield SyncedTabs.getTabClients();
   equal(clients.length, 1);
   clients.sort((a, b) => { return a.name.localeCompare(b.name);});
   equal(clients[0].tabs.length, 1);
   equal(clients[0].tabs[0].url, "http://foo.com/");
-  // expect the default favicon due to the pref being false.
-  equal(clients[0].tabs[0].icon, faviconService.defaultFavicon.spec);
+  // expect the default favicon (empty string) due to the pref being false.
+  equal(clients[0].tabs[0].icon, "");
   Services.prefs.clearUserPref("services.sync.syncedTabs.showRemoteIcons");
 });
 
 add_task(function* test_filter() {
   // Nothing matches.
   yield configureClients({
     guid_desktop: {
       clientName: "My Desktop",