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

--HG--
extra : rebase_source : 69dc781b09b42ac09a5318baec82d5f78de12765
This commit is contained in:
Olivier Yiptong 2016-01-11 20:30:07 -05:00
Родитель 5127430884
Коммит 05ae43811e
2 изменённых файлов: 5 добавлений и 10 удалений

Просмотреть файл

@ -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";

Просмотреть файл

@ -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()) {