From 80283ef173ba0df30cb42b4d29f845daf91f9765 Mon Sep 17 00:00:00 2001 From: "silver%warwickcompsoc.co.uk" Date: Wed, 2 Feb 2005 19:42:21 +0000 Subject: [PATCH] Bug 277658 - Make error pages URL a preference. r=biesi sr=bz p=bugmail@q1n.org (Vidar Braut Haarr) git-svn-id: svn://10.0.0.236/trunk@168714 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsDocShell.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index a917d9e2934..be2a63ea671 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -3016,18 +3016,30 @@ nsDocShell::LoadErrorPage(nsIURI *aURI, const PRUnichar *aURL, char *escapedError = nsEscape(NS_ConvertUTF16toUTF8(aErrorType).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 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.AppendLiteral("&u="); errorPageUrl.AppendASCII(escapedUrl); errorPageUrl.AppendLiteral("&d="); errorPageUrl.AppendASCII(escapedDescription); - PR_FREEIF(escapedDescription); - PR_FREEIF(escapedError); - PR_FREEIF(escapedUrl); + nsMemory::Free(escapedDescription); + nsMemory::Free(escapedError); + nsMemory::Free(escapedUrl); nsCOMPtr errorPageURI; nsresult rv = NS_NewURI(getter_AddRefs(errorPageURI), errorPageUrl);