Bug 1224950 - Limit Message-Using Remote New Tab to Nightly and Aurora r=mconley

This commit is contained in:
Olivier Yiptong 2015-11-19 16:51:45 -05:00
parent 816ae9ba55
commit 5ed6e530ee
5 changed files with 57 additions and 34 deletions

View File

@ -1343,8 +1343,10 @@ pref("browser.newtabpage.directory.source", "https://tiles.services.mozilla.com/
// endpoint to send newtab click and view pings // endpoint to send newtab click and view pings
pref("browser.newtabpage.directory.ping", "https://tiles.services.mozilla.com/v3/links/"); pref("browser.newtabpage.directory.ping", "https://tiles.services.mozilla.com/v3/links/");
// activates the remote-hosted newtab page #ifndef RELEASE_BUILD
// if true, it activates the remote-hosted newtab page
pref("browser.newtabpage.remote", false); pref("browser.newtabpage.remote", false);
#endif
// Enable the DOM fullscreen API. // Enable the DOM fullscreen API.
pref("full-screen-api.enabled", true); pref("full-screen-api.enabled", true);

View File

@ -90,9 +90,11 @@ static RedirEntry kRedirMap[] = {
nsIAboutModule::ENABLE_INDEXED_DB }, nsIAboutModule::ENABLE_INDEXED_DB },
{ "newtab", "chrome://browser/content/newtab/newTab.xhtml", { "newtab", "chrome://browser/content/newtab/newTab.xhtml",
nsIAboutModule::ALLOW_SCRIPT }, nsIAboutModule::ALLOW_SCRIPT },
#ifndef RELEASE_BUILD
{ "remote-newtab", "chrome://browser/content/remote-newtab/newTab.xhtml", { "remote-newtab", "chrome://browser/content/remote-newtab/newTab.xhtml",
nsIAboutModule::URI_MUST_LOAD_IN_CHILD | nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
nsIAboutModule::ALLOW_SCRIPT }, nsIAboutModule::ALLOW_SCRIPT },
#endif
{ "preferences", "chrome://browser/content/preferences/in-content/preferences.xul", { "preferences", "chrome://browser/content/preferences/in-content/preferences.xul",
nsIAboutModule::ALLOW_SCRIPT }, nsIAboutModule::ALLOW_SCRIPT },
{ "downloads", "chrome://browser/content/downloads/contentAreaDownloadsView.xul", { "downloads", "chrome://browser/content/downloads/contentAreaDownloadsView.xul",

View File

@ -4,17 +4,18 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this # License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
BROWSER_CHROME_MANIFESTS += ['tests/browser/browser.ini'] if not CONFIG['RELEASE_BUILD']:
BROWSER_CHROME_MANIFESTS += ['tests/browser/browser.ini']
XPCSHELL_TESTS_MANIFESTS += [ XPCSHELL_TESTS_MANIFESTS += [
'tests/xpcshell/xpcshell.ini', 'tests/xpcshell/xpcshell.ini',
] ]
EXTRA_JS_MODULES += [ EXTRA_JS_MODULES += [
'NewTabPrefsProvider.jsm', 'NewTabPrefsProvider.jsm',
'NewTabURL.jsm', 'NewTabURL.jsm',
'PlacesProvider.jsm', 'PlacesProvider.jsm',
'RemoteAboutNewTab.jsm', 'RemoteAboutNewTab.jsm',
'RemoteNewTabLocation.jsm', 'RemoteNewTabLocation.jsm',
'RemoteNewTabUtils.jsm', 'RemoteNewTabUtils.jsm',
] ]

View File

@ -14,6 +14,9 @@ const POLARIS_ENABLED = "browser.polaris.enabled";
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
"resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AboutHome", XPCOMUtils.defineLazyModuleGetter(this, "AboutHome",
"resource:///modules/AboutHome.jsm"); "resource:///modules/AboutHome.jsm");
@ -26,14 +29,16 @@ XPCOMUtils.defineLazyModuleGetter(this, "DirectoryLinksProvider",
XPCOMUtils.defineLazyModuleGetter(this, "NewTabUtils", XPCOMUtils.defineLazyModuleGetter(this, "NewTabUtils",
"resource://gre/modules/NewTabUtils.jsm"); "resource://gre/modules/NewTabUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "RemoteAboutNewTab", if(!AppConstants.RELEASE_BUILD) {
XPCOMUtils.defineLazyModuleGetter(this, "RemoteAboutNewTab",
"resource:///modules/RemoteAboutNewTab.jsm"); "resource:///modules/RemoteAboutNewTab.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "RemoteNewTabUtils", XPCOMUtils.defineLazyModuleGetter(this, "RemoteNewTabUtils",
"resource:///modules/RemoteNewTabUtils.jsm"); "resource:///modules/RemoteNewTabUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NewTabPrefsProvider", XPCOMUtils.defineLazyModuleGetter(this, "NewTabPrefsProvider",
"resource:///modules/NewTabPrefsProvider.jsm"); "resource:///modules/NewTabPrefsProvider.jsm");
}
XPCOMUtils.defineLazyModuleGetter(this, "UITour", XPCOMUtils.defineLazyModuleGetter(this, "UITour",
"resource:///modules/UITour.jsm"); "resource:///modules/UITour.jsm");
@ -181,9 +186,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeManager",
XPCOMUtils.defineLazyModuleGetter(this, "ExtensionManagement", XPCOMUtils.defineLazyModuleGetter(this, "ExtensionManagement",
"resource://gre/modules/ExtensionManagement.jsm"); "resource://gre/modules/ExtensionManagement.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
"resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "WindowsUIUtils", XPCOMUtils.defineLazyServiceGetter(this, "WindowsUIUtils",
"@mozilla.org/windows-ui-utils;1", "nsIWindowsUIUtils"); "@mozilla.org/windows-ui-utils;1", "nsIWindowsUIUtils");
@ -849,10 +851,12 @@ BrowserGlue.prototype = {
NewTabUtils.links.addProvider(DirectoryLinksProvider); NewTabUtils.links.addProvider(DirectoryLinksProvider);
AboutNewTab.init(); AboutNewTab.init();
if(!AppConstants.RELEASE_BUILD) {
RemoteNewTabUtils.init(); RemoteNewTabUtils.init();
RemoteNewTabUtils.links.addProvider(DirectoryLinksProvider); RemoteNewTabUtils.links.addProvider(DirectoryLinksProvider);
RemoteAboutNewTab.init(); RemoteAboutNewTab.init();
NewTabPrefsProvider.prefs.init(); NewTabPrefsProvider.prefs.init();
}
SessionStore.init(); SessionStore.init();
BrowserUITelemetry.init(); BrowserUITelemetry.init();
@ -1173,8 +1177,10 @@ BrowserGlue.prototype = {
CustomizationTabPreloader.uninit(); CustomizationTabPreloader.uninit();
WebappManager.uninit(); WebappManager.uninit();
if (!AppConstants.RELEASE_BUILD) {
RemoteAboutNewTab.uninit(); RemoteAboutNewTab.uninit();
NewTabPrefsProvider.prefs.uninit(); NewTabPrefsProvider.prefs.uninit();
}
AboutNewTab.uninit(); AboutNewTab.uninit();
#ifdef NIGHTLY_BUILD #ifdef NIGHTLY_BUILD
if (Services.prefs.getBoolPref("dom.identity.enabled")) { if (Services.prefs.getBoolPref("dom.identity.enabled")) {
@ -2585,9 +2591,11 @@ AboutNewTabService.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutNewTabService]), QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutNewTabService]),
get newTabURL() { get newTabURL() {
if (Services.prefs.getBoolPref("browser.newtabpage.remote")) {
if (!AppConstants.RELEASE_BUILD && Services.prefs.getBoolPref("browser.newtabpage.remote")) {
return "about:remote-newtab"; return "about:remote-newtab";
} }
return this._newTabURL; return this._newTabURL;
}, },

