Backed out 4 changesets (bug 1955579) for causing XPC failures on test_TRRRacer.js

Backed out changeset 820d70c9c0a3 (bug 1955579)
Backed out changeset b3c4ae7bc073 (bug 1955579)
Backed out changeset 7a78799b24a0 (bug 1955579)
Backed out changeset b3ec267e42e0 (bug 1955579)
This commit is contained in:
Narcis Beleuzu
2025-04-03 20:35:53 +03:00
parent d7a1f1d136
commit cc33cd20bb
37 changed files with 79 additions and 87 deletions

View File

@@ -34,7 +34,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
DAPTelemetrySender: "resource://gre/modules/DAPTelemetrySender.sys.mjs", DAPTelemetrySender: "resource://gre/modules/DAPTelemetrySender.sys.mjs",
DAPVisitCounter: "resource://gre/modules/DAPVisitCounter.sys.mjs", DAPVisitCounter: "resource://gre/modules/DAPVisitCounter.sys.mjs",
Discovery: "resource:///modules/Discovery.sys.mjs", Discovery: "resource:///modules/Discovery.sys.mjs",
DoHController: "resource://gre/modules/DoHController.sys.mjs", DoHController: "resource:///modules/DoHController.sys.mjs",
DownloadsViewableInternally: DownloadsViewableInternally:
"resource:///modules/DownloadsViewableInternally.sys.mjs", "resource:///modules/DownloadsViewableInternally.sys.mjs",
ExtensionsUI: "resource:///modules/ExtensionsUI.sys.mjs", ExtensionsUI: "resource:///modules/ExtensionsUI.sys.mjs",

View File

