Bug 1218996 - AboutRedirector uses aboutNewTabService exclusively for about:newtab r=mconley

This commit is contained in:
Olivier Yiptong 2016-01-11 20:30:07 -05:00
parent 539a002c6d
commit 053128c06f
2 changed files with 5 additions and 10 deletions

View File

@ -20,7 +20,7 @@ this.__defineGetter__("BROWSER_NEW_TAB_URL", () => {
!aboutNewTabService.overridden) {
return "about:privatebrowsing";
}
return aboutNewTabService.newTabURL;
return "about:newtab";
});
var TAB_DROP_TYPE = "application/x-moz-tabbrowser-tab";

View File

@ -86,7 +86,8 @@ static RedirEntry kRedirMap[] = {
nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
nsIAboutModule::ALLOW_SCRIPT |
nsIAboutModule::ENABLE_INDEXED_DB },
{ "newtab", "chrome://browser/content/newtab/newTab.xhtml",
// the newtab's actual URL will be determined when the channel is created
{ "newtab", "about:blank",
nsIAboutModule::ALLOW_SCRIPT },
#ifndef RELEASE_BUILD
{ "remote-newtab", "chrome://browser/content/remote-newtab/newTab.xhtml",
@ -162,18 +163,12 @@ AboutRedirector::NewChannel(nsIURI* aURI,
if (!strcmp(path.get(), kRedirMap[i].id)) {
nsAutoCString url;
// check if about:newtab got overridden
if (path.EqualsLiteral("newtab")) {
// let the aboutNewTabService decide where to redirect
nsCOMPtr<nsIAboutNewTabService> aboutNewTabService =
do_GetService("@mozilla.org/browser/aboutnewtab-service;1", &rv);
rv = aboutNewTabService->GetNewTabURL(url);
NS_ENSURE_SUCCESS(rv, rv);
bool overridden = false;
rv = aboutNewTabService->GetOverridden(&overridden);
NS_ENSURE_SUCCESS(rv, rv);
if (overridden) {
rv = aboutNewTabService->GetNewTabURL(url);
NS_ENSURE_SUCCESS(rv, rv);
}
}
// fall back to the specified url in the map
if (url.IsEmpty()) {