diff options
author | Moonchild <moonchild@palemoon.org> | 2021-10-22 05:39:02 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2022-04-01 16:03:01 +0200 |
commit | a95439db61c4530afae3967e2912d6ca38f1bbda (patch) | |
tree | ed8926c1fe52c8072dbaff40278c1f0370980c2f /netwerk | |
parent | f5fcb8a32ccbe9af1a16a05c4959f7389eae37c1 (diff) | |
download | uxp-a95439db61c4530afae3967e2912d6ca38f1bbda.tar.gz |
Issue #1822 - Part 3: Remove LOAD_CLASSIFIER_URI and various
helper functions.
Diffstat (limited to 'netwerk')
-rw-r--r-- | netwerk/base/nsBaseChannel.cpp | 22 | ||||
-rw-r--r-- | netwerk/base/nsBaseChannel.h | 3 | ||||
-rw-r--r-- | netwerk/base/nsIChannel.idl | 4 | ||||
-rw-r--r-- | netwerk/protocol/http/nsHttpChannel.cpp | 62 |
4 files changed, 2 insertions, 89 deletions
diff --git a/netwerk/base/nsBaseChannel.cpp b/netwerk/base/nsBaseChannel.cpp index 85181c50bd..a4d8d0d42f 100644 --- a/netwerk/base/nsBaseChannel.cpp +++ b/netwerk/base/nsBaseChannel.cpp @@ -304,25 +304,6 @@ nsBaseChannel::ContinueHandleAsyncRedirect(nsresult result) CallbacksChanged(); } -void -nsBaseChannel::ClassifyURI() -{ - // For channels created in the child process, delegate to the parent to - // classify URIs. - if (!XRE_IsParentProcess()) { - return; - } - - if (mLoadFlags & LOAD_CLASSIFY_URI) { - RefPtr<nsChannelClassifier> classifier = new nsChannelClassifier(); - if (classifier) { - classifier->Start(this); - } else { - Cancel(NS_ERROR_OUT_OF_MEMORY); - } - } -} - //----------------------------------------------------------------------------- // nsBaseChannel::nsISupports @@ -627,7 +608,6 @@ nsBaseChannel::Open(nsIInputStream **result) if (NS_SUCCEEDED(rv)) { mWasOpened = true; - ClassifyURI(); } return rv; @@ -698,8 +678,6 @@ nsBaseChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *ctxt) if (mLoadGroup) mLoadGroup->AddRequest(this, nullptr); - ClassifyURI(); - return NS_OK; } diff --git a/netwerk/base/nsBaseChannel.h b/netwerk/base/nsBaseChannel.h index b98609e857..390a492f9b 100644 --- a/netwerk/base/nsBaseChannel.h +++ b/netwerk/base/nsBaseChannel.h @@ -241,9 +241,6 @@ private: void ContinueHandleAsyncRedirect(nsresult result); nsresult ContinueRedirect(); - // start URI classifier if requested - void ClassifyURI(); - class RedirectRunnable : public mozilla::Runnable { public: diff --git a/netwerk/base/nsIChannel.idl b/netwerk/base/nsIChannel.idl index 743e942920..b668c518d0 100644 --- a/netwerk/base/nsIChannel.idl +++ b/netwerk/base/nsIChannel.idl @@ -258,10 +258,8 @@ interface nsIChannel : nsIRequest const unsigned long LOAD_CALL_CONTENT_SNIFFERS = 1 << 21; /** - * This flag tells the channel to use URI classifier service to check - * the URI when opening the channel. + * Bit 22 is unused. */ - const unsigned long LOAD_CLASSIFY_URI = 1 << 22; /** * If this flag is set, the media-type content sniffer will be allowed diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index 3ba812b923..16d31a8fc9 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -5842,37 +5842,6 @@ nsHttpChannel::BeginConnectContinue() if (mAPIRedirectToURI) { return AsyncCall(&nsHttpChannel::HandleAsyncAPIRedirect); } - // Check to see if this principal exists on local blocklists. - RefPtr<nsChannelClassifier> channelClassifier = new nsChannelClassifier(); - if (mLoadFlags & LOAD_CLASSIFY_URI) { - nsCOMPtr<nsIURIClassifier> classifier = do_GetService(NS_URICLASSIFIERSERVICE_CONTRACTID); - bool tpEnabled = false; - channelClassifier->ShouldEnableTrackingProtection(this, &tpEnabled); - if (classifier && tpEnabled) { - // We skip speculative connections by setting mLocalBlocklist only - // when tracking protection is enabled. Though we could do this for - // both phishing and malware, it is not necessary for correctness, - // since no network events will be received while the - // nsChannelClassifier is in progress. See bug 1122691. - nsCOMPtr<nsIURI> uri; - rv = GetURI(getter_AddRefs(uri)); - if (NS_SUCCEEDED(rv) && uri) { - nsAutoCString tables; - Preferences::GetCString("urlclassifier.trackingTable", &tables); - nsAutoCString results; - rv = classifier->ClassifyLocalWithTables(uri, tables, results); - if (NS_SUCCEEDED(rv) && !results.IsEmpty()) { - LOG(("nsHttpChannel::ClassifyLocalWithTables found " - "uri on local tracking blocklist [this=%p]", - this)); - mLocalBlocklist = true; - } else { - LOG(("nsHttpChannel::ClassifyLocalWithTables no result " - "found [this=%p]", this)); - } - } - } - } // If mTimingEnabled flag is not set after OnModifyRequest() then // clear the already recorded AsyncOpen value for consistency. @@ -5945,36 +5914,7 @@ nsHttpChannel::BeginConnectContinue() return mStatus; } - if (!(mLoadFlags & LOAD_CLASSIFY_URI)) { - return ContinueBeginConnectWithResult(); - } - - // mLocalBlocklist is true only if tracking protection is enabled and the - // URI is a tracking domain, it makes no guarantees about phishing or - // malware, so if LOAD_CLASSIFY_URI is true we must call - // nsChannelClassifier to catch phishing and malware URIs. - bool callContinueBeginConnect = true; - if (!mLocalBlocklist) { - // Here we call ContinueBeginConnectWithResult and not - // ContinueBeginConnect so that in the case of an error we do not start - // channelClassifier. - rv = ContinueBeginConnectWithResult(); - if (NS_FAILED(rv)) { - return rv; - } - callContinueBeginConnect = false; - } - // nsChannelClassifier calls ContinueBeginConnect if it has not already - // been called, after optionally cancelling the channel once we have a - // remote verdict. We call a concrete class instead of an nsI* that might - // be overridden. - LOG(("nsHttpChannel::Starting nsChannelClassifier %p [this=%p]", - channelClassifier.get(), this)); - channelClassifier->Start(this); - if (callContinueBeginConnect) { - return ContinueBeginConnectWithResult(); - } - return NS_OK; + return ContinueBeginConnectWithResult(); } NS_IMETHODIMP |