Bug 1373045 - Avoid double-resolving the replacement encoding. r=emk

MozReview-Commit-ID: F0nOJ2opz0r

--HG--
extra : rebase_source : 4dda4f9628f8879626f3fe40df52feba6e18aa00
This commit is contained in:
Henri Sivonen 2017-06-15 11:05:05 +03:00
parent ebc59facdc
commit 70a5344073

View File

@ -107,9 +107,13 @@ nsresult nsScanner::SetDocumentCharset(const nsACString& aCharset , int32_t aSou
mCharsetSource = aSource;
nsCString charsetName;
mozilla::DebugOnly<bool> valid =
EncodingUtils::FindEncodingForLabel(aCharset, charsetName);
MOZ_ASSERT(valid, "Should never call with a bogus aCharset.");
if (aCharset.EqualsLiteral("replacement")) {
charsetName.Assign(aCharset);
} else {
mozilla::DebugOnly<bool> valid =
EncodingUtils::FindEncodingForLabel(aCharset, charsetName);
MOZ_ASSERT(valid, "Should never call with a bogus aCharset.");
}
if (!mCharset.IsEmpty() && charsetName.Equals(mCharset)) {
return NS_OK; // no difference, don't change it