Bug 1462432 - Part 1: Add an API to override the tracking status on an HTTP channel; r=mayhemer

This commit is contained in:
Ehsan Akhgari 2018-06-12 15:30:14 -04:00
Родитель d6e2c6a0f3
Коммит f4e3e1d715
5 изменённых файлов: 35 добавлений и 0 удалений

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

@ -1546,6 +1546,17 @@ HttpBaseChannel::GetIsTrackingResource(bool* aIsTrackingResource)
return NS_OK;
}
NS_IMETHODIMP
HttpBaseChannel::OverrideTrackingResource(bool aIsTracking)
{
LOG(("HttpBaseChannel::OverrideTrackingResource(%d) %p "
"mIsTrackingResource=%d",
(int) aIsTracking, this, (int) mIsTrackingResource));
mIsTrackingResource = aIsTracking;
return NS_OK;
}
NS_IMETHODIMP
HttpBaseChannel::GetTransferSize(uint64_t *aTransferSize)
{

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

@ -211,6 +211,7 @@ public:
NS_IMETHOD GetTopLevelOuterContentWindowId(uint64_t *aWindowId) override;
NS_IMETHOD SetTopLevelOuterContentWindowId(uint64_t aWindowId) override;
NS_IMETHOD GetIsTrackingResource(bool* aIsTrackingResource) override;
NS_IMETHOD OverrideTrackingResource(bool aIsTracking) override;
// nsIHttpChannelInternal
NS_IMETHOD GetDocumentURI(nsIURI **aDocumentURI) override;

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

@ -99,6 +99,12 @@ NullHttpChannel::GetIsTrackingResource(bool* aIsTrackingResource)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
NullHttpChannel::OverrideTrackingResource(bool aIsTracking)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
NullHttpChannel::GetTransferSize(uint64_t *aTransferSize)
{

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

@ -482,6 +482,16 @@ interface nsIHttpChannel : nsIChannel
*/
[infallible] readonly attribute boolean isTrackingResource;
/**
* This method is used in order to override the tracking status of an HTTP
* channel. This should only be called by Gecko under certain circumstances
* when Gecko can guarantee that the channel classifier service will not be
* determining the tracking status of the channel.
*
* Please avoid calling this API if you're unsure whether you should be using it.
*/
[noscript] void overrideTrackingResource(in boolean aIsTracking);
/**
* ID of the top-level outer content window. Identifies this channel's
* top-level window it comes from.

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

@ -836,6 +836,13 @@ nsViewSourceChannel::GetIsTrackingResource(bool* aIsTrackingResource)
mHttpChannel->GetIsTrackingResource(aIsTrackingResource);
}
NS_IMETHODIMP
nsViewSourceChannel::OverrideTrackingResource(bool aIsTracking)
{
return !mHttpChannel ? NS_ERROR_NULL_POINTER :
mHttpChannel->OverrideTrackingResource(aIsTracking);
}
NS_IMETHODIMP
nsViewSourceChannel::GetRequestMethod(nsACString & aRequestMethod)
{