bug 1483311 - add LOAD_DISABLE_TRR as a loadflag r=mcmanus

Disable TRR at will without needing to toggle the pref.

MozReview-Commit-ID: 1Ept6kDrjN3

Differential Revision: https://phabricator.services.mozilla.com/D3399

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Daniel Stenberg 2018-08-20 22:02:04 +00:00
parent 73411195a3
commit 8225a95bbd
2 changed files with 10 additions and 0 deletions

View File

@ -137,6 +137,12 @@ interface nsIRequest : nsISupports
*/ */
const unsigned long LOAD_DOCUMENT_NEEDS_COOKIE = 1 << 2; const unsigned long LOAD_DOCUMENT_NEEDS_COOKIE = 1 << 2;
/**
* Set this flag to disable TRR for this request.
*/
const unsigned long LOAD_DISABLE_TRR = 1 << 3;
/************************************************************************** /**************************************************************************
* The following flags control the flow of data into the cache. * The following flags control the flow of data into the cache.
*/ */

View File

@ -565,6 +565,10 @@ nsHttpChannel::OnBeforeConnect()
mCaps |= NS_HTTP_LARGE_KEEPALIVE | NS_HTTP_DISABLE_TRR; mCaps |= NS_HTTP_LARGE_KEEPALIVE | NS_HTTP_DISABLE_TRR;
} }
if (mLoadFlags & LOAD_DISABLE_TRR) {
mCaps |= NS_HTTP_DISABLE_TRR;
}
// Finalize ConnectionInfo flags before SpeculativeConnect // Finalize ConnectionInfo flags before SpeculativeConnect
mConnectionInfo->SetAnonymous((mLoadFlags & LOAD_ANONYMOUS) != 0); mConnectionInfo->SetAnonymous((mLoadFlags & LOAD_ANONYMOUS) != 0);
mConnectionInfo->SetPrivate(mPrivateBrowsing); mConnectionInfo->SetPrivate(mPrivateBrowsing);