@@ -262,22 +262,20 @@ export const DoHConfigController = {
observe(subject, topic, data) { observe(subject, topic, data) {
switch (topic) { switch (topic) {
case kPrefChangedTopic: case kPrefChangedTopic:
{ let allowedPrefs = Object.getOwnPropertyNames(kConfigPrefs).map(
let allowedPrefs = Object.getOwnPropertyNames(kConfigPrefs).map( k => kConfigPrefs[k]
k => kConfigPrefs[k] );
); if (
if ( !allowedPrefs.some(pref =>
!allowedPrefs.some(pref => [
[ `${regionPrefBranch()}.${pref}`,
`${regionPrefBranch()}.${pref}`, `${kGlobalPrefBranch}.${pref}`,
`${kGlobalPrefBranch}.${pref}`, ].includes(data)
].includes(data) )
) ) {
) { break;
break;
}
this.notifyNewConfig();
} }
this.notifyNewConfig();
break; break;
case "idle-daily": case "idle-daily":
if ( if (
@@ -333,11 +331,7 @@ export const DoHConfigController = {
return; return;
} }
let isAndroid = Services.appinfo.OS === "Android"; if (localConfig.rolloutEnabled) {
if (
(isAndroid && localConfig.androidRolloutEnabled) ||
(!isAndroid && localConfig.rolloutEnabled)
) {
newConfig.enabled = true; newConfig.enabled = true;
} }

View File

@@ -14,9 +14,9 @@ const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
AsyncShutdown: "resource://gre/modules/AsyncShutdown.sys.mjs", AsyncShutdown: "resource://gre/modules/AsyncShutdown.sys.mjs",
ClientID: "resource://gre/modules/ClientID.sys.mjs", ClientID: "resource://gre/modules/ClientID.sys.mjs",
DoHConfigController: "resource://gre/modules/DoHConfig.sys.mjs", DoHConfigController: "resource:///modules/DoHConfig.sys.mjs",
ExperimentAPI: "resource://nimbus/ExperimentAPI.sys.mjs", ExperimentAPI: "resource://nimbus/ExperimentAPI.sys.mjs",
Heuristics: "resource://gre/modules/DoHHeuristics.sys.mjs", Heuristics: "resource:///modules/DoHHeuristics.sys.mjs",
NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs", NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs",
Preferences: "resource://gre/modules/Preferences.sys.mjs", Preferences: "resource://gre/modules/Preferences.sys.mjs",
clearTimeout: "resource://gre/modules/Timer.sys.mjs", clearTimeout: "resource://gre/modules/Timer.sys.mjs",
@@ -589,7 +589,7 @@ export const DoHController = {
// Importing the module here saves us from having to do it at startup, and // Importing the module here saves us from having to do it at startup, and
// ensures tests have time to set prefs before the module initializes. // ensures tests have time to set prefs before the module initializes.
let { TRRRacer } = ChromeUtils.importESModule( let { TRRRacer } = ChromeUtils.importESModule(
"resource://gre/modules/TRRPerformance.sys.mjs" "resource:///modules/TRRPerformance.sys.mjs"
); );
await new Promise(resolve => { await new Promise(resolve => {
let trrList = let trrList =

View File

@@ -26,7 +26,7 @@ XPCOMUtils.defineLazyServiceGetter(
); );
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
DoHConfigController: "resource://gre/modules/DoHConfig.sys.mjs", DoHConfigController: "resource:///modules/DoHConfig.sys.mjs",
}); });
const GLOBAL_CANARY = "use-application-dns.net."; const GLOBAL_CANARY = "use-application-dns.net.";
@@ -279,10 +279,6 @@ async function thirdPartyRoots() {
} }
async function enterprisePolicy() { async function enterprisePolicy() {
if (!Services.policies) {
return "no_policy_set";
}
if (Services.policies.status === Services.policies.ACTIVE) { if (Services.policies.status === Services.policies.ACTIVE) {
let policies = Services.policies.getActivePolicies(); let policies = Services.policies.getActivePolicies();

View File

@@ -77,9 +77,6 @@ function getRandomSubdomain() {
// callback. The wrapper attempts the lookup 3 times before passing on a failure. // callback. The wrapper attempts the lookup 3 times before passing on a failure.
// If a false-y `domain` is supplied, a random subdomain will be used. Each retry // If a false-y `domain` is supplied, a random subdomain will be used. Each retry
// will use a different random subdomain to ensure we bypass chached responses. // will use a different random subdomain to ensure we bypass chached responses.
/**
*
*/
export class DNSLookup { export class DNSLookup {
constructor(domain, trrServer, callback) { constructor(domain, trrServer, callback) {
this._domain = domain; this._domain = domain;
@@ -123,9 +120,6 @@ DNSLookup.prototype.QueryInterface = ChromeUtils.generateQI(["nsIDNSListener"]);
// A wrapper around a single set of measurements. The required lookups are // A wrapper around a single set of measurements. The required lookups are
// triggered and the results aggregated before telemetry is sent. If aborted, // triggered and the results aggregated before telemetry is sent. If aborted,
// any aggregated results are discarded. // any aggregated results are discarded.
/**
*
*/
export class LookupAggregator { export class LookupAggregator {
constructor(onCompleteCallback, trrList) { constructor(onCompleteCallback, trrList) {
this.onCompleteCallback = onCompleteCallback; this.onCompleteCallback = onCompleteCallback;
@@ -227,9 +221,6 @@ export class LookupAggregator {
// When the network goes down, an ongoing aggregator is aborted and a new one // When the network goes down, an ongoing aggregator is aborted and a new one
// spawned next time we get a link, up to 5 times. On the fifth time, we just // spawned next time we get a link, up to 5 times. On the fifth time, we just
// let the aggegator complete and mark it as tainted. // let the aggegator complete and mark it as tainted.
/**
*
*/
export class TRRRacer { export class TRRRacer {
constructor(onCompleteCallback, trrList) { constructor(onCompleteCallback, trrList) {
this._aggregator = null; this._aggregator = null;

View File

@@ -5,7 +5,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
with Files("**"): with Files("**"):
BUG_COMPONENT = ("Core", "Networking: DNS") BUG_COMPONENT = ("Firefox", "Security")
EXTRA_JS_MODULES += [ EXTRA_JS_MODULES += [
"DoHConfig.sys.mjs", "DoHConfig.sys.mjs",

View File

@@ -1,6 +1,5 @@
[DEFAULT] [DEFAULT]
head = "head.js" head = "head.js"
skip-if = ["os == 'android'"] # browser-chrome tests don't work on android
["browser_cleanFlow.js"] ["browser_cleanFlow.js"]

View File

@@ -5,7 +5,7 @@
"use strict"; "use strict";
ChromeUtils.defineESModuleGetters(this, { ChromeUtils.defineESModuleGetters(this, {
Heuristics: "resource://gre/modules/DoHHeuristics.sys.mjs", Heuristics: "resource:///modules/DoHHeuristics.sys.mjs",
}); });
add_task(setup); add_task(setup);

View File

@@ -2,10 +2,10 @@
ChromeUtils.defineESModuleGetters(this, { ChromeUtils.defineESModuleGetters(this, {
ASRouter: "resource:///modules/asrouter/ASRouter.sys.mjs", ASRouter: "resource:///modules/asrouter/ASRouter.sys.mjs",
DoHConfigController: "resource://gre/modules/DoHConfig.sys.mjs", DoHConfigController: "resource:///modules/DoHConfig.sys.mjs",
DoHController: "resource://gre/modules/DoHController.sys.mjs", DoHController: "resource:///modules/DoHController.sys.mjs",
DoHTestUtils: "resource://testing-common/DoHTestUtils.sys.mjs", DoHTestUtils: "resource://testing-common/DoHTestUtils.sys.mjs",
Heuristics: "resource://gre/modules/DoHHeuristics.sys.mjs", Heuristics: "resource:///modules/DoHHeuristics.sys.mjs",
Preferences: "resource://gre/modules/Preferences.sys.mjs", Preferences: "resource://gre/modules/Preferences.sys.mjs",
Region: "resource://gre/modules/Region.sys.mjs", Region: "resource://gre/modules/Region.sys.mjs",
RegionTestUtils: "resource://testing-common/RegionTestUtils.sys.mjs", RegionTestUtils: "resource://testing-common/RegionTestUtils.sys.mjs",

View File

@@ -80,7 +80,7 @@ function setup() {
); );
let TRRPerformance = ChromeUtils.importESModule( let TRRPerformance = ChromeUtils.importESModule(
"resource://gre/modules/TRRPerformance.sys.mjs" "resource:///modules/TRRPerformance.sys.mjs"
); );
DNSLookup = TRRPerformance.DNSLookup; DNSLookup = TRRPerformance.DNSLookup;

View File

@@ -14,7 +14,6 @@ async function helper_SuccessfulLookupAggregator(
networkUnstable = false, networkUnstable = false,
captivePortal = false captivePortal = false
) { ) {
Services.fog.testResetFOG();
let deferred = Promise.withResolvers(); let deferred = Promise.withResolvers();
let aggregator = new LookupAggregator(() => deferred.resolve(), trrList); let aggregator = new LookupAggregator(() => deferred.resolve(), trrList);
// The aggregator's domain list should correctly reflect our set // The aggregator's domain list should correctly reflect our set
@@ -39,23 +38,24 @@ async function helper_SuccessfulLookupAggregator(
Assert.equal(aggregator.captivePortal, captivePortal); Assert.equal(aggregator.captivePortal, captivePortal);
Assert.equal(aggregator.results.length, aggregator.totalLookups); Assert.equal(aggregator.results.length, aggregator.totalLookups);
let events = let events = Services.telemetry.snapshotEvents(
await Glean.securityDohTrrPerformance.resolvedRecord.testGetValue(); Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS,
true
).parent;
Assert.ok(events); Assert.ok(events);
info(events); events = events.filter(e => e[1] == "security.doh.trrPerformance");
events = events.filter(e => e.category == "security.doh.trr_performance");
Assert.equal(events.length, aggregator.totalLookups); Assert.equal(events.length, aggregator.totalLookups);
for (let event of events) { for (let event of events) {
info(JSON.stringify(event)); info(JSON.stringify(event));
Assert.equal(event.category, "security.doh.trr_performance"); Assert.equal(event[1], "security.doh.trrPerformance");
Assert.equal(event.name, "resolved_record"); Assert.equal(event[2], "resolved");
Assert.equal(event.extra.value, "success"); Assert.equal(event[3], "record");
Assert.equal(event[4], "success");
} }
// We only need to check the payload of each event from here on. // We only need to check the payload of each event from here on.
events = events.map(e => e.extra); events = events.map(e => e[5]);
for (let trr of [trrServer1, trrServer2]) { for (let trr of [trrServer1, trrServer2]) {
// There should be two results for random subdomains. // There should be two results for random subdomains.
@@ -114,7 +114,7 @@ async function helper_SuccessfulLookupAggregator(
} }
} }
Services.fog.testResetFOG(); Services.telemetry.clearEvents();
} }
add_task(async function test_SuccessfulLookupAggregator() { add_task(async function test_SuccessfulLookupAggregator() {
@@ -125,7 +125,6 @@ add_task(async function test_SuccessfulLookupAggregator() {
}); });
add_task(async function test_AbortedLookupAggregator() { add_task(async function test_AbortedLookupAggregator() {
Services.fog.testResetFOG();
let deferred = Promise.withResolvers(); let deferred = Promise.withResolvers();
let aggregator = new LookupAggregator(() => deferred.resolve(), trrList); let aggregator = new LookupAggregator(() => deferred.resolve(), trrList);
// The aggregator's domain list should correctly reflect our set // The aggregator's domain list should correctly reflect our set
@@ -153,7 +152,11 @@ add_task(async function test_AbortedLookupAggregator() {
Assert.ok(!aggregator.captivePortal); Assert.ok(!aggregator.captivePortal);
// Ensure we send no telemetry for an aborted run! // Ensure we send no telemetry for an aborted run!
let events = let events = Services.telemetry.snapshotEvents(
await Glean.securityDohTrrPerformance.resolvedRecord.testGetValue(); Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS,
Assert.ok(!events || !events.length); true
).parent;
Assert.ok(
!events || !events.filter(e => e[1] == "security.doh.trrPerformance").length
);
}); });

View File

@@ -7,7 +7,6 @@
add_task(setup); add_task(setup);
add_task(async function test_TRRRacer_cleanRun() { add_task(async function test_TRRRacer_cleanRun() {
Services.fog.testResetFOG();
let deferred = Promise.withResolvers(); let deferred = Promise.withResolvers();
let racer = new TRRRacer(() => { let racer = new TRRRacer(() => {
deferred.resolve(); deferred.resolve();
@@ -18,12 +17,15 @@ add_task(async function test_TRRRacer_cleanRun() {
await deferred.promise; await deferred.promise;
Assert.equal(racer._retryCount, 1); Assert.equal(racer._retryCount, 1);
let events = let events = Services.telemetry.snapshotEvents(
await Glean.securityDohTrrPerformance.resolvedRecord.testGetValue(); Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS,
events = events.filter(e => e.category == "security.doh.trr_performance"); true
).parent;
Assert.ok(events);
events = events.filter(e => e[1] == "security.doh.trrPerformance");
Assert.equal(events.length, racer._aggregator.totalLookups); Assert.equal(events.length, racer._aggregator.totalLookups);
Services.fog.testResetFOG(); Services.telemetry.clearEvents();
// Simulate network changes and ensure no re-runs since it's already complete. // Simulate network changes and ensure no re-runs since it's already complete.
async function testNetworkChange(captivePortal = false) { async function testNetworkChange(captivePortal = false) {
@@ -54,7 +56,6 @@ add_task(async function test_TRRRacer_cleanRun() {
}); });
async function test_TRRRacer_networkFlux_helper(captivePortal = false) { async function test_TRRRacer_networkFlux_helper(captivePortal = false) {
Services.fog.testResetFOG();
let deferred = Promise.withResolvers(); let deferred = Promise.withResolvers();
let racer = new TRRRacer(() => { let racer = new TRRRacer(() => {
deferred.resolve(); deferred.resolve();
@@ -84,12 +85,15 @@ async function test_TRRRacer_networkFlux_helper(captivePortal = false) {
Assert.equal(racer._retryCount, 2); Assert.equal(racer._retryCount, 2);
let events = let events = Services.telemetry.snapshotEvents(
await Glean.securityDohTrrPerformance.resolvedRecord.testGetValue(); Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS,
events = events.filter(e => e.category == "security.doh.trr_performance"); true
).parent;
Assert.ok(events);
events = events.filter(e => e[1] == "security.doh.trrPerformance");
Assert.equal(events.length, racer._aggregator.totalLookups); Assert.equal(events.length, racer._aggregator.totalLookups);
Services.fog.testResetFOG(); Services.telemetry.clearEvents();
if (captivePortal) { if (captivePortal) {
Services.obs.notifyObservers(null, "captive-portal-login-abort"); Services.obs.notifyObservers(null, "captive-portal-login-abort");
} }
@@ -141,12 +145,15 @@ async function test_TRRRacer_maxRetries_helper(captivePortal = false) {
await deferred.promise; await deferred.promise;
Assert.equal(racer._retryCount, 5); Assert.equal(racer._retryCount, 5);
let events = let events = Services.telemetry.snapshotEvents(
await Glean.securityDohTrrPerformance.resolvedRecord.testGetValue(); Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS,
events = events.filter(e => e.category == "security.doh.trr_performance"); true
).parent;
Assert.ok(events);
events = events.filter(e => e[1] == "security.doh.trrPerformance");
Assert.equal(events.length, racer._aggregator.totalLookups); Assert.equal(events.length, racer._aggregator.totalLookups);
Services.fog.testResetFOG(); Services.telemetry.clearEvents();
if (captivePortal) { if (captivePortal) {
Services.obs.notifyObservers(null, "captive-portal-login-abort"); Services.obs.notifyObservers(null, "captive-portal-login-abort");
} }

View File

@@ -35,7 +35,7 @@ add_task(setup);
add_task(async function test_parentalControls() { add_task(async function test_parentalControls() {
let DoHHeuristics = ChromeUtils.importESModule( let DoHHeuristics = ChromeUtils.importESModule(
"resource://gre/modules/DoHHeuristics.sys.mjs" "resource:///modules/DoHHeuristics.sys.mjs"
); );
let parentalControls = DoHHeuristics.parentalControls; let parentalControls = DoHHeuristics.parentalControls;

View File

@@ -1,4 +1,5 @@
[DEFAULT] [DEFAULT]
skip-if = ["os == 'android'"] # bug 1730213
head = "head.js" head = "head.js"
firefox-appdir = "browser" firefox-appdir = "browser"
support-files = ["../../../../../netwerk/test/unit/http2-ca.pem"] support-files = ["../../../../../netwerk/test/unit/http2-ca.pem"]

View File

@@ -36,6 +36,7 @@ DIRS += [
"contentanalysis", "contentanalysis",
"contextualidentity", "contextualidentity",
"customizableui", "customizableui",
"doh",
"downloads", "downloads",
"enterprisepolicies", "enterprisepolicies",
"extensions", "extensions",

View File

@@ -76,7 +76,7 @@ XPCOMUtils.defineLazyPreferenceGetter(
); );
ChromeUtils.defineESModuleGetters(this, { ChromeUtils.defineESModuleGetters(this, {
DoHConfigController: "resource://gre/modules/DoHConfig.sys.mjs", DoHConfigController: "resource:///modules/DoHConfig.sys.mjs",
Sanitizer: "resource:///modules/Sanitizer.sys.mjs", Sanitizer: "resource:///modules/Sanitizer.sys.mjs",
SelectableProfileService: SelectableProfileService:
"resource:///modules/profiles/SelectableProfileService.sys.mjs", "resource:///modules/profiles/SelectableProfileService.sys.mjs",

View File

@@ -11,8 +11,8 @@ const { EnterprisePolicyTesting, PoliciesPrefTracker } =
); );
ChromeUtils.defineESModuleGetters(this, { ChromeUtils.defineESModuleGetters(this, {
DoHConfigController: "resource://gre/modules/DoHConfig.sys.mjs", DoHConfigController: "resource:///modules/DoHConfig.sys.mjs",
DoHController: "resource://gre/modules/DoHController.sys.mjs", DoHController: "resource:///modules/DoHController.sys.mjs",
DoHTestUtils: "resource://testing-common/DoHTestUtils.sys.mjs", DoHTestUtils: "resource://testing-common/DoHTestUtils.sys.mjs",
}); });

View File

@@ -9,7 +9,6 @@ const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
ActorManagerParent: "resource://gre/modules/ActorManagerParent.sys.mjs", ActorManagerParent: "resource://gre/modules/ActorManagerParent.sys.mjs",
DoHController: "resource://gre/modules/DoHController.sys.mjs",
EventDispatcher: "resource://gre/modules/Messaging.sys.mjs", EventDispatcher: "resource://gre/modules/Messaging.sys.mjs",
PdfJs: "resource://pdf.js/PdfJs.sys.mjs", PdfJs: "resource://pdf.js/PdfJs.sys.mjs",
}); });
@@ -273,8 +272,6 @@ export class GeckoViewStartup {
// Notify the start up crash tracker that the browser has successfully // Notify the start up crash tracker that the browser has successfully
// started up so the startup cache isn't rebuilt on next startup. // started up so the startup cache isn't rebuilt on next startup.
Services.startup.trackStartupCrashEnd(); Services.startup.trackStartupCrashEnd();
lazy.DoHController.init();
break; break;
} }
case "handlersvc-store-initialized": { case "handlersvc-store-initialized": {

View File

@@ -2,7 +2,11 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this # License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
FINAL_TARGET_FILES.defaults.settings.main += [ if CONFIG["MOZ_BUILD_APP"] == "browser":
"doh-config.json", DIST_SUBDIR = "browser"
"doh-providers.json",
] # These collections are only referenced from browser/
FINAL_TARGET_FILES.defaults.settings.main += [
"doh-config.json",
"doh-providers.json",
]

View File

@@ -70,7 +70,6 @@ gecko_metrics = [
"toolkit/components/antitracking/metrics.yaml", "toolkit/components/antitracking/metrics.yaml",
"toolkit/components/captchadetection/metrics.yaml", "toolkit/components/captchadetection/metrics.yaml",
"toolkit/components/cookiebanners/metrics.yaml", "toolkit/components/cookiebanners/metrics.yaml",
"toolkit/components/doh/metrics.yaml",
"toolkit/components/downloads/metrics.yaml", "toolkit/components/downloads/metrics.yaml",
"toolkit/components/enterprisepolicies/metrics.yaml", "toolkit/components/enterprisepolicies/metrics.yaml",
"toolkit/components/extensions/metrics.yaml", "toolkit/components/extensions/metrics.yaml",
@@ -110,6 +109,7 @@ firefox_desktop_metrics = [
"browser/actors/metrics.yaml", "browser/actors/metrics.yaml",
"browser/components/asrouter/metrics.yaml", "browser/components/asrouter/metrics.yaml",
"browser/components/backup/metrics.yaml", "browser/components/backup/metrics.yaml",
"browser/components/doh/metrics.yaml",
"browser/components/downloads/metrics.yaml", "browser/components/downloads/metrics.yaml",
"browser/components/firefoxview/metrics.yaml", "browser/components/firefoxview/metrics.yaml",
"browser/components/genai/metrics.yaml", "browser/components/genai/metrics.yaml",

View File

@@ -39,7 +39,6 @@ DIRS += [
"crashes", "crashes",
"crashmonitor", "crashmonitor",
"credentialmanagement", "credentialmanagement",
"doh",
"downloads", "downloads",
"enterprisepolicies", "enterprisepolicies",
"extensions", "extensions",