Bug 1588899 - P2. Make HTTP classification flags available to DocumentChannelChild, since we use them to determine which content blocking events to fire. r=baku,Ehsan

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jean-Yves Avenard 2019-10-19 07:04:15 +00:00
Родитель e6d0e7dfda
Коммит 77c7d32b08
4 изменённых файлов: 17 добавлений и 6 удалений

Просмотреть файл

@ -427,6 +427,12 @@ IPCResult DocumentChannelChild::RecvConfirmRedirect(
return IPC_OK();
}
IPCResult DocumentChannelChild::RecvNotifyClassificationFlags(
const uint32_t& aClassificationFlags) {
mThirdPartyClassificationFlags |= aClassificationFlags;
return IPC_OK();
}
IPCResult DocumentChannelChild::RecvNotifyChannelClassifierProtectionDisabled(
const uint32_t& aAcceptedReason) {
UrlClassifierCommon::NotifyChannelClassifierProtectionDisabled(
@ -569,34 +575,31 @@ DocumentChannelChild::Resume() {
NS_IMETHODIMP
DocumentChannelChild::IsTrackingResource(bool* aIsTrackingResource) {
// TODO
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
DocumentChannelChild::IsThirdPartyTrackingResource(bool* aIsTrackingResource) {
// TODO
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
DocumentChannelChild::GetClassificationFlags(uint32_t* aClassificationFlags) {
// TODO
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
DocumentChannelChild::GetFirstPartyClassificationFlags(
uint32_t* aClassificationFlags) {
// TODO
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
DocumentChannelChild::GetThirdPartyClassificationFlags(
uint32_t* aClassificationFlags) {
// TODO
return NS_ERROR_NOT_IMPLEMENTED;
MOZ_ASSERT(aClassificationFlags);
*aClassificationFlags = mThirdPartyClassificationFlags;
return NS_OK;
}
} // namespace net

Просмотреть файл

@ -69,6 +69,8 @@ class DocumentChannelChild final : public PDocumentChannelChild,
const Maybe<nsString>& aContentDispositionFilename,
RedirectToRealChannelResolver&& aResolve);
mozilla::ipc::IPCResult RecvNotifyClassificationFlags(
const uint32_t& aClassificationFlags);
mozilla::ipc::IPCResult RecvNotifyChannelClassifierProtectionDisabled(
const uint32_t& aAcceptedReason);
mozilla::ipc::IPCResult RecvNotifyCookieAllowed();
@ -103,6 +105,7 @@ class DocumentChannelChild final : public PDocumentChannelChild,
nsTArray<DocumentChannelRedirect> mRedirects;
// Classified channel's matched information
uint32_t mThirdPartyClassificationFlags = 0;
nsCString mMatchedList;
nsCString mMatchedProvider;
nsCString mMatchedFullHash;

Просмотреть файл

@ -765,6 +765,10 @@ DocumentChannelParent::SetClassifierMatchedTrackingInfo(
NS_IMETHODIMP
DocumentChannelParent::NotifyClassificationFlags(uint32_t aClassificationFlags,
bool aIsThirdParty) {
if (aIsThirdParty && CanSend()) {
Unused << SendNotifyClassificationFlags(aClassificationFlags);
}
mIParentChannelFunctions.AppendElement(IParentChannelFunction{
VariantIndex<3>{},
ClassificationFlagsParams{aClassificationFlags, aIsThirdParty}});

Просмотреть файл

@ -50,6 +50,7 @@ child:
// AsyncOpen of nsHttpChannel on the parent.
async FailedAsyncOpen(nsresult status);
async NotifyClassificationFlags(uint32_t classificationFlags);
async NotifyChannelClassifierProtectionDisabled(uint32_t acceptedReason);
async NotifyCookieAllowed();
async NotifyCookieBlocked(uint32_t rejectedReason);