Bug 277658 - Make error pages URL a preference.

r=biesi
sr=bz
p=bugmail@q1n.org (Vidar Braut Haarr)
This commit is contained in:
silver%warwickcompsoc.co.uk 2005-02-02 19:42:21 +00:00
Родитель 3ca9b73e14
Коммит 62d226a563
1 изменённых файлов: 17 добавлений и 5 удалений

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

@ -3016,18 +3016,30 @@ nsDocShell::LoadErrorPage(nsIURI *aURI, const PRUnichar *aURL,
char *escapedError = nsEscape(NS_ConvertUTF16toUTF8(aErrorType).get(), url_Path); char *escapedError = nsEscape(NS_ConvertUTF16toUTF8(aErrorType).get(), url_Path);
char *escapedDescription = nsEscape(NS_ConvertUTF16toUTF8(aDescription).get(), url_Path); char *escapedDescription = nsEscape(NS_ConvertUTF16toUTF8(aDescription).get(), url_Path);
nsAutoString errorPageUrl; nsXPIDLCString errorPageUrl;
errorPageUrl.AssignLiteral("chrome://global/content/netError.xhtml?e="); nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (prefBranch)
{
// Note that we don't expose this pref, because we don't want users fiddling with it.
prefBranch->GetCharPref("browser.xul.error_pages.location", getter_Copies(errorPageUrl));
}
if (errorPageUrl.IsEmpty())
{
errorPageUrl.AssignLiteral("chrome://global/content/netError.xhtml");
}
errorPageUrl.AppendLiteral("?e=");
errorPageUrl.AppendASCII(escapedError); errorPageUrl.AppendASCII(escapedError);
errorPageUrl.AppendLiteral("&u="); errorPageUrl.AppendLiteral("&u=");
errorPageUrl.AppendASCII(escapedUrl); errorPageUrl.AppendASCII(escapedUrl);
errorPageUrl.AppendLiteral("&d="); errorPageUrl.AppendLiteral("&d=");
errorPageUrl.AppendASCII(escapedDescription); errorPageUrl.AppendASCII(escapedDescription);
PR_FREEIF(escapedDescription); nsMemory::Free(escapedDescription);
PR_FREEIF(escapedError); nsMemory::Free(escapedError);
PR_FREEIF(escapedUrl); nsMemory::Free(escapedUrl);
nsCOMPtr<nsIURI> errorPageURI; nsCOMPtr<nsIURI> errorPageURI;
nsresult rv = NS_NewURI(getter_AddRefs(errorPageURI), errorPageUrl); nsresult rv = NS_NewURI(getter_AddRefs(errorPageURI), errorPageUrl);