Skip to content

Commit 56b22ee

Browse files
author
Marian-Vasile Laza
committed
Backed out 9 changesets (bug 1596845) for causing xpcshell failures on test_trr_enterprise_policy.js. CLOSED TREE
Backed out changeset 231acfc052bb (bug 1596845) Backed out changeset 7d02dad4d720 (bug 1596845) Backed out changeset b0449eec2671 (bug 1596845) Backed out changeset 5cd033c9ef7c (bug 1596845) Backed out changeset 98d583f1d19e (bug 1596845) Backed out changeset b78bc0049605 (bug 1596845) Backed out changeset 88919aaff89b (bug 1596845) Backed out changeset f4adb3e7b8e1 (bug 1596845) Backed out changeset b171f7ac0b40 (bug 1596845)
1 parent 0347bda commit 56b22ee

File tree

138 files changed

+990
-1416
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+990
-1416
lines changed

browser/base/content/browser.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ XPCOMUtils.defineLazyServiceGetters(this, {
285285
"nsIURIClassifier",
286286
],
287287
Favicons: ["@mozilla.org/browser/favicon-service;1", "nsIFaviconService"],
288+
gDNSService: ["@mozilla.org/network/dns-service;1", "nsIDNSService"],
288289
WindowsUIUtils: ["@mozilla.org/windows-ui-utils;1", "nsIWindowsUIUtils"],
289290
BrowserHandler: ["@mozilla.org/browser/clh;1", "nsIBrowserHandler"],
290291
});

browser/components/doh/DoHController.jsm

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ XPCOMUtils.defineLazyServiceGetter(
7979
"nsICaptivePortalService"
8080
);
8181

