зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1539819 - P4: Some adjustments to pass trr test r=dragana,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D68881
This commit is contained in:
Родитель
5732714230
Коммит
f576a6f9bf
|
@ -359,11 +359,15 @@ ChildDNSService::GetDNSCacheEntries(
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
ChildDNSService::ClearCache(bool aTrrToo) { return NS_ERROR_NOT_AVAILABLE; }
|
ChildDNSService::ClearCache(bool aTrrToo) {
|
||||||
|
Unused << mTRRServiceParent->SendClearDNSCache(aTrrToo);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
ChildDNSService::ReloadParentalControlEnabled() {
|
ChildDNSService::ReloadParentalControlEnabled() {
|
||||||
return NS_ERROR_NOT_AVAILABLE;
|
mTRRServiceParent->UpdateParentalControlEnabled();
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|
|
@ -50,6 +50,8 @@ class ChildDNSRecord : public nsIDNSRecord {
|
||||||
nsTArray<NetAddr> mAddresses;
|
nsTArray<NetAddr> mAddresses;
|
||||||
uint32_t mCurrent; // addr iterator
|
uint32_t mCurrent; // addr iterator
|
||||||
uint16_t mFlags;
|
uint16_t mFlags;
|
||||||
|
double mTrrFetchDuration;
|
||||||
|
double mTrrFetchDurationNetworkOnly;
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS(ChildDNSRecord, nsIDNSRecord)
|
NS_IMPL_ISUPPORTS(ChildDNSRecord, nsIDNSRecord)
|
||||||
|
@ -57,6 +59,8 @@ NS_IMPL_ISUPPORTS(ChildDNSRecord, nsIDNSRecord)
|
||||||
ChildDNSRecord::ChildDNSRecord(const DNSRecord& reply, uint16_t flags)
|
ChildDNSRecord::ChildDNSRecord(const DNSRecord& reply, uint16_t flags)
|
||||||
: mCurrent(0), mFlags(flags) {
|
: mCurrent(0), mFlags(flags) {
|
||||||
mCanonicalName = reply.canonicalName();
|
mCanonicalName = reply.canonicalName();
|
||||||
|
mTrrFetchDuration = reply.trrFetchDuration();
|
||||||
|
mTrrFetchDurationNetworkOnly = reply.trrFetchDurationNetworkOnly();
|
||||||
|
|
||||||
// A shame IPDL gives us no way to grab ownership of array: so copy it.
|
// A shame IPDL gives us no way to grab ownership of array: so copy it.
|
||||||
const nsTArray<NetAddr>& addrs = reply.addrs();
|
const nsTArray<NetAddr>& addrs = reply.addrs();
|
||||||
|
@ -85,14 +89,14 @@ ChildDNSRecord::IsTRR(bool* retval) {
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
ChildDNSRecord::GetTrrFetchDuration(double* aTime) {
|
ChildDNSRecord::GetTrrFetchDuration(double* aTime) {
|
||||||
*aTime = 0;
|
*aTime = mTrrFetchDuration;
|
||||||
return NS_ERROR_NOT_AVAILABLE;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
ChildDNSRecord::GetTrrFetchDurationNetworkOnly(double* aTime) {
|
ChildDNSRecord::GetTrrFetchDurationNetworkOnly(double* aTime) {
|
||||||
*aTime = 0;
|
*aTime = mTrrFetchDurationNetworkOnly;
|
||||||
return NS_ERROR_NOT_AVAILABLE;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|
|
@ -125,8 +125,15 @@ DNSRequestHandler::OnLookupComplete(nsICancelable* request, nsIDNSRecord* rec,
|
||||||
array.AppendElement(addr);
|
array.AppendElement(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
SendLookupCompletedHelper(mIPCActor,
|
double trrFetchDuration;
|
||||||
DNSRequestResponse(DNSRecord(cname, array)));
|
rec->GetTrrFetchDuration(&trrFetchDuration);
|
||||||
|
|
||||||
|
double trrFetchDurationNetworkOnly;
|
||||||
|
rec->GetTrrFetchDurationNetworkOnly(&trrFetchDurationNetworkOnly);
|
||||||
|
|
||||||
|
SendLookupCompletedHelper(
|
||||||
|
mIPCActor, DNSRequestResponse(DNSRecord(cname, array, trrFetchDuration,
|
||||||
|
trrFetchDurationNetworkOnly)));
|
||||||
} else {
|
} else {
|
||||||
SendLookupCompletedHelper(mIPCActor, DNSRequestResponse(status));
|
SendLookupCompletedHelper(mIPCActor, DNSRequestResponse(status));
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@ struct DNSRecord
|
||||||
{
|
{
|
||||||
nsCString canonicalName;
|
nsCString canonicalName;
|
||||||
NetAddr[] addrs;
|
NetAddr[] addrs;
|
||||||
|
double trrFetchDuration;
|
||||||
|
double trrFetchDurationNetworkOnly;
|
||||||
};
|
};
|
||||||
|
|
||||||
union DNSRequestResponse
|
union DNSRequestResponse
|
||||||
|
|
|
@ -21,7 +21,8 @@ child:
|
||||||
async UpdatePlatformDNSInformation(nsCString[] aSuffixList,
|
async UpdatePlatformDNSInformation(nsCString[] aSuffixList,
|
||||||
bool aPlatformDisabledTRR);
|
bool aPlatformDisabledTRR);
|
||||||
async InitTRRBLStorage(DataStorageEntry aEntry, FileDescriptor aWriteFd);
|
async InitTRRBLStorage(DataStorageEntry aEntry, FileDescriptor aWriteFd);
|
||||||
|
async UpdateParentalControlEnabled(bool aEnabled);
|
||||||
|
async ClearDNSCache(bool aTrrToo);
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace net
|
} //namespace net
|
||||||
|
|
|
@ -58,5 +58,17 @@ mozilla::ipc::IPCResult TRRServiceChild::RecvInitTRRBLStorage(
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mozilla::ipc::IPCResult TRRServiceChild::RecvUpdateParentalControlEnabled(
|
||||||
|
const bool& aEnabled) {
|
||||||
|
gTRRService->mParentalControlEnabled = aEnabled;
|
||||||
|
return IPC_OK();
|
||||||
|
}
|
||||||
|
|
||||||
|
mozilla::ipc::IPCResult TRRServiceChild::RecvClearDNSCache(
|
||||||
|
const bool& aTrrToo) {
|
||||||
|
Unused << sDNSService->ClearCache(aTrrToo);
|
||||||
|
return IPC_OK();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace net
|
} // namespace net
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -31,6 +31,9 @@ class TRRServiceChild : public PTRRServiceChild {
|
||||||
nsTArray<nsCString>&& aDNSSuffixList, const bool& aPlatformDisabledTRR);
|
nsTArray<nsCString>&& aDNSSuffixList, const bool& aPlatformDisabledTRR);
|
||||||
mozilla::ipc::IPCResult RecvInitTRRBLStorage(
|
mozilla::ipc::IPCResult RecvInitTRRBLStorage(
|
||||||
const psm::DataStorageEntry& aEntry, const FileDescriptor& aWriteFd);
|
const psm::DataStorageEntry& aEntry, const FileDescriptor& aWriteFd);
|
||||||
|
mozilla::ipc::IPCResult RecvUpdateParentalControlEnabled(
|
||||||
|
const bool& aEnabled);
|
||||||
|
mozilla::ipc::IPCResult RecvClearDNSCache(const bool& aTrrToo);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual ~TRRServiceChild() = default;
|
virtual ~TRRServiceChild() = default;
|
||||||
|
|
|
@ -117,5 +117,10 @@ TRRServiceParent::Observe(nsISupports* aSubject, const char* aTopic,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TRRServiceParent::UpdateParentalControlEnabled() {
|
||||||
|
bool enabled = TRRService::GetParentalControlEnabledInternal();
|
||||||
|
Unused << SendUpdateParentalControlEnabled(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace net
|
} // namespace net
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -24,6 +24,7 @@ class TRRServiceParent : public nsIObserver,
|
||||||
|
|
||||||
explicit TRRServiceParent() : mTRRBLStorageInited(false) {}
|
explicit TRRServiceParent() : mTRRBLStorageInited(false) {}
|
||||||
void Init();
|
void Init();
|
||||||
|
void UpdateParentalControlEnabled();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual ~TRRServiceParent() = default;
|
virtual ~TRRServiceParent() = default;
|
||||||
|
|
|
@ -1350,7 +1350,8 @@ nsDNSService::ClearCache(bool aTrrToo) {
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDNSService::ReloadParentalControlEnabled() {
|
nsDNSService::ReloadParentalControlEnabled() {
|
||||||
if (mTrrService) {
|
if (mTrrService) {
|
||||||
mTrrService->GetParentalControlEnabledInternal();
|
mTrrService->mParentalControlEnabled =
|
||||||
|
TRRService::GetParentalControlEnabledInternal();
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1462,13 +1462,15 @@ add_task(async function test_async_resolve_with_trr_server_5() {
|
||||||
dns.clearCache(true);
|
dns.clearCache(true);
|
||||||
Services.prefs.setIntPref("network.trr.mode", 5); // TRR-user-disabled
|
Services.prefs.setIntPref("network.trr.mode", 5); // TRR-user-disabled
|
||||||
|
|
||||||
|
// When dns is resolved in socket process, we can't set |expectEarlyFail| to true.
|
||||||
|
let inSocketProcess = mozinfo.socketprocess_networking;
|
||||||
let [_] = await new DNSListener(
|
let [_] = await new DNSListener(
|
||||||
"bar_with_trr3.example.com",
|
"bar_with_trr3.example.com",
|
||||||
undefined,
|
undefined,
|
||||||
false,
|
false,
|
||||||
undefined,
|
undefined,
|
||||||
`https://foo.example.com:${h2Port}/doh?responseIP=3.3.3.3`,
|
`https://foo.example.com:${h2Port}/doh?responseIP=3.3.3.3`,
|
||||||
true
|
!inSocketProcess
|
||||||
);
|
);
|
||||||
|
|
||||||
// Call normal AsyncOpen, it will return result from the native resolver.
|
// Call normal AsyncOpen, it will return result from the native resolver.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче