Bug 1336434 - "Your Top Sites" heading should say "Top Sites" instead when using the default set. r=Gijs, a=jcristau
authorDão Gottwald <dao@mozilla.com>
Wed, 15 Feb 2017 10:44:00 -0500
changeset 376236 5b366c35d4a51cf1a73f3dee6cf40eb4cbc8c9db
parent 376235 ce2403f3f23bf34c6708b9162502459823ca9af5
child 376237 34611d3b1fb6b6a6ff620c90c808020b8da7803d
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs, jcristau
bugs1336434
milestone53.0a2
Bug 1336434 - "Your Top Sites" heading should say "Top Sites" instead when using the default set. r=Gijs, a=jcristau
browser/base/content/newtab/grid.js
browser/base/content/newtab/newTab.xhtml
--- a/browser/base/content/newtab/grid.js
+++ b/browser/base/content/newtab/grid.js
@@ -137,27 +137,34 @@ var gGrid = {
     // Create cells.
     let cells = Array.from(fragment.childNodes, (cell) => new Cell(this, cell));
 
     // Fetch links.
     let links = gLinks.getLinks();
 
     // Create sites.
     let numLinks = Math.min(links.length, cells.length);
+    let hasHistoryTiles = false;
     for (let i = 0; i < numLinks; i++) {
       if (links[i]) {
         this.createSite(links[i], cells[i]);
+        if (links[i].type == "history") {
+          hasHistoryTiles = true;
+        }
       }
     }
 
     this._cells = cells;
     while (this._gridDefaultContent.nextSibling) {
       this._gridDefaultContent.nextSibling.remove();
     }
     this._node.appendChild(fragment);
+
+    document.getElementById("topsites-heading").textContent =
+      hasHistoryTiles ? "Your Top Sites" : "Top Sites";
   },
 
   /**
    * Calculate the height for a number of rows up to the maximum rows
    * @param rows Number of rows defaulting to the max
    */
   _computeHeight: function Grid_computeHeight(aRows) {
     let {gridRows} = gGridPrefs;
--- a/browser/base/content/newtab/newTab.xhtml
+++ b/browser/base/content/newtab/newTab.xhtml
@@ -75,17 +75,17 @@
         <input id="newtab-search-submit" type="button"
              title="&contentSearchSubmit.tooltip;"/>
       </div>
     </div>
 
     <div id="newtab-horizontal-margin">
       <div class="newtab-side-margin"/>
       <div id="newtab-grid">
-        <h1 id="topsites-heading">Your Top Sites</h1>
+        <h1 id="topsites-heading"/>
       </div>
       <div class="newtab-side-margin"/>
     </div>
 
     <div id="newtab-margin-bottom"/>
   </div>
   <input id="newtab-customize-button" type="button" dir="&locale.dir;"
          value="&#x2699;"