Bug 1126184: Part 3: Mochitest fixes for suggested tiles.

This commit is contained in:
Marina Samuel 2015-03-13 11:45:38 -04:00
parent 617c4fd1a3
commit 58f1c40af5
4 changed files with 9 additions and 1 deletions

View File

@ -9,6 +9,7 @@
*/
function runTests() {
requestLongerTimeout(2);
yield addNewTabPageTab();
// test a simple drag-and-drop scenario
yield setLinks("0,1,2,3,4,5,6,7,8");

View File

@ -13,6 +13,7 @@ const PREF_NEWTAB_COLUMNS = "browser.newtabpage.columns";
*/
function runTests() {
registerCleanupFunction(_ => Services.prefs.clearUserPref(PREF_NEWTAB_COLUMNS));
yield addNewTabPageTab();
// drag a new site onto the very first cell
yield setLinks("0,1,2,3,4,5,6,7,8");

View File

@ -531,6 +531,12 @@ let DirectoryLinksProvider = {
_updateRelatedTile: function() {
let sortedLinks = NewTabUtils.getProviderLinks(this);
if (!sortedLinks) {
// If NewTabUtils.links.resetCache() is called before getting here,
// sortedLinks may be undefined.
return;
}
// Delete the current related tile, if one exists.
let initialLength = sortedLinks.length;
this.maxNumLinks = initialLength;

View File

@ -936,7 +936,7 @@ let Links = {
// Build a list containing a copy of each provider's sortedLinks list.
let linkLists = [];
for (let links of this._providers.values()) {
if (links) {
if (links && links.sortedLinks) {
linkLists.push(links.sortedLinks.slice());
}
}