Bug 1136203 - Remove thumbnail/title replacing functionality for history tiles. r=adw, a=sylvestre
authorMarina Samuel <msamuel@mozilla.com>
Fri, 27 Mar 2015 17:57:11 -0400
changeset 258200 1d9b014f0414
parent 258199 5fd426f495ff
child 258201 da2535172770
push id4619
push useredilee@gmail.com
push date2015-04-02 05:50 +0000
treeherdermozilla-beta@daf8a9291a9b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersadw, sylvestre
bugs1136203
milestone38.0
Bug 1136203 - Remove thumbnail/title replacing functionality for history tiles. r=adw, a=sylvestre
browser/base/content/test/newtab/browser_newtab_enhanced.js
browser/base/content/test/newtab/head.js
browser/modules/DirectoryLinksProvider.jsm
--- a/browser/base/content/test/newtab/browser_newtab_enhanced.js
+++ b/browser/base/content/test/newtab/browser_newtab_enhanced.js
@@ -55,19 +55,19 @@ function runTests() {
   is(title, "title");
 
   is(getData(1), null, "history link pushed out by directory link");
 
   // Test with a pinned link
   setPinnedLinks("-1");
   yield addNewTabPageTab();
   ({type, enhanced, title} = getData(0));
-  is(type, "enhanced", "pinned history link is enhanced");
-  isnot(enhanced, "", "pinned history link has enhanced image");
-  is(title, "title");
+  is(type, "history", "pinned history link is not enhanced");
+  is(enhanced, "", "pinned history link doesn't have enhanced image");
+  is(title, "site#-1");
 
   is(getData(1), null, "directory link pushed out by pinned history link");
 
   // Test pinned link with enhanced = false
   yield addNewTabPageTab();
   yield customizeNewTabPage("classic");
   ({type, enhanced, title} = getData(0));
   isnot(type, "enhanced", "history link is not enhanced");
--- a/browser/base/content/test/newtab/head.js
+++ b/browser/base/content/test/newtab/head.js
@@ -291,17 +291,18 @@ function fillHistory(aLinks, aCallback =
  */
 function setPinnedLinks(aLinks) {
   let links = aLinks;
 
   if (typeof links == "string") {
     links = aLinks.split(/\s*,\s*/).map(function (id) {
       if (id)
         return {url: "http://example" + (id != "-1" ? id : "") + ".com/",
-                title: "site#" + id};
+                title: "site#" + id,
+                type: "history"};
     });
   }
 
   let string = Cc["@mozilla.org/supports-string;1"]
                  .createInstance(Ci.nsISupportsString);
   string.data = JSON.stringify(links);
   Services.prefs.setComplexValue("browser.newtabpage.pinned",
                                  Ci.nsISupportsString, string);
--- a/browser/modules/DirectoryLinksProvider.jsm
+++ b/browser/modules/DirectoryLinksProvider.jsm
@@ -405,17 +405,18 @@ let DirectoryLinksProvider = {
     return this._fetchAndCacheLinksIfNecessary();
   },
 
   /**
    * Get the enhanced link object for a link (whether history or directory)
    */
   getEnhancedLink: function DirectoryLinksProvider_getEnhancedLink(link) {
     // Use the provided link if it's already enhanced
-    return link.enhancedImageURI && link ||
+    return link.type == "history" ? null :
+           link.enhancedImageURI && link ? link :
            this._enhancedLinks.get(NewTabUtils.extractSite(link.url));
   },
 
   /**
    * Check if a url's scheme is in a Set of allowed schemes
    */
   isURLAllowed: function DirectoryLinksProvider_isURLAllowed(url, allowed) {
     // Assume no url is an allowed url