зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1552176 - Pass TRRMode to nsDNSPrefetch r=dragana
Differential Revision: https://phabricator.services.mozilla.com/D49158 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
005744f167
Коммит
010c262075
|
@ -33,15 +33,17 @@ nsresult nsDNSPrefetch::Shutdown() {
|
|||
|
||||
nsDNSPrefetch::nsDNSPrefetch(nsIURI* aURI,
|
||||
mozilla::OriginAttributes& aOriginAttributes,
|
||||
nsIRequest::TRRMode aTRRMode,
|
||||
nsIDNSListener* aListener, bool storeTiming)
|
||||
: mOriginAttributes(aOriginAttributes),
|
||||
mStoreTiming(storeTiming),
|
||||
mTRRMode(aTRRMode),
|
||||
mListener(do_GetWeakReference(aListener)) {
|
||||
aURI->GetAsciiHost(mHostname);
|
||||
mIsHttps = aURI->SchemeIs("https");
|
||||
}
|
||||
|
||||
nsresult nsDNSPrefetch::Prefetch(uint16_t flags) {
|
||||
nsresult nsDNSPrefetch::Prefetch(uint32_t flags) {
|
||||
// This can work properly only if this call is on the main thread.
|
||||
// Curenlty we use nsDNSPrefetch only in nsHttpChannel which will call
|
||||
// PrefetchHigh() from the main thread. Let's add assertion to catch
|
||||
|
@ -61,6 +63,8 @@ nsresult nsDNSPrefetch::Prefetch(uint16_t flags) {
|
|||
// TimingsValid() before using the timing.
|
||||
nsCOMPtr<nsIEventTarget> main = mozilla::GetMainThreadEventTarget();
|
||||
|
||||
flags |= nsIDNSService::GetFlagsFromTRRMode(mTRRMode);
|
||||
|
||||
nsresult rv = sDNSService->AsyncResolveNative(
|
||||
mHostname, flags | nsIDNSService::RESOLVE_SPECULATE, this, main,
|
||||
mOriginAttributes, getter_AddRefs(tmpOutstanding));
|
||||
|
|
|
@ -25,7 +25,8 @@ class nsDNSPrefetch final : public nsIDNSListener {
|
|||
NS_DECL_NSIDNSLISTENER
|
||||
|
||||
nsDNSPrefetch(nsIURI* aURI, mozilla::OriginAttributes& aOriginAttributes,
|
||||
nsIDNSListener* aListener, bool storeTiming);
|
||||
nsIRequest::TRRMode aTRRMode, nsIDNSListener* aListener,
|
||||
bool storeTiming);
|
||||
bool TimingsValid() const {
|
||||
return !mStartTimestamp.IsNull() && !mEndTimestamp.IsNull();
|
||||
}
|
||||
|
@ -46,11 +47,12 @@ class nsDNSPrefetch final : public nsIDNSListener {
|
|||
bool mIsHttps;
|
||||
mozilla::OriginAttributes mOriginAttributes;
|
||||
bool mStoreTiming;
|
||||
nsIRequest::TRRMode mTRRMode;
|
||||
mozilla::TimeStamp mStartTimestamp;
|
||||
mozilla::TimeStamp mEndTimestamp;
|
||||
nsWeakPtr mListener;
|
||||
|
||||
nsresult Prefetch(uint16_t flags);
|
||||
nsresult Prefetch(uint32_t flags);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -6839,8 +6839,8 @@ void nsHttpChannel::MaybeStartDNSPrefetch() {
|
|||
mCaps & NS_HTTP_REFRESH_DNS ? ", refresh requested" : ""));
|
||||
OriginAttributes originAttributes;
|
||||
NS_GetOriginAttributes(this, originAttributes);
|
||||
mDNSPrefetch =
|
||||
new nsDNSPrefetch(mURI, originAttributes, this, mTimingEnabled);
|
||||
mDNSPrefetch = new nsDNSPrefetch(
|
||||
mURI, originAttributes, nsIRequest::GetTRRMode(), this, mTimingEnabled);
|
||||
mDNSPrefetch->PrefetchHigh(mCaps & NS_HTTP_REFRESH_DNS);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче