зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1525640 - Add nsIHttpChannelInternal.isResolvedByTRR r=dragana
Differential Revision: https://phabricator.services.mozilla.com/D26884 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
f96dbbf019
Коммит
50b2b648b6
|
@ -182,6 +182,10 @@ class FakeSocketTransportProvider : public nsISocketTransport {
|
|||
MOZ_ASSERT(false);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD ResolvedByTRR(bool* _retval) override {
|
||||
MOZ_ASSERT(false);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsITransport
|
||||
NS_IMETHOD OpenInputStream(uint32_t aFlags, uint32_t aSegmentSize,
|
||||
|
|
|
@ -485,6 +485,11 @@ ClassifierDummyChannel::SetIsTRRServiceChannel(bool aTrr) {
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ClassifierDummyChannel::GetIsResolvedByTRR(bool* aResolvedByTRR) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ClassifierDummyChannel::GetTlsFlags(uint32_t* aTlsFlags) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
|
|
@ -199,6 +199,7 @@ HttpBaseChannel::HttpBaseChannel()
|
|||
mAllowAltSvc(true),
|
||||
mBeConservative(false),
|
||||
mIsTRRServiceChannel(false),
|
||||
mResolvedByTRR(false),
|
||||
mResponseTimeoutEnabled(true),
|
||||
mAllRedirectsSameOrigin(true),
|
||||
mAllRedirectsPassTimingAllowCheck(true),
|
||||
|
@ -2413,6 +2414,13 @@ HttpBaseChannel::SetIsTRRServiceChannel(bool aIsTRRServiceChannel) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HttpBaseChannel::GetIsResolvedByTRR(bool* aResolvedByTRR) {
|
||||
NS_ENSURE_ARG_POINTER(aResolvedByTRR);
|
||||
*aResolvedByTRR = mResolvedByTRR;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HttpBaseChannel::GetTlsFlags(uint32_t* aTlsFlags) {
|
||||
NS_ENSURE_ARG_POINTER(aTlsFlags);
|
||||
|
|
|
@ -276,6 +276,7 @@ class HttpBaseChannel : public nsHashPropertyBag,
|
|||
NS_IMETHOD SetBeConservative(bool aBeConservative) override;
|
||||
NS_IMETHOD GetIsTRRServiceChannel(bool* aTRR) override;
|
||||
NS_IMETHOD SetIsTRRServiceChannel(bool aTRR) override;
|
||||
NS_IMETHOD GetIsResolvedByTRR(bool* aResolvedByTRR) override;
|
||||
NS_IMETHOD GetTlsFlags(uint32_t* aTlsFlags) override;
|
||||
NS_IMETHOD SetTlsFlags(uint32_t aTlsFlags) override;
|
||||
NS_IMETHOD GetApiRedirectToURI(nsIURI** aApiRedirectToURI) override;
|
||||
|
@ -693,7 +694,12 @@ class HttpBaseChannel : public nsHashPropertyBag,
|
|||
// classification. If this is changed or removed, make sure we also update
|
||||
// NS_ShouldClassifyChannel accordingly !!!
|
||||
uint32_t mBeConservative : 1;
|
||||
// If the current channel is used to as a TRR connection.
|
||||
uint32_t mIsTRRServiceChannel : 1;
|
||||
// If the request was performed to a TRR resolved IP address.
|
||||
// Will be false if loading the resource does not create a connection
|
||||
// (for example when it's loaded from the cache).
|
||||
uint32_t mResolvedByTRR : 1;
|
||||
uint32_t mResponseTimeoutEnabled : 1;
|
||||
// A flag that should be false only if a cross-domain redirect occurred
|
||||
uint32_t mAllRedirectsSameOrigin : 1;
|
||||
|
|
|
@ -408,7 +408,7 @@ class StartRequestEvent : public NeckoTargetChannelEvent<HttpChannelChild> {
|
|||
const NetAddr& aPeerAddr, const uint32_t& aCacheKey,
|
||||
const nsCString& altDataType, const int64_t& altDataLen,
|
||||
const bool& deliveringAltData, const bool& aApplyConversion,
|
||||
const ResourceTimingStruct& aTiming)
|
||||
const bool& aIsResolvedByTRR, const ResourceTimingStruct& aTiming)
|
||||
: NeckoTargetChannelEvent<HttpChannelChild>(aChild),
|
||||
mChannelStatus(aChannelStatus),
|
||||
mResponseHead(aResponseHead),
|
||||
|
@ -430,6 +430,7 @@ class StartRequestEvent : public NeckoTargetChannelEvent<HttpChannelChild> {
|
|||
mAltDataLen(altDataLen),
|
||||
mDeliveringAltData(deliveringAltData),
|
||||
mLoadInfoForwarder(loadInfoForwarder),
|
||||
mIsResolvedByTRR(aIsResolvedByTRR),
|
||||
mTiming(aTiming) {}
|
||||
|
||||
void Run() override {
|
||||
|
@ -440,7 +441,7 @@ class StartRequestEvent : public NeckoTargetChannelEvent<HttpChannelChild> {
|
|||
mCacheEntryId, mCacheFetchCount, mCacheExpirationTime, mCachedCharset,
|
||||
mSecurityInfoSerialization, mSelfAddr, mPeerAddr, mCacheKey,
|
||||
mAltDataType, mAltDataLen, mDeliveringAltData, mApplyConversion,
|
||||
mTiming);
|
||||
mIsResolvedByTRR, mTiming);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -464,6 +465,7 @@ class StartRequestEvent : public NeckoTargetChannelEvent<HttpChannelChild> {
|
|||
int64_t mAltDataLen;
|
||||
bool mDeliveringAltData;
|
||||
ParentLoadInfoForwarderArgs mLoadInfoForwarder;
|
||||
bool mIsResolvedByTRR;
|
||||
ResourceTimingStruct mTiming;
|
||||
};
|
||||
|
||||
|
@ -479,7 +481,7 @@ mozilla::ipc::IPCResult HttpChannelChild::RecvOnStartRequest(
|
|||
const int16_t& redirectCount, const uint32_t& cacheKey,
|
||||
const nsCString& altDataType, const int64_t& altDataLen,
|
||||
const bool& deliveringAltData, const bool& aApplyConversion,
|
||||
const ResourceTimingStruct& aTiming) {
|
||||
const bool& aIsResolvedByTRR, const ResourceTimingStruct& aTiming) {
|
||||
AUTO_PROFILER_LABEL("HttpChannelChild::RecvOnStartRequest", NETWORK);
|
||||
LOG(("HttpChannelChild::RecvOnStartRequest [this=%p]\n", this));
|
||||
// mFlushedForDiversion and mDivertingToParent should NEVER be set at this
|
||||
|
@ -498,7 +500,8 @@ mozilla::ipc::IPCResult HttpChannelChild::RecvOnStartRequest(
|
|||
loadInfoForwarder, isFromCache, isRacing, cacheEntryAvailable,
|
||||
cacheEntryId, cacheFetchCount, cacheExpirationTime, cachedCharset,
|
||||
securityInfoSerialization, selfAddr, peerAddr, cacheKey, altDataType,
|
||||
altDataLen, deliveringAltData, aApplyConversion, aTiming));
|
||||
altDataLen, deliveringAltData, aApplyConversion, aIsResolvedByTRR,
|
||||
aTiming));
|
||||
|
||||
{
|
||||
// Child's mEventQ is to control the execution order of the IPC messages
|
||||
|
@ -532,7 +535,7 @@ void HttpChannelChild::OnStartRequest(
|
|||
const NetAddr& selfAddr, const NetAddr& peerAddr, const uint32_t& cacheKey,
|
||||
const nsCString& altDataType, const int64_t& altDataLen,
|
||||
const bool& deliveringAltData, const bool& aApplyConversion,
|
||||
const ResourceTimingStruct& aTiming) {
|
||||
const bool& aIsResolvedByTRR, const ResourceTimingStruct& aTiming) {
|
||||
LOG(("HttpChannelChild::OnStartRequest [this=%p]\n", this));
|
||||
|
||||
// mFlushedForDiversion and mDivertingToParent should NEVER be set at this
|
||||
|
@ -586,6 +589,7 @@ void HttpChannelChild::OnStartRequest(
|
|||
mAvailableCachedAltDataType = altDataType;
|
||||
mDeliveringAltData = deliveringAltData;
|
||||
mAltDataLength = altDataLen;
|
||||
mResolvedByTRR = aIsResolvedByTRR;
|
||||
|
||||
SetApplyConversion(aApplyConversion);
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ class HttpChannelChild final : public PHttpChannelChild,
|
|||
const NetAddr& peerAddr, const int16_t& redirectCount,
|
||||
const uint32_t& cacheKey, const nsCString& altDataType,
|
||||
const int64_t& altDataLen, const bool& deliveringAltData,
|
||||
const bool& aApplyConversion,
|
||||
const bool& aApplyConversion, const bool& aIsResolvedByTRR,
|
||||
const ResourceTimingStruct& aTiming) override;
|
||||
mozilla::ipc::IPCResult RecvFailedAsyncOpen(const nsresult& status) override;
|
||||
mozilla::ipc::IPCResult RecvRedirect1Begin(
|
||||
|
@ -479,7 +479,7 @@ class HttpChannelChild final : public PHttpChannelChild,
|
|||
const NetAddr& peerAddr, const uint32_t& cacheKey,
|
||||
const nsCString& altDataType, const int64_t& altDataLen,
|
||||
const bool& deliveringAltData, const bool& aApplyConversion,
|
||||
const ResourceTimingStruct& aTiming);
|
||||
const bool& aIsResolvedByTRR, const ResourceTimingStruct& aTiming);
|
||||
void MaybeDivertOnData(const nsCString& data, const uint64_t& offset,
|
||||
const uint32_t& count);
|
||||
void OnTransportAndData(const nsresult& channelStatus, const nsresult& status,
|
||||
|
|
|
@ -1464,6 +1464,9 @@ HttpChannelParent::OnStartRequest(nsIRequest* aRequest) {
|
|||
ResourceTimingStruct timing;
|
||||
GetTimingAttributes(mChannel, timing);
|
||||
|
||||
bool isResolvedByTRR = false;
|
||||
chan->GetIsResolvedByTRR(&isResolvedByTRR);
|
||||
|
||||
rv = NS_OK;
|
||||
if (mIPCClosed ||
|
||||
!SendOnStartRequest(
|
||||
|
@ -1473,7 +1476,7 @@ HttpChannelParent::OnStartRequest(nsIRequest* aRequest) {
|
|||
mCacheEntry ? true : false, cacheEntryId, fetchCount, expirationTime,
|
||||
cachedCharset, secInfoSerialization, chan->GetSelfAddr(),
|
||||
chan->GetPeerAddr(), redirectCount, cacheKey, altDataType, altDataLen,
|
||||
deliveringAltData, applyConversion, timing)) {
|
||||
deliveringAltData, applyConversion, isResolvedByTRR, timing)) {
|
||||
rv = NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
requestHead->Exit();
|
||||
|
|
|
@ -128,6 +128,7 @@ child:
|
|||
int64_t altDataLength,
|
||||
bool deliveringAltData,
|
||||
bool applyConversion,
|
||||
bool isResolvedByTRR,
|
||||
ResourceTimingStruct timing);
|
||||
|
||||
// Used to cancel child channel if we hit errors during creating and
|
||||
|
|
|
@ -722,10 +722,6 @@ class nsHttpChannel final : public HttpBaseChannel,
|
|||
// Used to suspend any newly created pumps in mCallOnResume handler.
|
||||
uint32_t mAsyncResumePending : 1;
|
||||
|
||||
// If the request was performed to a TRR resolved IP address.
|
||||
// Will be false if loaded from the cache.
|
||||
uint32_t mResolvedByTRR : 1;
|
||||
|
||||
// True only when we have checked whether this channel has been isolated for
|
||||
// anti-tracking purposes.
|
||||
uint32_t mHasBeenIsolatedChecked : 1;
|
||||
|
|
|
@ -245,6 +245,13 @@ interface nsIHttpChannelInternal : nsISupports
|
|||
*/
|
||||
[noscript, must_use] attribute boolean isTRRServiceChannel;
|
||||
|
||||
/**
|
||||
* If the channel's remote IP was resolved using TRR.
|
||||
* Is false for resources loaded from the cache or resources that have an
|
||||
* IP literal host.
|
||||
*/
|
||||
[noscript, must_use] readonly attribute boolean isResolvedByTRR;
|
||||
|
||||
/**
|
||||
* An opaque flags for non-standard behavior of the TLS system.
|
||||
* It is unlikely this will need to be set outside of telemetry studies
|
||||
|
|
Загрузка…
Ссылка в новой задаче