Don't let an empty intl.charset.default pref set the document charset to

the empty string.  Fall back to ISO-8859-1 in the script loader if there
is no other charset set.  Bug 118404, r=harishd, sr=jst
This commit is contained in:
bzbarsky%mit.edu 2002-02-01 21:36:00 +00:00
Родитель 2865243e84
Коммит af3700e48e
2 изменённых файлов: 7 добавлений и 2 удалений

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

@ -691,6 +691,11 @@ nsScriptLoader::OnStreamComplete(nsIStreamLoader* aLoader,
NS_ASSERTION(NS_SUCCEEDED(rv), "Could not get document charset!");
if (characterSet.IsEmpty()) {
// fall back to ISO-8851-1, see bug 118404
characterSet = NS_LITERAL_STRING("ISO-8859-1");
}
nsCOMPtr<nsICharsetConverterManager> charsetConv =
do_GetService(kCharsetConverterManagerCID, &rv);

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

@ -679,11 +679,11 @@ nsHTMLDocument::TryWeakDocTypeDefault(PRInt32& aCharsetSource,
if (prefs) {
nsXPIDLString defCharset;
nsresult rv = prefs->GetLocalizedUnicharPref("intl.charset.default", getter_Copies(defCharset));
if (NS_SUCCEEDED(rv)) {
if (NS_SUCCEEDED(rv) && !defCharset.IsEmpty()) {
aCharset.Assign(defCharset);
aCharsetSource = kCharsetFromWeakDocTypeDefault;
}
}
aCharsetSource = kCharsetFromWeakDocTypeDefault;
return PR_TRUE;
}