Bug 975228 - Create logic to merge frecency-pages and Tiles (Tile equiv 1000 frecency) [r=adw]

Use DirectoryLinksProvider for Firefox and make PlacesProvider match in expected Links format.
Make sure there's at least 2 of each type so Telemetry doesn't know for sure which links were used.
This commit is contained in:
Olivier Yiptong 2014-03-31 01:51:21 -07:00
parent 26f1679c90
commit bc6bf45892
5 changed files with 64 additions and 47 deletions

View File

@ -56,6 +56,7 @@ const EXPECTED_REFLOWS = [
];
const PREF_PRELOAD = "browser.newtab.preload";
const PREF_NEWTAB_DIRECTORYSOURCE = "browser.newtabpage.directorySource";
/*
* This test ensures that there are no unexpected
@ -65,7 +66,11 @@ function test() {
waitForExplicitFinish();
Services.prefs.setBoolPref(PREF_PRELOAD, false);
registerCleanupFunction(() => Services.prefs.clearUserPref(PREF_PRELOAD));
Services.prefs.setCharPref(PREF_NEWTAB_DIRECTORYSOURCE, "data:application/json,{}");
registerCleanupFunction(() => {
Services.prefs.clearUserPref(PREF_PRELOAD);
Services.prefs.clearUserPref(PREF_NEWTAB_DIRECTORYSOURCE);
});
// Add a reflow observer and open a new tab.
docShell.addWeakReflowObserver(observer);

View File

@ -2,8 +2,11 @@
http://creativecommons.org/publicdomain/zero/1.0/ */
const PREF_NEWTAB_ENABLED = "browser.newtabpage.enabled";
const PREF_NEWTAB_DIRECTORYSOURCE = "browser.newtabpage.directorySource";
Services.prefs.setBoolPref(PREF_NEWTAB_ENABLED, true);
// start with no directory links by default
Services.prefs.setCharPref(PREF_NEWTAB_DIRECTORYSOURCE, "data:application/json,{}");
let tmp = {};
Cu.import("resource://gre/modules/Promise.jsm", tmp);
@ -26,6 +29,7 @@ registerCleanupFunction(function () {
gWindow.gBrowser.removeTab(gWindow.gBrowser.tabs[1]);
Services.prefs.clearUserPref(PREF_NEWTAB_ENABLED);
Services.prefs.clearUserPref(PREF_NEWTAB_DIRECTORYSOURCE);
});
/**

View File

@ -22,6 +22,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "AddonManager",
XPCOMUtils.defineLazyModuleGetter(this, "ContentClick",
"resource:///modules/ContentClick.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "DirectoryLinksProvider",
"resource://gre/modules/DirectoryLinksProvider.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
"resource://gre/modules/NetUtil.jsm");
@ -475,6 +478,8 @@ BrowserGlue.prototype = {
WebappManager.init();
PageThumbs.init();
NewTabUtils.init();
DirectoryLinksProvider.init();
NewTabUtils.links.addProvider(DirectoryLinksProvider);
BrowserNewTabPreloader.init();
#ifdef NIGHTLY_BUILD
if (Services.prefs.getBoolPref("dom.identity.enabled")) {

File diff suppressed because one or more lines are too long

View File

@ -577,6 +577,9 @@ let PlacesProvider = {
title: title,
frecency: frecency,
lastVisitDate: lastVisitDate,
bgColor: "transparent",
type: "history",
imageURISpec: null,
});
}
}