--- a/dom/ipc/PURLClassifierInfo.ipdlh
+++ b/dom/ipc/PURLClassifierInfo.ipdlh
@@ -5,17 +5,17 @@
using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
namespace mozilla {
namespace dom {
struct ClassifierInfo {
nsCString list;
nsCString provider;
- nsCString prefix;
+ nsCString fullhash;
};
union MaybeInfo {
ClassifierInfo;
void_t;
};
} // namespace dom
--- a/dom/ipc/URLClassifierChild.h
+++ b/dom/ipc/URLClassifierChild.h
@@ -27,17 +27,17 @@ public:
mozilla::ipc::IPCResult Recv__delete__(const MaybeInfo& aInfo,
const nsresult& aResult) override
{
MOZ_ASSERT(mCallback);
if (aInfo.type() == MaybeInfo::TClassifierInfo) {
mCallback->OnClassifyComplete(aResult, aInfo.get_ClassifierInfo().list(),
aInfo.get_ClassifierInfo().provider(),
- aInfo.get_ClassifierInfo().prefix());
+ aInfo.get_ClassifierInfo().fullhash());
}
return IPC_OK();
}
private:
~URLClassifierChildBase() = default;
nsCOMPtr<nsIURIClassifierCallback> mCallback;
--- a/dom/ipc/URLClassifierParent.h
+++ b/dom/ipc/URLClassifierParent.h
@@ -18,22 +18,22 @@ template<typename BaseProtocol>
class URLClassifierParentBase : public nsIURIClassifierCallback,
public BaseProtocol
{
public:
// nsIURIClassifierCallback.
NS_IMETHOD OnClassifyComplete(nsresult aErrorCode,
const nsACString& aList,
const nsACString& aProvider,
- const nsACString& aPrefix)
+ const nsACString& aFullHash)
{
if (mIPCOpen) {
ClassifierInfo info = ClassifierInfo(nsCString(aList),
nsCString(aProvider),
- nsCString(aPrefix));
+ nsCString(aFullHash));
Unused << BaseProtocol::Send__delete__(this, info, aErrorCode);
}
return NS_OK;
}
// Custom.
void ClassificationFailed()
{
--- a/netwerk/base/nsChannelClassifier.cpp
+++ b/netwerk/base/nsChannelClassifier.cpp
@@ -799,37 +799,37 @@ nsChannelClassifier::SameLoadingURI(nsID
}
// static
nsresult
nsChannelClassifier::SetBlockedContent(nsIChannel *channel,
nsresult aErrorCode,
const nsACString& aList,
const nsACString& aProvider,
- const nsACString& aPrefix)
+ const nsACString& aFullHash)
{
NS_ENSURE_ARG(!aList.IsEmpty());
- NS_ENSURE_ARG(!aPrefix.IsEmpty());
+ NS_ENSURE_ARG(!aFullHash.IsEmpty());
// Can be called in EITHER the parent or child process.
nsCOMPtr<nsIParentChannel> parentChannel;
NS_QueryNotificationCallbacks(channel, parentChannel);
if (parentChannel) {
// This channel is a parent-process proxy for a child process request.
// Tell the child process channel to do this instead.
- parentChannel->SetClassifierMatchedInfo(aList, aProvider, aPrefix);
+ parentChannel->SetClassifierMatchedInfo(aList, aProvider, aFullHash);
return NS_OK;
}
nsresult rv;
nsCOMPtr<nsIClassifiedChannel> classifiedChannel = do_QueryInterface(channel, &rv);
NS_ENSURE_SUCCESS(rv, rv);
if (classifiedChannel) {
- classifiedChannel->SetMatchedInfo(aList, aProvider, aPrefix);
+ classifiedChannel->SetMatchedInfo(aList, aProvider, aFullHash);
}
nsCOMPtr<mozIDOMWindowProxy> win;
nsCOMPtr<mozIThirdPartyUtil> thirdPartyUtil =
do_GetService(THIRDPARTYUTIL_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, NS_OK);
rv = thirdPartyUtil->GetTopWindowForChannel(channel, getter_AddRefs(win));
NS_ENSURE_SUCCESS(rv, NS_OK);
@@ -909,61 +909,61 @@ NS_IMPL_ISUPPORTS(URIClassifierCallbackB
// A template class for reusing the code.
// OnClassifyCompleteInternal will be called to pass the result.
template<class T>
class IsTrackerWhitelistedCallback final : public URIClassifierCallbackBase {
public:
explicit IsTrackerWhitelistedCallback(T* aClosure,
const nsACString& aList,
const nsACString& aProvider,
- const nsACString& aPrefix,
+ const nsACString& aFullHash,
nsIURI* aWhitelistURI)
: mClosure(aClosure)
, mWhitelistURI(aWhitelistURI)
, mList(aList)
, mProvider(aProvider)
- , mPrefix(aPrefix)
+ , mFullHash(aFullHash)
{
}
NS_IMETHOD OnClassifyComplete(nsresult /*aErrorCode*/,
const nsACString& aLists, // Only this matters.
const nsACString& /*aProvider*/,
- const nsACString& /*aPrefix*/) override
+ const nsACString& /*aFullHash*/) override
{
nsresult rv;
if (aLists.IsEmpty()) {
if (LOG_ENABLED()) {
MOZ_ASSERT(mWhitelistURI);
LOG(("nsChannelClassifier[%p]: %s is not in the whitelist",
mClosure.get(), mWhitelistURI->GetSpecOrDefault().get()));
}
rv = NS_ERROR_TRACKING_URI;
} else {
LOG(("nsChannelClassifier[%p]:OnClassifyComplete tracker found "
"in whitelist so we won't block it", mClosure.get()));
rv = NS_OK;
}
- rv = mClosure->OnClassifyCompleteInternal(rv, mList, mProvider, mPrefix);
+ rv = mClosure->OnClassifyCompleteInternal(rv, mList, mProvider, mFullHash);
mClosure = nullptr;
return rv;
}
private:
~IsTrackerWhitelistedCallback() = default;
RefPtr<T> mClosure;
nsCOMPtr<nsIURI> mWhitelistURI;
// The following 3 values are for forwarding the callback.
nsCString mList;
nsCString mProvider;
- nsCString mPrefix;
+ nsCString mFullHash;
};
// This class is designed to get the results of checking blacklist and whitelist.
// 1. The result of local blacklist will be sent back via
// OnClassifyComplete, which is called by nsIURIClassifier service.
// 2. The result of local whitelist is got via OnClassifyCompleteInternal,
// which is called by IsTrackerWhitelistedCallback::OnClassifyComplete.
class IsTrackerBlacklistedCallback final : public nsIURIClassifierCallback {
@@ -976,63 +976,63 @@ public:
}
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIURICLASSIFIERCALLBACK
nsresult OnClassifyCompleteInternal(nsresult aErrorCode,
const nsACString& aList,
const nsACString& aProvider,
- const nsACString& aPrefix);
+ const nsACString& aFullHash);
private:
~IsTrackerBlacklistedCallback() = default;
RefPtr<nsChannelClassifier> mChannelClassifier;
nsCOMPtr<nsIURIClassifierCallback> mChannelCallback;
};
NS_IMPL_ISUPPORTS(IsTrackerBlacklistedCallback, nsIURIClassifierCallback)
/*virtual*/ nsresult
IsTrackerBlacklistedCallback::OnClassifyComplete(nsresult aErrorCode,
const nsACString& aLists,
const nsACString& aProvider,
- const nsACString& aPrefix)
+ const nsACString& aFullHash)
{
nsresult status = aLists.IsEmpty() ? NS_OK : NS_ERROR_TRACKING_URI;
bool tpEnabled = mChannelClassifier->ShouldEnableTrackingProtection();
LOG(("IsTrackerBlacklistedCallback[%p]:OnClassifyComplete "
" status=0x%" PRIx32 ", tpEnabled=%d",
mChannelClassifier.get(), static_cast<uint32_t>(status), tpEnabled));
// If this is not in local blacklist or tracking protection is enabled,
// directly send the status back.
// The whitelist will be checked at nsChannelClassifier::OnClassifyComplete
// when tracking protection is enabled, so we can just return here.
if (NS_SUCCEEDED(status) || tpEnabled) {
return mChannelCallback->OnClassifyComplete(
- status, aLists, aProvider, aPrefix);
+ status, aLists, aProvider, aFullHash);
}
nsCOMPtr<nsIChannel> channel = mChannelClassifier->GetChannel();
if (LOG_ENABLED()) {
nsCOMPtr<nsIURI> uri;
channel->GetURI(getter_AddRefs(uri));
LOG(("IsTrackerBlacklistedCallback[%p]:OnClassifyComplete channel [%p] "
"uri=%s, is in blacklist. Start checking whitelist.",
mChannelClassifier.get(), channel.get(),
uri->GetSpecOrDefault().get()));
}
nsCOMPtr<nsIURI> whitelistURI = mChannelClassifier->CreateWhiteListURI();
nsCOMPtr<nsIURIClassifierCallback> callback =
new IsTrackerWhitelistedCallback<IsTrackerBlacklistedCallback>(
- this, aLists, aProvider, aPrefix, whitelistURI);
+ this, aLists, aProvider, aFullHash, whitelistURI);
// If IsTrackerWhitelisted has failed, it means the uri is not in whitelist.
if (NS_FAILED(mChannelClassifier->IsTrackerWhitelisted(whitelistURI, callback))) {
LOG(("IsTrackerBlacklistedCallback[%p]:OnClassifyComplete channel [%p] "
"IsTrackerWhitelisted has failed.",
mChannelClassifier.get(), channel.get()));
MOZ_ASSERT(mChannelClassifier->ShouldEnableTrackingAnnotation());
@@ -1042,37 +1042,37 @@ IsTrackerBlacklistedCallback::OnClassify
LowerPriorityHelper(channel);
}
// We don't want to disable speculative connection when tracking protection
// is disabled. So, change the status to NS_OK.
status = NS_OK;
return mChannelCallback->OnClassifyComplete(
- status, aLists, aProvider, aPrefix);
+ status, aLists, aProvider, aFullHash);
}
// OnClassifyCompleteInternal() will be called once we know
// if the tracker is whitelisted.
return NS_OK;
}
nsresult
IsTrackerBlacklistedCallback::OnClassifyCompleteInternal(nsresult aErrorCode,
const nsACString& aLists,
const nsACString& aProvider,
- const nsACString& aPrefix)
+ const nsACString& aFullHash)
{
LOG(("IsTrackerBlacklistedCallback[%p]:OnClassifyCompleteInternal"
" status=0x%" PRIx32,
mChannelClassifier.get(), static_cast<uint32_t>(aErrorCode)));
if (NS_SUCCEEDED(aErrorCode)) {
return mChannelCallback->OnClassifyComplete(
- aErrorCode, aLists, aProvider, aPrefix);
+ aErrorCode, aLists, aProvider, aFullHash);
}
MOZ_ASSERT(mChannelClassifier->ShouldEnableTrackingAnnotation());
MOZ_ASSERT(aErrorCode == NS_ERROR_TRACKING_URI);
nsCOMPtr<nsIChannel> channel = mChannelClassifier->GetChannel();
if (LOG_ENABLED()) {
nsCOMPtr<nsIURI> uri;
@@ -1084,17 +1084,17 @@ IsTrackerBlacklistedCallback::OnClassify
}
SetIsTrackingResourceHelper(channel);
if (CachedPrefs::GetInstance()->IsLowerNetworkPriority()) {
LowerPriorityHelper(channel);
}
return mChannelCallback->OnClassifyComplete(
- NS_OK, aLists, aProvider, aPrefix);
+ NS_OK, aLists, aProvider, aFullHash);
}
} // end of unnamed namespace/
already_AddRefed<nsIURI>
nsChannelClassifier::CreateWhiteListURI() const
{
nsresult rv;
@@ -1160,42 +1160,42 @@ nsChannelClassifier::IsTrackerWhiteliste
return uriClassifier->AsyncClassifyLocalWithTables(aWhiteListURI, trackingWhitelist, aCallback);
}
NS_IMETHODIMP
nsChannelClassifier::OnClassifyComplete(nsresult aErrorCode,
const nsACString& aList,
const nsACString& aProvider,
- const nsACString& aPrefix)
+ const nsACString& aFullHash)
{
// Should only be called in the parent process.
MOZ_ASSERT(XRE_IsParentProcess());
if (aErrorCode == NS_ERROR_TRACKING_URI) {
nsCOMPtr<nsIURI> whitelistURI = CreateWhiteListURI();
nsCOMPtr<nsIURIClassifierCallback> callback =
new IsTrackerWhitelistedCallback<nsChannelClassifier>(
- this, aList, aProvider, aPrefix, whitelistURI);
+ this, aList, aProvider, aFullHash, whitelistURI);
if (whitelistURI &&
NS_SUCCEEDED(IsTrackerWhitelisted(whitelistURI, callback))) {
// OnClassifyCompleteInternal() will be called once we know
// if the tracker is whitelisted.
return NS_OK;
}
}
- return OnClassifyCompleteInternal(aErrorCode, aList, aProvider, aPrefix);
+ return OnClassifyCompleteInternal(aErrorCode, aList, aProvider, aFullHash);
}
nsresult
nsChannelClassifier::OnClassifyCompleteInternal(nsresult aErrorCode,
const nsACString& aList,
const nsACString& aProvider,
- const nsACString& aPrefix)
+ const nsACString& aFullHash)
{
if (mSuspendedChannel) {
nsAutoCString errorName;
if (LOG_ENABLED()) {
GetErrorName(aErrorCode, errorName);
LOG(("nsChannelClassifier[%p]:OnClassifyComplete %s (suspended channel)",
this, errorName.get()));
}
@@ -1209,17 +1209,17 @@ nsChannelClassifier::OnClassifyCompleteI
"with error code %s", this, mChannel.get(),
uri->GetSpecOrDefault().get(), errorName.get()));
}
// Channel will be cancelled (page element blocked) due to tracking
// protection or Safe Browsing.
// Do update the security state of the document and fire a security
// change event.
- SetBlockedContent(mChannel, aErrorCode, aList, aProvider, aPrefix);
+ SetBlockedContent(mChannel, aErrorCode, aList, aProvider, aFullHash);
mChannel->Cancel(aErrorCode);
}
LOG(("nsChannelClassifier[%p]: resuming channel %p from "
"OnClassifyComplete", this, mChannel.get()));
mChannel->Resume();
}
--- a/netwerk/base/nsChannelClassifier.h
+++ b/netwerk/base/nsChannelClassifier.h
@@ -40,17 +40,17 @@ public:
nsresult IsTrackerWhitelisted(nsIURI* aWhiteListURI,
nsIURIClassifierCallback* aCallback);
// Called once we actually classified an URI. (An additional whitelist
// check will be done if the classifier reports the URI is a tracker.)
nsresult OnClassifyCompleteInternal(nsresult aErrorCode,
const nsACString& aList,
const nsACString& aProvider,
- const nsACString& aPrefix);
+ const nsACString& aFullHash);
// Check a tracking URI against the local blacklist and whitelist.
// Returning NS_OK means the check will be processed
// and the caller should wait for the result.
nsresult CheckIsTrackerWithLocalTable(nsIURIClassifierCallback* aCallback);
// Helper function to create a whitelist URL.
already_AddRefed<nsIURI> CreateWhiteListURI() const;
@@ -91,16 +91,16 @@ private:
void RemoveShutdownObserver();
public:
// If we are blocking content, update the corresponding flag in the respective
// docshell and call nsISecurityEventSink::onSecurityChange.
static nsresult SetBlockedContent(nsIChannel *channel,
nsresult aErrorCode,
const nsACString& aList,
const nsACString& aProvider,
- const nsACString& aPrefix);
+ const nsACString& aFullHash);
static nsresult NotifyTrackingProtectionDisabled(nsIChannel *aChannel);
};
} // namespace net
} // namespace mozilla
#endif
--- a/netwerk/base/nsIClassifiedChannel.idl
+++ b/netwerk/base/nsIClassifiedChannel.idl
@@ -17,31 +17,31 @@ interface nsIClassifiedChannel : nsISupp
{
/**
* Sets matched info of the classified channel.
*
* @param aList
* Name of the Safe Browsing list that matched (e.g. goog-phish-shavar).
* @param aProvider
* Name of the Safe Browsing provider that matched (e.g. google)
- * @param aPrefix
- * Hash prefix of URL that matched Safe Browsing list.
+ * @param aFullHash
+ * Full hash of URL that matched Safe Browsing list.
*/
void setMatchedInfo(in ACString aList,
in ACString aProvider,
- in ACString aPrefix);
+ in ACString aFullHash);
/**
* Name of the list that matched
*/
readonly attribute ACString matchedList;
/**
* Name of provider that matched
*/
readonly attribute ACString matchedProvider;
/**
- * Hash prefix of URL that matched
+ * Full hash of URL that matched
*/
- readonly attribute ACString matchedPrefix;
+ readonly attribute ACString matchedFullHash;
};
--- a/netwerk/base/nsIParentChannel.idl
+++ b/netwerk/base/nsIParentChannel.idl
@@ -35,22 +35,22 @@ interface nsIParentChannel : nsIStreamLi
[noscript] void notifyTrackingProtectionDisabled();
/**
* Called to set matched information when URL matches SafeBrowsing list.
* @param aList
* Name of the list that matched
* @param aProvider
* Name of provider that matched
- * @param aPrefix
- * String represents hash prefix that matched
+ * @param aFullHash
+ * String represents full hash that matched
*/
[noscript] void setClassifierMatchedInfo(in ACString aList,
in ACString aProvider,
- in ACString aPrefix);
+ in ACString aFullHash);
/**
* Called to notify the HttpChannelChild that the resource being loaded
* is on the tracking protection list.
*/
[noscript] void notifyTrackingResource();
/**
--- a/netwerk/base/nsIURIClassifier.idl
+++ b/netwerk/base/nsIURIClassifier.idl
@@ -29,23 +29,23 @@ interface nsIURIClassifierCallback : nsI
*
* @param aErrorCode
* The error code with which the channel should be cancelled, or
* NS_OK if the load should continue normally.
* @param aList
* Name of the list that matched
* @param aProvider
* Name of provider that matched
- * @param aPrefix
- * Hash prefix of URL that matched
+ * @param aFullHash
+ * Full hash of URL that matched
*/
void onClassifyComplete(in nsresult aErrorCode,
in ACString aList,
in ACString aProvider,
- in ACString aPrefix);
+ in ACString aFullHash);
};
/**
* The URI classifier service checks a URI against lists of phishing
* and malware sites.
*/
[scriptable, uuid(596620cc-76e3-4133-9d90-360e59a794cf)]
interface nsIURIClassifier : nsISupports
--- a/netwerk/protocol/data/DataChannelParent.cpp
+++ b/netwerk/protocol/data/DataChannelParent.cpp
@@ -47,17 +47,17 @@ DataChannelParent::NotifyTrackingResourc
{
// Nothing to do.
return NS_OK;
}
NS_IMETHODIMP
DataChannelParent::SetClassifierMatchedInfo(const nsACString& aList,
const nsACString& aProvider,
- const nsACString& aPrefix)
+ const nsACString& aFullHash)
{
// nothing to do
return NS_OK;
}
NS_IMETHODIMP
DataChannelParent::Delete()
{
--- a/netwerk/protocol/file/FileChannelParent.cpp
+++ b/netwerk/protocol/file/FileChannelParent.cpp
@@ -47,17 +47,17 @@ FileChannelParent::NotifyTrackingResourc
{
// Nothing to do.
return NS_OK;
}
NS_IMETHODIMP
FileChannelParent::SetClassifierMatchedInfo(const nsACString& aList,
const nsACString& aProvider,
- const nsACString& aPrefix)
+ const nsACString& aFullHash)
{
// nothing to do
return NS_OK;
}
NS_IMETHODIMP
FileChannelParent::Delete()
{
--- a/netwerk/protocol/ftp/FTPChannelParent.cpp
+++ b/netwerk/protocol/ftp/FTPChannelParent.cpp
@@ -576,17 +576,17 @@ FTPChannelParent::NotifyTrackingResource
{
// One day, this should probably be filled in.
return NS_OK;
}
NS_IMETHODIMP
FTPChannelParent::SetClassifierMatchedInfo(const nsACString& aList,
const nsACString& aProvider,
- const nsACString& aPrefix)
+ const nsACString& aFullHash)
{
// One day, this should probably be filled in.
return NS_OK;
}
NS_IMETHODIMP
FTPChannelParent::Delete()
{
--- a/netwerk/protocol/http/HttpBackgroundChannelChild.cpp
+++ b/netwerk/protocol/http/HttpBackgroundChannelChild.cpp
@@ -424,17 +424,19 @@ HttpBackgroundChannelChild::RecvSetClass
MOZ_ASSERT(OnSocketThread());
if (NS_WARN_IF(!mChannelChild)) {
return IPC_OK();
}
// SetClassifierMatchedInfo has no order dependency to OnStartRequest.
// It this be handled as soon as possible
- mChannelChild->ProcessSetClassifierMatchedInfo(info.list(), info.provider(), info.prefix());
+ mChannelChild->ProcessSetClassifierMatchedInfo(info.list(),
+ info.provider(),
+ info.fullhash());
return IPC_OK();
}
void
HttpBackgroundChannelChild::ActorDestroy(ActorDestroyReason aWhy)
{
LOG(("HttpBackgroundChannelChild::ActorDestroy[this=%p]\n", this));
--- a/netwerk/protocol/http/HttpBackgroundChannelParent.cpp
+++ b/netwerk/protocol/http/HttpBackgroundChannelParent.cpp
@@ -395,20 +395,19 @@ HttpBackgroundChannelParent::OnNotifyTra
return NS_SUCCEEDED(rv);
}
return SendNotifyTrackingResource();
}
bool
-HttpBackgroundChannelParent::OnSetClassifierMatchedInfo(
- const nsACString& aList,
- const nsACString& aProvider,
- const nsACString& aPrefix)
+HttpBackgroundChannelParent::OnSetClassifierMatchedInfo(const nsACString& aList,
+ const nsACString& aProvider,
+ const nsACString& aFullHash)
{
LOG(("HttpBackgroundChannelParent::OnSetClassifierMatchedInfo [this=%p]\n", this));
AssertIsInMainProcess();
if (NS_WARN_IF(!mIPCOpened)) {
return false;
}
@@ -416,27 +415,27 @@ HttpBackgroundChannelParent::OnSetClassi
MutexAutoLock lock(mBgThreadMutex);
nsresult rv = mBackgroundThread->Dispatch(
NewRunnableMethod<const nsCString, const nsCString, const nsCString>(
"net::HttpBackgroundChannelParent::OnSetClassifierMatchedInfo",
this,
&HttpBackgroundChannelParent::OnSetClassifierMatchedInfo,
aList,
aProvider,
- aPrefix),
+ aFullHash),
NS_DISPATCH_NORMAL);
MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(rv));
return NS_SUCCEEDED(rv);
}
ClassifierInfo info;
info.list() = aList;
- info.prefix() = aPrefix;
+ info.fullhash() = aFullHash;
info.provider() = aProvider;
return SendSetClassifierMatchedInfo(info);
}
void
HttpBackgroundChannelParent::ActorDestroy(ActorDestroyReason aWhy)
{
--- a/netwerk/protocol/http/HttpBackgroundChannelParent.h
+++ b/netwerk/protocol/http/HttpBackgroundChannelParent.h
@@ -69,17 +69,17 @@ public:
bool OnNotifyTrackingProtectionDisabled();
// To send NotifyTrackingResource message over background channel.
bool OnNotifyTrackingResource();
// To send SetClassifierMatchedInfo message over background channel.
bool OnSetClassifierMatchedInfo(const nsACString& aList,
const nsACString& aProvider,
- const nsACString& aPrefix);
+ const nsACString& aFullHash);
protected:
void ActorDestroy(ActorDestroyReason aWhy) override;
private:
virtual ~HttpBackgroundChannelParent();
Atomic<bool> mIPCOpened;
--- a/netwerk/protocol/http/HttpBaseChannel.cpp
+++ b/netwerk/protocol/http/HttpBaseChannel.cpp
@@ -3685,31 +3685,31 @@ HttpBaseChannel::GetMatchedList(nsACStri
NS_IMETHODIMP
HttpBaseChannel::GetMatchedProvider(nsACString& aProvider)
{
aProvider = mMatchedProvider;
return NS_OK;
}
NS_IMETHODIMP
-HttpBaseChannel::GetMatchedPrefix(nsACString& aPrefix)
+HttpBaseChannel::GetMatchedFullHash(nsACString& aFullHash)
{
- aPrefix = mMatchedPrefix;
+ aFullHash = mMatchedFullHash;
return NS_OK;
}
NS_IMETHODIMP
HttpBaseChannel::SetMatchedInfo(const nsACString& aList,
const nsACString& aProvider,
- const nsACString& aPrefix) {
+ const nsACString& aFullHash) {
NS_ENSURE_ARG(!aList.IsEmpty());
mMatchedList = aList;
mMatchedProvider = aProvider;
- mMatchedPrefix = aPrefix;
+ mMatchedFullHash = aFullHash;
return NS_OK;
}
//-----------------------------------------------------------------------------
// HttpBaseChannel::nsITimedChannel
//-----------------------------------------------------------------------------
NS_IMETHODIMP
--- a/netwerk/protocol/http/HttpBaseChannel.h
+++ b/netwerk/protocol/http/HttpBaseChannel.h
@@ -659,17 +659,17 @@ protected:
uint64_t mReqContentLength;
bool mReqContentLengthDetermined;
nsString mIntegrityMetadata;
// Classified channel's matched information
nsCString mMatchedList;
nsCString mMatchedProvider;
- nsCString mMatchedPrefix;
+ nsCString mMatchedFullHash;
};
NS_DEFINE_STATIC_IID_ACCESSOR(HttpBaseChannel, HTTP_BASE_CHANNEL_IID)
// Share some code while working around C++'s absurd inability to handle casting
// of member functions between base/derived types.
// - We want to store member function pointer to call at resume time, but one
// such function--HandleAsyncAbort--we want to share between the
--- a/netwerk/protocol/http/HttpChannelChild.cpp
+++ b/netwerk/protocol/http/HttpChannelChild.cpp
@@ -1159,28 +1159,28 @@ HttpChannelChild::DoOnStopRequest(nsIReq
// nsCORSListenerProxy on this request, it will override the tracking
// protection's return value.
if (aChannelStatus == NS_ERROR_TRACKING_URI ||
aChannelStatus == NS_ERROR_MALWARE_URI ||
aChannelStatus == NS_ERROR_UNWANTED_URI ||
aChannelStatus == NS_ERROR_BLOCKED_URI ||
aChannelStatus == NS_ERROR_HARMFUL_URI ||
aChannelStatus == NS_ERROR_PHISHING_URI) {
- nsCString list, provider, prefix;
+ nsCString list, provider, fullhash;
nsresult rv = GetMatchedList(list);
NS_ENSURE_SUCCESS_VOID(rv);
rv = GetMatchedProvider(provider);
NS_ENSURE_SUCCESS_VOID(rv);
- rv = GetMatchedPrefix(prefix);
+ rv = GetMatchedFullHash(fullhash);
NS_ENSURE_SUCCESS_VOID(rv);
- nsChannelClassifier::SetBlockedContent(this, aChannelStatus, list, provider, prefix);
+ nsChannelClassifier::SetBlockedContent(this, aChannelStatus, list, provider, fullhash);
}
MOZ_ASSERT(!mOnStopRequestCalled,
"We should not call OnStopRequest twice");
// In theory mListener should not be null, but in practice sometimes it is.
MOZ_ASSERT(mListener);
if (mListener) {
@@ -1813,27 +1813,27 @@ HttpChannelChild::FlushedForDiversion()
mFlushedForDiversion = true;
SendDivertComplete();
}
void
HttpChannelChild::ProcessSetClassifierMatchedInfo(const nsCString& aList,
const nsCString& aProvider,
- const nsCString& aPrefix)
+ const nsCString& aFullHash)
{
LOG(("HttpChannelChild::ProcessSetClassifierMatchedInfo [this=%p]\n", this));
MOZ_ASSERT(OnSocketThread());
nsCOMPtr<nsIEventTarget> neckoTarget = GetNeckoTarget();
neckoTarget->Dispatch(
NewRunnableMethod<const nsCString, const nsCString, const nsCString>
("HttpChannelChild::SetMatchedInfo",
this, &HttpChannelChild::SetMatchedInfo,
- aList, aProvider, aPrefix),
+ aList, aProvider, aFullHash),
NS_DISPATCH_NORMAL);
}
void
HttpChannelChild::ProcessDivertMessages()
{
LOG(("HttpChannelChild::ProcessDivertMessages [this=%p]\n", this));
MOZ_ASSERT(OnSocketThread());
--- a/netwerk/protocol/http/HttpChannelChild.h
+++ b/netwerk/protocol/http/HttpChannelChild.h
@@ -240,17 +240,17 @@ private:
void ProcessOnProgress(const int64_t& aProgress, const int64_t& aProgressMax);
void ProcessOnStatus(const nsresult& aStatus);
void ProcessFlushedForDiversion();
void ProcessDivertMessages();
void ProcessNotifyTrackingProtectionDisabled();
void ProcessNotifyTrackingResource();
void ProcessSetClassifierMatchedInfo(const nsCString& aList,
const nsCString& aProvider,
- const nsCString& aPrefix);
+ const nsCString& aFullHash);
void DoOnStartRequest(nsIRequest* aRequest, nsISupports* aContext);
void DoOnStatus(nsIRequest* aRequest, nsresult status);
void DoOnProgress(nsIRequest* aRequest, int64_t progress, int64_t progressMax);
void DoOnDataAvailable(nsIRequest* aRequest, nsISupports* aContext, nsIInputStream* aStream,
uint64_t offset, uint32_t count);
void DoPreOnStopRequest(nsresult aStatus);
--- a/netwerk/protocol/http/HttpChannelParent.cpp
+++ b/netwerk/protocol/http/HttpChannelParent.cpp
@@ -1727,22 +1727,22 @@ HttpChannelParent::NotifyTrackingProtect
Unused << mBgParent->OnNotifyTrackingProtectionDisabled();
}
return NS_OK;
}
NS_IMETHODIMP
HttpChannelParent::SetClassifierMatchedInfo(const nsACString& aList,
const nsACString& aProvider,
- const nsACString& aPrefix)
+ const nsACString& aFullHash)
{
LOG(("HttpChannelParent::SetClassifierMatchedInfo [this=%p]\n", this));
if (!mIPCClosed) {
MOZ_ASSERT(mBgParent);
- Unused << mBgParent->OnSetClassifierMatchedInfo(aList, aProvider, aPrefix);
+ Unused << mBgParent->OnSetClassifierMatchedInfo(aList, aProvider, aFullHash);
}
return NS_OK;
}
NS_IMETHODIMP
HttpChannelParent::NotifyTrackingResource()
{
LOG(("HttpChannelParent::NotifyTrackingResource [this=%p]\n", this));
--- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
@@ -1284,19 +1284,19 @@ nsUrlClassifierLookupCallback::HandleRes
LOG(("Confirmed result %s from table %s",
result.PartialHashHex().get(), result.mTableName.get()));
if (tables.IndexOf(result.mTableName) == nsTArray<nsCString>::NoIndex) {
tables.AppendElement(result.mTableName);
}
if (classifyCallback) {
- nsCString prefixString;
- result.hash.fixedLengthPrefix.ToString(prefixString);
- classifyCallback->HandleResult(result.mTableName, prefixString);
+ nsCString fullHashString;
+ result.hash.complete.ToString(fullHashString);
+ classifyCallback->HandleResult(result.mTableName, fullHashString);
}
}
// Some parts of this gethash request generated no hits at all.
// Save the prefixes we checked to prevent repeated requests.
CacheMisses();
if (mCacheResults) {
@@ -1373,17 +1373,17 @@ public:
explicit nsUrlClassifierClassifyCallback(nsIURIClassifierCallback *c)
: mCallback(c)
{}
private:
struct ClassifyMatchedInfo {
nsCString table;
- nsCString prefix;
+ nsCString fullhash;
Provider provider;
nsresult errorCode;
};
~nsUrlClassifierClassifyCallback() {};
nsCOMPtr<nsIURIClassifierCallback> mCallback;
nsTArray<ClassifyMatchedInfo> mMatchedArray;
@@ -1408,37 +1408,37 @@ nsUrlClassifierClassifyCallback::HandleE
(!matchedInfo ||
matchedInfo->provider.priority < mMatchedArray[i].provider.priority)) {
matchedInfo = &mMatchedArray[i];
}
}
}
nsCString provider = matchedInfo ? matchedInfo->provider.name : EmptyCString();
- nsCString prefix = matchedInfo ? matchedInfo->prefix : EmptyCString();
+ nsCString fullhash = matchedInfo ? matchedInfo->fullhash : EmptyCString();
nsCString table = matchedInfo ? matchedInfo->table : EmptyCString();
- mCallback->OnClassifyComplete(response, table, provider, prefix);
+ mCallback->OnClassifyComplete(response, table, provider, fullhash);
return NS_OK;
}
NS_IMETHODIMP
nsUrlClassifierClassifyCallback::HandleResult(const nsACString& aTable,
- const nsACString& aPrefix)
+ const nsACString& aFullHash)
{
- LOG(("nsUrlClassifierClassifyCallback::HandleResult [%p, table %s prefix %s]",
- this, PromiseFlatCString(aTable).get(), PromiseFlatCString(aPrefix).get()));
+ LOG(("nsUrlClassifierClassifyCallback::HandleResult [%p, table %s full hash %s]",
+ this, PromiseFlatCString(aTable).get(), PromiseFlatCString(aFullHash).get()));
- if (NS_WARN_IF(aTable.IsEmpty()) || NS_WARN_IF(aPrefix.IsEmpty())) {
+ if (NS_WARN_IF(aTable.IsEmpty()) || NS_WARN_IF(aFullHash.IsEmpty())) {
return NS_ERROR_INVALID_ARG;
}
ClassifyMatchedInfo* matchedInfo = mMatchedArray.AppendElement();
matchedInfo->table = aTable;
- matchedInfo->prefix = aPrefix;
+ matchedInfo->fullhash = aFullHash;
nsCOMPtr<nsIUrlClassifierUtils> urlUtil =
do_GetService(NS_URLCLASSIFIERUTILS_CONTRACTID);
nsCString provider;
nsresult rv = urlUtil->GetProvider(aTable, provider);
matchedInfo->provider.name = NS_SUCCEEDED(rv) ? provider : EmptyCString();
--- a/toolkit/components/url-classifier/tests/mochitest/test_classifier_match.html
+++ b/toolkit/components/url-classifier/tests/mochitest/test_classifier_match.html
@@ -43,73 +43,73 @@ var inputDatas = [
provider: "google"
},
{ url: "malware3.example.com/",
db: "mochim3-malware-simple",
provider: "mozilla"
},
];
-function hashPrefix(str) {
+function hash(str) {
function bytesFromString(str1) {
let converter =
Cc["@mozilla.org/intl/scriptableunicodeconverter"]
.createInstance(Ci.nsIScriptableUnicodeConverter);
converter.charset = "UTF-8";
return converter.convertToByteArray(str1);
}
let hasher = Cc["@mozilla.org/security/hash;1"]
.createInstance(Ci.nsICryptoHash);
let data = bytesFromString(str);
hasher.init(hasher.SHA256);
hasher.update(data, data.length);
- return hasher.finish(false).slice(0, 4);
+ return hasher.finish(false);
}
var testDatas = [
// Match empty provider
{ url: "http://malware.example.com",
expect: { error: Cr.NS_ERROR_BLOCKED_URI,
table: "mochi-block-simple",
provider: "",
- prefix: (function() {
- return hashPrefix("malware.example.com/");
+ fullhash: (function() {
+ return hash("malware.example.com/");
})(),
}
},
// Match multiple tables, only one has valid provider
{ url: "http://malware1.example.com",
expect: { error: Cr.NS_ERROR_MALWARE_URI,
table: "mochi1-malware-simple",
provider: "mozilla",
- prefix: (function() {
- return hashPrefix("malware1.example.com/");
+ fullhash: (function() {
+ return hash("malware1.example.com/");
})(),
}
},
// Match multiple tables, handle order
{ url: "http://malware2.example.com",
expect: { error: Cr.NS_ERROR_MALWARE_URI,
table: "mochi2-malware-simple",
provider: "mozilla",
- prefix: (function() {
- return hashPrefix("malware2.example.com/");
+ fullhash: (function() {
+ return hash("malware2.example.com/");
})(),
}
},
// Match multiple tables, handle order
{ url: "http://malware3.example.com",
expect: { error: Cr.NS_ERROR_MALWARE_URI,
table: "mochig3-malware-simple",
provider: "google",
- prefix: (function() {
- return hashPrefix("malware3.example.com/");
+ fullhash: (function() {
+ return hash("malware3.example.com/");
})(),
}
},
];
SimpleTest.waitForExplicitFinish();
@@ -154,21 +154,21 @@ function runTest() {
function runNextTest() {
if (!testDatas.length) {
resolve();
return;
}
let test = testDatas.shift();
let uri = ios.newURI(test.url);
let prin = ssm.createCodebasePrincipal(uri, {});
- SpecialPowers.doUrlClassify(prin, null, false, function(errorCode, table, provider, prefix) {
+ SpecialPowers.doUrlClassify(prin, null, false, function(errorCode, table, provider, fullhash) {
is(errorCode, test.expect.error, `Test url ${test.url} correct error`);
is(table, test.expect.table, `Test url ${test.url} correct table`);
is(provider, test.expect.provider, `Test url ${test.url} correct provider`);
- is(prefix, btoa(test.expect.prefix), `Test url ${test.url} correct prefix`);
+ is(fullhash, btoa(test.expect.fullhash), `Test url ${test.url} correct full hash`);
runNextTest();
});
}
runNextTest();
});
}
SpecialPowers.pushPrefEnv(
--- a/uriloader/exthandler/nsExternalProtocolHandler.cpp
+++ b/uriloader/exthandler/nsExternalProtocolHandler.cpp
@@ -418,17 +418,17 @@ NS_IMETHODIMP nsExtProtocolChannel::SetP
NS_IMETHODIMP nsExtProtocolChannel::NotifyTrackingProtectionDisabled()
{
// nothing to do
return NS_OK;
}
NS_IMETHODIMP nsExtProtocolChannel::SetClassifierMatchedInfo(const nsACString& aList,
const nsACString& aProvider,
- const nsACString& aPrefix)
+ const nsACString& aFullHash)
{
// nothing to do
return NS_OK;
}
NS_IMETHODIMP nsExtProtocolChannel::NotifyTrackingResource()
{
// nothing to do