Bug 1602213 - Do not let X-Content-Type-Options: nosniff affect encoding detection, because Chrome runs its encoding detector. r=sstreich

Differential Revision: https://phabricator.services.mozilla.com/D57316
This commit is contained in:
Henri Sivonen
2019-12-16 17:40:26 +00:00
parent b898d48b43
commit a9823b1f13
4 changed files with 4 additions and 15 deletions

View File

@@ -186,8 +186,7 @@ nsHtml5StreamParser::nsHtml5StreamParser(nsHtml5TreeOpExecutor* aExecutor,
mFlushTimerMutex("nsHtml5StreamParser mFlushTimerMutex"),
mFlushTimerArmed(false),
mFlushTimerEverFired(false),
mMode(aMode),
mSkipContentSniffing(false) {
mMode(aMode) {
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
#ifdef DEBUG
mAtomTable.SetPermittedLookupEventTarget(mEventTarget);
@@ -599,7 +598,7 @@ nsresult nsHtml5StreamParser::FinalizeSniffing(Span<const uint8_t> aFromSegment,
}
// meta scan failed.
if (!mSkipContentSniffing && mCharsetSource < kCharsetFromMetaPrescan) {
if (mCharsetSource < kCharsetFromMetaPrescan) {
// Check for BOMless UTF-16 with Basic
// Latin content for compat with IE. See bug 631751.
SniffBOMlessUTF16BasicLatin(aFromSegment.To(aCountToSniffingLimit));
@@ -985,13 +984,6 @@ nsresult nsHtml5StreamParser::OnStartRequest(nsIRequest* aRequest) {
mObserver->OnStartRequest(aRequest);
}
mRequest = aRequest;
nsCOMPtr<nsIChannel> myChannel(do_QueryInterface(aRequest));
nsCOMPtr<nsILoadInfo> loadInfo = myChannel->LoadInfo();
mSkipContentSniffing = loadInfo->GetSkipContentSniffing();
if (mSkipContentSniffing) {
DontGuessEncoding();
}
mStreamState = STREAM_BEING_READ;