Bug 1428473 Support X-Content-Type-Options: nosniff when navigating r=ckerschb,dragana,alchen
*** Apply Requested Revision Differential Revision: https://phabricator.services.mozilla.com/D33959
This commit is contained in:
@@ -190,7 +190,8 @@ nsHtml5StreamParser::nsHtml5StreamParser(nsHtml5TreeOpExecutor* aExecutor,
|
||||
mFlushTimerMutex("nsHtml5StreamParser mFlushTimerMutex"),
|
||||
mFlushTimerArmed(false),
|
||||
mFlushTimerEverFired(false),
|
||||
mMode(aMode) {
|
||||
mMode(aMode),
|
||||
mSkipContentSniffing(false) {
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
#ifdef DEBUG
|
||||
mAtomTable.SetPermittedLookupEventTarget(mEventTarget);
|
||||
@@ -631,7 +632,7 @@ nsresult nsHtml5StreamParser::FinalizeSniffing(Span<const uint8_t> aFromSegment,
|
||||
}
|
||||
|
||||
// meta scan failed.
|
||||
if (mCharsetSource < kCharsetFromMetaPrescan) {
|
||||
if (!mSkipContentSniffing && mCharsetSource < kCharsetFromMetaPrescan) {
|
||||
// Check for BOMless UTF-16 with Basic
|
||||
// Latin content for compat with IE. See bug 631751.
|
||||
SniffBOMlessUTF16BasicLatin(aFromSegment.To(aCountToSniffingLimit));
|
||||
@@ -662,6 +663,7 @@ nsresult nsHtml5StreamParser::SniffStreamBytes(
|
||||
Span<const uint8_t> aFromSegment) {
|
||||
NS_ASSERTION(IsParserThread(), "Wrong thread!");
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// mEncoding and mCharsetSource potentially have come from channel or higher
|
||||
// by now. If we find a BOM, SetupDecodingFromBom() will overwrite them.
|
||||
// If we don't find a BOM, the previously set values of mEncoding and
|
||||
@@ -957,6 +959,13 @@ 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) {
|
||||
mFeedChardet = false;
|
||||
}
|
||||
|
||||
mStreamState = STREAM_BEING_READ;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user