View File

@ -17,6 +17,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Task.jsm"); Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://gre/modules/Timer.jsm"); Cu.import("resource://gre/modules/Timer.jsm");
Cu.import("resource://gre/modules/AppConstants.jsm")
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil", XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
"resource://gre/modules/NetUtil.jsm"); "resource://gre/modules/NetUtil.jsm");
@ -31,8 +32,13 @@ XPCOMUtils.defineLazyModuleGetter(this, "UpdateUtils",
XPCOMUtils.defineLazyServiceGetter(this, "eTLD", XPCOMUtils.defineLazyServiceGetter(this, "eTLD",
"@mozilla.org/network/effective-tld-service;1", "@mozilla.org/network/effective-tld-service;1",
"nsIEffectiveTLDService"); "nsIEffectiveTLDService");
XPCOMUtils.defineLazyModuleGetter(this, "RemoteNewTabUtils",
// ensure remote new tab doesn't go beyond aurora
if (!AppConstants.RELEASE_BUILD) {
XPCOMUtils.defineLazyModuleGetter(this, "RemoteNewTabUtils",
"resource:///modules/RemoteNewTabUtils.jsm"); "resource:///modules/RemoteNewTabUtils.jsm");
}
XPCOMUtils.defineLazyGetter(this, "gTextDecoder", () => { XPCOMUtils.defineLazyGetter(this, "gTextDecoder", () => {
return new TextDecoder(); return new TextDecoder();
}); });
@ -760,8 +766,12 @@ var DirectoryLinksProvider = {
NewTabUtils.placesProvider.addObserver(this); NewTabUtils.placesProvider.addObserver(this);
NewTabUtils.links.addObserver(this); NewTabUtils.links.addObserver(this);
// ensure remote new tab doesn't go beyond aurora
if (!AppConstants.RELEASE_BUILD) {
RemoteNewTabUtils.placesProvider.addObserver(this); RemoteNewTabUtils.placesProvider.addObserver(this);
RemoteNewTabUtils.links.addObserver(this); RemoteNewTabUtils.links.addObserver(this);
}
return Task.spawn(function() { return Task.spawn(function() {
// get the last modified time of the links file if it exists // get the last modified time of the links file if it exists