Bug 234628 part 1 - Make the BOM take precedence over manual encoding overrides. r=smaug.

This commit is contained in:
Henri Sivonen 2013-01-18 16:27:03 +02:00
parent c0519c5841
commit 7f2f8a25e2
2 changed files with 10 additions and 12 deletions

View File

@ -938,17 +938,17 @@ nsHtml5StreamParser::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext)
}
nsCOMPtr<nsIWyciwygChannel> wyciwygChannel(do_QueryInterface(mRequest));
if (wyciwygChannel) {
mReparseForbidden = true;
mFeedChardet = false;
// If we are reloading a document.open()ed doc, fall through to converter
// instantiation here and avoid BOM sniffing.
} else if (mCharsetSource < kCharsetFromParentForced) {
if (!wyciwygChannel) {
// we aren't ready to commit to an encoding yet
// leave converter uninstantiated for now
return NS_OK;
}
// We are reloading a document.open()ed doc.
mReparseForbidden = true;
mFeedChardet = false;
// Instantiate the converter here to avoid BOM sniffing.
nsCOMPtr<nsICharsetConverterManager> convManager = do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = convManager->GetUnicodeDecoder(mCharset.get(), getter_AddRefs(mUnicodeDecoder));

View File

@ -19,10 +19,8 @@
#define kCharsetFromIrreversibleAutoDetection 10
#define kCharsetFromChannel 11
#define kCharsetFromOtherComponent 12
#define kCharsetFromByteOrderMark 13
// Levels below here will be forced onto childframes too
#define kCharsetFromParentForced 14
#define kCharsetFromUserForced 15
#define kCharsetFromPreviousLoading 16
#define kCharsetFromParentForced 13 // propagates to child frames
#define kCharsetFromUserForced 14 // propagates to child frames
#define kCharsetFromByteOrderMark 15
#endif /* nsCharsetSource_h_ */