Bug 399233 - "Phishing UI hidden by content, inconsistent with malware" [p=johnath r=tony r=biesi ui-r=beltzner a=blocking-firefox3+ for M9]
git-svn-id: svn://10.0.0.236/trunk@238312 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -2853,6 +2853,9 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI *aURI,
|
||||
nsresult rv = NS_OK;
|
||||
nsAutoString messageStr;
|
||||
nsCAutoString cssClass;
|
||||
nsCAutoString errorPage;
|
||||
|
||||
errorPage.AssignLiteral("neterror");
|
||||
|
||||
// Turn the error code into a human readable error message.
|
||||
if (NS_ERROR_UNKNOWN_PROTOCOL == aError) {
|
||||
@@ -2947,6 +2950,25 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI *aURI,
|
||||
}
|
||||
if (!messageStr.IsEmpty())
|
||||
error.AssignLiteral("nssFailure2");
|
||||
} else if (NS_ERROR_PHISHING_URI == aError || NS_ERROR_MALWARE_URI == aError) {
|
||||
nsCAutoString host;
|
||||
aURI->GetHost(host);
|
||||
CopyUTF8toUTF16(host, formatStrs[0]);
|
||||
formatStrCount = 1;
|
||||
|
||||
// Malware and phishing detectors may want to use an alternate error
|
||||
// page, but if the pref's not set, we'll fall back on the standard page
|
||||
nsXPIDLCString alternateErrorPage;
|
||||
mPrefs->GetCharPref("urlclassifier.alternate_error_page",
|
||||
getter_Copies(alternateErrorPage));
|
||||
if (alternateErrorPage)
|
||||
errorPage.Assign(alternateErrorPage);
|
||||
|
||||
if (NS_ERROR_PHISHING_URI == aError)
|
||||
error.AssignLiteral("phishingBlocked");
|
||||
else
|
||||
error.AssignLiteral("malwareBlocked");
|
||||
cssClass.AssignLiteral("blacklist");
|
||||
}
|
||||
else {
|
||||
// Errors requiring simple formatting
|
||||
@@ -2993,15 +3015,6 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI *aURI,
|
||||
// Bad Content Encoding.
|
||||
error.AssignLiteral("contentEncodingError");
|
||||
break;
|
||||
case NS_ERROR_MALWARE_URI:
|
||||
nsCAutoString host;
|
||||
aURI->GetHost(host);
|
||||
CopyUTF8toUTF16(host, formatStrs[0]);
|
||||
formatStrCount = 1;
|
||||
|
||||
error.AssignLiteral("malwareBlocked");
|
||||
cssClass.AssignLiteral("blacklist");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3042,8 +3055,8 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI *aURI,
|
||||
// URI object. Missing URI objects are handled badly by session history.
|
||||
if (mUseErrorPages && aURI && aFailedChannel) {
|
||||
// Display an error page
|
||||
LoadErrorPage(aURI, aURL, error.get(), messageStr.get(),
|
||||
cssClass.get(), aFailedChannel);
|
||||
LoadErrorPage(aURI, aURL, errorPage.get(), error.get(),
|
||||
messageStr.get(), cssClass.get(), aFailedChannel);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3066,6 +3079,7 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI *aURI,
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::LoadErrorPage(nsIURI *aURI, const PRUnichar *aURL,
|
||||
const char *aErrorPage,
|
||||
const PRUnichar *aErrorType,
|
||||
const PRUnichar *aDescription,
|
||||
const char *aCSSClass,
|
||||
@@ -3135,7 +3149,9 @@ nsDocShell::LoadErrorPage(nsIURI *aURI, const PRUnichar *aURL,
|
||||
char *escapedDescription = nsEscape(NS_ConvertUTF16toUTF8(aDescription).get(), url_Path);
|
||||
char *escapedCSSClass = nsEscape(aCSSClass, url_Path);
|
||||
|
||||
nsCString errorPageUrl("about:neterror?e=");
|
||||
nsCString errorPageUrl("about:");
|
||||
errorPageUrl.AppendASCII(aErrorPage);
|
||||
errorPageUrl.AppendLiteral("?e=");
|
||||
|
||||
errorPageUrl.AppendASCII(escapedError);
|
||||
errorPageUrl.AppendLiteral("&u=");
|
||||
|
||||
Reference in New Issue
Block a user