82+
XPCOMUtils.defineLazyServiceGetter(
83+
lazy,
84+
"gDNSService",
85+
"@mozilla.org/network/dns-service;1",
86+
"nsIDNSService"
87+
);
88+
8289
XPCOMUtils.defineLazyServiceGetter(
8390
lazy,
8491
"gNetworkLinkService",
@@ -362,7 +369,7 @@ const DoHController = {
362369
};
363370

364371
if (results.steeredProvider) {
365-
Services.dns.setDetectedTrrURI(results.steeredProvider.uri);
372+
lazy.gDNSService.setDetectedTrrURI(results.steeredProvider.uri);
366373
resultsForTelemetry.steeredProvider = results.steeredProvider.id;
367374
}
368375

browser/components/doh/DoHHeuristics.jsm

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ const { XPCOMUtils } = ChromeUtils.importESModule(
1717

1818
const lazy = {};
1919

20+
XPCOMUtils.defineLazyServiceGetter(
21+
lazy,
22+
"gDNSService",
23+
"@mozilla.org/network/dns-service;1",
24+
"nsIDNSService"
25+
);
26+
2027
XPCOMUtils.defineLazyServiceGetter(
2128
lazy,
2229
"gNetworkLinkService",
@@ -132,7 +139,7 @@ async function dnsLookup(hostname, resolveCanonicalName = false) {
132139
Ci.nsIDNSService.RESOLVE_BYPASS_CACHE |
133140
Ci.nsIDNSService.RESOLVE_CANONICAL_NAME;
134141
try {
135-
request = Services.dns.asyncResolve(
142+
request = lazy.gDNSService.asyncResolve(
136143
hostname,
137144
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
138145
dnsFlags,

browser/components/doh/TRRPerformance.jsm

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ XPCOMUtils.defineLazyServiceGetter(
4444
"nsICaptivePortalService"
4545
);
4646

47+
XPCOMUtils.defineLazyServiceGetter(
48+
lazy,
49+
"gDNSService",
50+
"@mozilla.org/network/dns-service;1",
51+
"nsIDNSService"
52+
);
53+
4754
// The canonical domain whose subdomains we will be resolving.
4855
XPCOMUtils.defineLazyPreferenceGetter(
4956
lazy,
@@ -103,11 +110,11 @@ class DNSLookup {
103110
this.retryCount++;
104111
try {
105112
this.usedDomain = this._domain || getRandomSubdomain();
106-
Services.dns.asyncResolve(
113+
lazy.gDNSService.asyncResolve(
107114
this.usedDomain,
108115
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
109116
Ci.nsIDNSService.RESOLVE_BYPASS_CACHE,
110-
Services.dns.newAdditionalInfo(this.trrServer, -1),
117+
lazy.gDNSService.newAdditionalInfo(this.trrServer, -1),
111118
this,
112119
Services.tm.currentThread,
113120
{}

browser/components/doh/test/browser/browser_providerSteering.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,12 @@ add_task(async function testProviderSteering() {
4848
// We need this check because this topic is observed once immediately
4949
// after the network change when the URI is reset, and then when the
5050
// provider steering heuristic runs and sets it to our uri.
51-
return Services.dns.currentTrrURI == expectedURI;
51+
return gDNSService.currentTrrURI == expectedURI;
5252
}
5353
);
5454
simulateNetworkChange();
5555
await trrURIChanged;
56-
is(
57-
Services.dns.currentTrrURI,
58-
expectedURI,
59-
`TRR URI set to ${expectedURI}`
60-
);
56+
is(gDNSService.currentTrrURI, expectedURI, `TRR URI set to ${expectedURI}`);
6157
await checkHeuristicsTelemetry(
6258
heuristicsDecision,
6359
"netchange",

browser/components/doh/test/browser/head.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ XPCOMUtils.defineLazyModuleGetters(this, {
1414
RemoteSettings: "resource://services-settings/remote-settings.js",
1515
});
1616

17+
XPCOMUtils.defineLazyServiceGetter(
18+
this,
19+
"gDNSService",
20+
"@mozilla.org/network/dns-service;1",
21+
"nsIDNSService"
22+
);
23+
1724
XPCOMUtils.defineLazyServiceGetter(
1825
this,
1926
"gDNSOverride",

browser/components/preferences/main.inc.xhtml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -753,8 +753,7 @@
753753
<groupbox id="connectionGroup" data-category="paneGeneral" hidden="true">
754754
<label class="search-header" hidden="true"><html:h2 data-l10n-id="network-settings-title"/></label>
755755

756-
<hbox align="center"
757-
data-subcategory="netsettings">
756+
<hbox align="center">
758757
<description flex="1" control="connectionSettings">
759758
<html:span id="connectionSettingsDescription"/>
760759
<label id="connectionSettingsLearnMore" class="learnMore" is="text-link" data-l10n-id="network-proxy-connection-learn-more"/>

devtools/shared/discovery/discovery.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,9 @@ LocalDevice.prototype = {
148148
// TODO: Bug 1180997: Find the right way to expose an editable name
149149
this.name = Services.sysinfo.get("device");
150150
} else {
151-
this.name = Services.dns.myHostName;
151+
this.name = Cc["@mozilla.org/network/dns-service;1"].getService(
152+
Ci.nsIDNSService
153+
).myHostName;
152154
}
153155
},
154156

devtools/shared/system.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ ChromeUtils.defineESModuleGetters(lazy, {
1616
loader.lazyGetter(this, "hostname", () => {
1717
try {
1818
// On some platforms (Linux according to try), this service does not exist and fails.
19-
return Services.dns.myHostName;
19+
return Cc["@mozilla.org/network/dns-service;1"].getService(Ci.nsIDNSService)
20+
.myHostName;
2021
} catch (e) {
2122
return "";
2223
}

docshell/base/URIFixup.sys.mjs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ XPCOMUtils.defineLazyServiceGetter(
4343
"nsIFileProtocolHandler"
4444
);
4545

46+
XPCOMUtils.defineLazyServiceGetter(
47+
lazy,
48+
"gDNSService",
49+
"@mozilla.org/network/dns-service;1",
50+
"nsIDNSService"
51+
);
52+
4653
XPCOMUtils.defineLazyServiceGetter(
4754
lazy,
4855
"handlerService",
@@ -621,7 +628,7 @@ URIFixup.prototype = {
621628
}
622629

623630
Services.obs.notifyObservers(null, "uri-fixup-check-dns");
624-
Services.dns.asyncResolve(
631+
lazy.gDNSService.asyncResolve(
625632
lookupName,
626633
Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
627634
0,

docshell/test/unit/test_URIFixup_check_host.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ XPCOMUtils.defineLazyServiceGetter(
1414
"nsINativeDNSResolverOverride"
1515
);
1616

17+
XPCOMUtils.defineLazyServiceGetter(
18+
lazy,
19+
"gDNSService",
20+
"@mozilla.org/network/dns-service;1",
21+
"nsIDNSService"
22+
);
23+
1724
add_task(async function setup() {
1825
Services.prefs.setStringPref("browser.fixup.alternate.prefix", "www.");
1926
Services.prefs.setStringPref("browser.fixup.alternate.suffix", ".com");
@@ -88,7 +95,7 @@ add_task(async function test_uri_with_force_fixup() {
8895
);
8996

9097
lazy.gDNSOverride.clearHostOverride(fixedURI.displayHost);
91-
Services.dns.clearCache(false);
98+
lazy.gDNSService.clearCache(false);
9299
});
93100

94101
add_task(async function test_uri_with_get_fixup() {
@@ -105,7 +112,7 @@ add_task(async function test_uri_with_get_fixup() {
105112
);
106113

107114
lazy.gDNSOverride.clearHostOverride(uri.displayHost);
108-
Services.dns.clearCache(false);
115+
lazy.gDNSService.clearCache(false);
109116
});
110117

111118
add_task(async function test_intranet_like_uri() {
@@ -125,7 +132,7 @@ add_task(async function test_intranet_like_uri() {
125132

126133
lazy.gDNSOverride.clearHostOverride(uri.displayHost);
127134
lazy.gDNSOverride.clearHostOverride(uri.displayHost + ".");
128-
Services.dns.clearCache(false);
135+
lazy.gDNSService.clearCache(false);
129136
});
130137

131138
add_task(async function test_intranet_like_uri_without_fixup() {
@@ -149,7 +156,7 @@ add_task(async function test_intranet_like_uri_without_fixup() {
149156

150157
lazy.gDNSOverride.clearHostOverride(uri.displayHost);
151158
lazy.gDNSOverride.clearHostOverride(uri.displayHost + ".");
152-
Services.dns.clearCache(false);
159+
lazy.gDNSService.clearCache(false);
153160
});
154161

155162
add_task(async function test_ip_address() {
@@ -178,6 +185,6 @@ add_task(async function test_ip_address() {
178185
);
179186

180187
lazy.gDNSOverride.clearHostOverride(uri.displayHost);
181-
Services.dns.clearCache(false);
188+
lazy.gDNSService.clearCache(false);
182189
Services.obs.removeObserver(observer, topic);
183190
});

dom/base/Document.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2122,7 +2122,7 @@ void Document::AccumulatePageLoadTelemetry(
21222122
if (resolvedByTRR) {
21232123
RefPtr<net::ChildDNSService> dnsServiceChild =
21242124
net::ChildDNSService::GetSingleton();
2125-
dnsServiceChild->GetTRRDomainKey(dnsKey);
2125+
dnsServiceChild->GetTRRDomain(dnsKey);
21262126
aEventTelemetryDataOut.trrDomain = mozilla::Some(dnsKey);
21272127
}
21282128

dom/html/HTMLDNSPrefetch.cpp

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class DeferredDNSPrefetches final : public nsIWebProgressListener,
9696
DeferredDNSPrefetches();
9797

9898
void Activate();
99-
nsresult Add(nsIDNSService::DNSFlags flags, SupportsDNSPrefetch&, Element&);
99+
nsresult Add(uint32_t flags, SupportsDNSPrefetch&, Element&);
100100

101101
void RemoveUnboundLinks();
102102

@@ -105,7 +105,7 @@ class DeferredDNSPrefetches final : public nsIWebProgressListener,
105105
void Flush();
106106

107107
void SubmitQueue();
108-
void SubmitQueueEntry(Element&, nsIDNSService::DNSFlags aFlags);
108+
void SubmitQueueEntry(Element&, uint32_t aFlags);
109109

110110
uint16_t mHead;
111111
uint16_t mTail;
@@ -119,7 +119,7 @@ class DeferredDNSPrefetches final : public nsIWebProgressListener,
119119
static const int sMaxDeferredMask = (sMaxDeferred - 1);
120120

121121
struct deferred_entry {
122-
nsIDNSService::DNSFlags mFlags;
122+
uint32_t mFlags;
123123
// SupportsDNSPrefetch clears this raw pointer in Destroyed().
124124
Element* mElement;
125125
} mEntries[sMaxDeferred];
@@ -184,26 +184,25 @@ bool HTMLDNSPrefetch::IsAllowed(Document* aDocument) {
184184
return aDocument->IsDNSPrefetchAllowed() && aDocument->GetWindow();
185185
}
186186

187-
static nsIDNSService::DNSFlags GetDNSFlagsFromElement(Element& aElement) {
187+
static uint32_t GetDNSFlagsFromElement(Element& aElement) {
188188
nsIChannel* channel = aElement.OwnerDoc()->GetChannel();
189189
if (!channel) {
190-
return nsIDNSService::RESOLVE_DEFAULT_FLAGS;
190+
return 0;
191191
}
192192
return nsIDNSService::GetFlagsFromTRRMode(channel->GetTRRMode());
193193
}
194194

195-
nsIDNSService::DNSFlags HTMLDNSPrefetch::PriorityToDNSServiceFlags(
196-
Priority aPriority) {
195+
uint32_t HTMLDNSPrefetch::PriorityToDNSServiceFlags(Priority aPriority) {
197196
switch (aPriority) {
198197
case Priority::Low:
199-
return nsIDNSService::RESOLVE_PRIORITY_LOW;
198+
return uint32_t(nsIDNSService::RESOLVE_PRIORITY_LOW);
200199
case Priority::Medium:
201-
return nsIDNSService::RESOLVE_PRIORITY_MEDIUM;
200+
return uint32_t(nsIDNSService::RESOLVE_PRIORITY_MEDIUM);
202201
case Priority::High:
203-
return nsIDNSService::RESOLVE_DEFAULT_FLAGS;
202+
return 0u;
204203
}
205204
MOZ_ASSERT_UNREACHABLE("Unknown priority");
206-
return nsIDNSService::RESOLVE_DEFAULT_FLAGS;
205+
return 0u;
207206
}
208207

209208
nsresult HTMLDNSPrefetch::Prefetch(SupportsDNSPrefetch& aSupports,
@@ -220,7 +219,7 @@ nsresult HTMLDNSPrefetch::Prefetch(SupportsDNSPrefetch& aSupports,
220219
nsresult HTMLDNSPrefetch::Prefetch(
221220
const nsAString& hostname, bool isHttps,
222221
const OriginAttributes& aPartitionedPrincipalOriginAttributes,
223-
nsIDNSService::DNSFlags flags) {
222+
uint32_t flags) {
224223
if (IsNeckoChild()) {
225224
// We need to check IsEmpty() because net_IsValidHostName()
226225
// considers empty strings to be valid hostnames
@@ -277,7 +276,7 @@ nsresult HTMLDNSPrefetch::CancelPrefetch(SupportsDNSPrefetch& aSupports,
277276
return NS_ERROR_NOT_AVAILABLE;
278277
}
279278

280-
nsIDNSService::DNSFlags flags =
279+
uint32_t flags =
281280
GetDNSFlagsFromElement(aElement) | PriorityToDNSServiceFlags(aPriority);
282281

283282
nsIURI* uri = aSupports.GetURIForDNSPrefetch(aElement);
@@ -302,7 +301,7 @@ nsresult HTMLDNSPrefetch::CancelPrefetch(SupportsDNSPrefetch& aSupports,
302301
nsresult HTMLDNSPrefetch::CancelPrefetch(
303302
const nsAString& hostname, bool isHttps,
304303
const OriginAttributes& aPartitionedPrincipalOriginAttributes,
305-
nsIDNSService::DNSFlags flags, nsresult aReason) {
304+
uint32_t flags, nsresult aReason) {
306305
// Forward this request to Necko Parent if we're a child process
307306
if (IsNeckoChild()) {
308307
// We need to check IsEmpty() because net_IsValidHostName()
@@ -410,7 +409,7 @@ void DeferredDNSPrefetches::Flush() {
410409
}
411410
}
412411

413-
nsresult DeferredDNSPrefetches::Add(nsIDNSService::DNSFlags flags,
412+
nsresult DeferredDNSPrefetches::Add(uint32_t flags,
414413
SupportsDNSPrefetch& aSupports,
415414
Element& aElement) {
416415
// The FIFO has no lock, so it can only be accessed on main thread
@@ -461,7 +460,7 @@ void DeferredDNSPrefetches::SubmitQueue() {
461460
}
462461

463462
void DeferredDNSPrefetches::SubmitQueueEntry(Element& aElement,
464-
nsIDNSService::DNSFlags aFlags) {
463+
uint32_t aFlags) {
465464
auto& supports = ToSupportsDNSPrefetch(aElement);
466465
supports.ClearIsInDNSPrefetch();
467466

dom/html/HTMLDNSPrefetch.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include "nsCOMPtr.h"
1111
#include "nsIRequest.h"
1212
#include "nsString.h"
13-
#include "nsIDNSService.h"
1413

1514
class nsITimer;
1615
class nsIURI;
@@ -69,16 +68,16 @@ class HTMLDNSPrefetch {
6968
static void ElementDestroyed(Element&, SupportsDNSPrefetch&);
7069

7170
private:
72-
static nsIDNSService::DNSFlags PriorityToDNSServiceFlags(Priority);
71+
static uint32_t PriorityToDNSServiceFlags(Priority);
7372

7473
static nsresult Prefetch(
7574
const nsAString& host, bool isHttps,
7675
const OriginAttributes& aPartitionedPrincipalOriginAttributes,
77-
nsIDNSService::DNSFlags flags);
76+
uint32_t flags);
7877
static nsresult CancelPrefetch(
7978
const nsAString& hostname, bool isHttps,
8079
const OriginAttributes& aPartitionedPrincipalOriginAttributes,
81-
nsIDNSService::DNSFlags flags, nsresult aReason);
80+
uint32_t flags, nsresult aReason);
8281

8382
friend class net::NeckoParent;
8483
};

dom/ipc/ContentParent.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3114,8 +3114,7 @@ bool ContentParent::InitInternal(ProcessPriority aInitialPriority) {
31143114

31153115
xpcomInit.perfStatsMask() = PerfStats::GetCollectionMask();
31163116

3117-
nsCOMPtr<nsIDNSService> dns = do_GetService(NS_DNSSERVICE_CONTRACTID);
3118-
dns->GetTrrDomain(xpcomInit.trrDomain());
3117+
xpcomInit.trrDomain() = TRRService::ProviderKey();
31193118

31203119
Unused << SendSetXPCOMProcessAttributes(
31213120
xpcomInit, initialData, lnf, fontList, std::move(sharedUASheetHandle),

0 commit comments

Comments
 (0)