mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1522412 - P3. Adopt nsIChannel.LOAD_BYPASS_URL_CLASSIFIER in the algorithm determining if we should classify a channel's URI. r=Ehsan,mayhemer
This patch uses the flag to exempt channels from classification, but it doesn't include the use cases of this flag. See Bug 1442496 for the list of the call sites should use this flag. Differential Revision: https://phabricator.services.mozilla.com/D22112 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
9878ae650d
commit
d7d67be8c9
@ -311,6 +311,9 @@ static void LogRequest(nsIRequest* aRequest) {
|
||||
if (loadFlags & nsIChannel::LOAD_TARGETED) printf("targeted; ");
|
||||
if (loadFlags & nsIChannel::LOAD_CALL_CONTENT_SNIFFERS)
|
||||
printf("call content sniffers; ");
|
||||
if (loadFlags & nsIChannel::LOAD_BYPASS_URL_CLASSIFIER) {
|
||||
printf("bypass classify uri; ");
|
||||
}
|
||||
} else {
|
||||
printf(" no request");
|
||||
}
|
||||
|
@ -10362,8 +10362,8 @@ nsresult nsDocShell::DoChannelLoad(nsIChannel* aChannel,
|
||||
break;
|
||||
}
|
||||
|
||||
if (!aBypassClassifier) {
|
||||
// Keep this for later use
|
||||
if (aBypassClassifier) {
|
||||
loadFlags |= nsIChannel::LOAD_BYPASS_URL_CLASSIFIER;
|
||||
}
|
||||
|
||||
// If the user pressed shift-reload, then do not allow ServiceWorker
|
||||
|
@ -248,7 +248,11 @@ interface nsIChannel : nsIRequest
|
||||
*/
|
||||
const unsigned long LOAD_CALL_CONTENT_SNIFFERS = 1 << 21;
|
||||
|
||||
// LOAD_BYPASS_URL_CLASSIFIER will be added
|
||||
/**
|
||||
* This flag tells the channel to bypass URL classifier service check
|
||||
* when opening the channel.
|
||||
*/
|
||||
const unsigned long LOAD_BYPASS_URL_CLASSIFIER = 1 << 22;
|
||||
|
||||
/**
|
||||
* If this flag is set, the media-type content sniffer will be allowed
|
||||
|
@ -3038,15 +3038,23 @@ bool NS_IsOffline() {
|
||||
* flag to enforce bypassing the URL classifier check.
|
||||
*/
|
||||
bool NS_ShouldClassifyChannel(nsIChannel *aChannel) {
|
||||
nsLoadFlags loadFlags;
|
||||
Unused << aChannel->GetLoadFlags(&loadFlags);
|
||||
// If our load flags dictate that we must let this channel through without
|
||||
// URL classification, obey that here without performing more checks.
|
||||
if (loadFlags & nsIChannel::LOAD_BYPASS_URL_CLASSIFIER) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIHttpChannelInternal> httpChannel(do_QueryInterface(aChannel));
|
||||
if (httpChannel) {
|
||||
bool beConservative;
|
||||
nsresult rv = httpChannel->GetBeConservative(&beConservative);
|
||||
|
||||
// beConservative flag, set by ServiceRequest to ensure channels that fetch
|
||||
// update use conservative TLS setting, are used here to identify channels
|
||||
// are critical to bypass classification. for channels don't support
|
||||
// beConservative, continue to apply the exemption rules.
|
||||
// beConservative flag, set by ServiceRequest to ensure channels that
|
||||
// fetch update use conservative TLS setting, are used here to identify
|
||||
// channels are critical to bypass classification. for channels don't
|
||||
// support beConservative, continue to apply the exemption rules.
|
||||
if (NS_SUCCEEDED(rv) && beConservative) {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user