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",
DAPVisitCounter: "resource://gre/modules/DAPVisitCounter.sys.mjs",
Discovery: "resource:///modules/Discovery.sys.mjs",
DoHController: "resource://gre/modules/DoHController.sys.mjs",
DoHController: "resource:///modules/DoHController.sys.mjs",
DownloadsViewableInternally:
"resource:///modules/DownloadsViewableInternally.sys.mjs",
ExtensionsUI: "resource:///modules/ExtensionsUI.sys.mjs",

View File

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

View File

@@ -14,9 +14,9 @@ const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
AsyncShutdown: "resource://gre/modules/AsyncShutdown.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",
Heuristics: "resource://gre/modules/DoHHeuristics.sys.mjs",
Heuristics: "resource:///modules/DoHHeuristics.sys.mjs",
NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs",
Preferences: "resource://gre/modules/Preferences.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
// ensures tests have time to set prefs before the module initializes.
let { TRRRacer } = ChromeUtils.importESModule(
"resource://gre/modules/TRRPerformance.sys.mjs"
"resource:///modules/TRRPerformance.sys.mjs"
);
await new Promise(resolve => {
let trrList =

View File

@@ -26,7 +26,7 @@ XPCOMUtils.defineLazyServiceGetter(
);
ChromeUtils.defineESModuleGetters(lazy, {
DoHConfigController: "resource://gre/modules/DoHConfig.sys.mjs",
DoHConfigController: "resource:///modules/DoHConfig.sys.mjs",
});
const GLOBAL_CANARY = "use-application-dns.net.";
@@ -279,10 +279,6 @@ async function thirdPartyRoots() {
}
async function enterprisePolicy() {
if (!Services.policies) {
return "no_policy_set";
}
if (Services.policies.status === Services.policies.ACTIVE) {
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.
// 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.
/**
*
*/
export class DNSLookup {
constructor(domain, trrServer, callback) {
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
// triggered and the results aggregated before telemetry is sent. If aborted,
// any aggregated results are discarded.
/**
*
*/
export class LookupAggregator {
constructor(onCompleteCallback, trrList) {
this.onCompleteCallback = onCompleteCallback;
@@ -227,9 +221,6 @@ export class LookupAggregator {
// 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
// let the aggegator complete and mark it as tainted.
/**
*
*/
export class TRRRacer {
constructor(onCompleteCallback, trrList) {
this._aggregator = null;

View File

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

View File

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

View File

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

View File

@@ -2,10 +2,10 @@
ChromeUtils.defineESModuleGetters(this, {
ASRouter: "resource:///modules/asrouter/ASRouter.sys.mjs",
DoHConfigController: "resource://gre/modules/DoHConfig.sys.mjs",
DoHController: "resource://gre/modules/DoHController.sys.mjs",
DoHConfigController: "resource:///modules/DoHConfig.sys.mjs",
DoHController: "resource:///modules/DoHController.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",
Region: "resource://gre/modules/Region.sys.mjs",
RegionTestUtils: "resource://testing-common/RegionTestUtils.sys.mjs",

View File

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

View File

@@ -14,7 +14,6 @@ async function helper_SuccessfulLookupAggregator(
networkUnstable = false,
captivePortal = false
) {
Services.fog.testResetFOG();
let deferred = Promise.withResolvers();
let aggregator = new LookupAggregator(() => deferred.resolve(), trrList);
// 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.results.length, aggregator.totalLookups);
let events =
await Glean.securityDohTrrPerformance.resolvedRecord.testGetValue();
let events = Services.telemetry.snapshotEvents(
Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS,
true
).parent;
Assert.ok(events);
info(events);
events = events.filter(e => e.category == "security.doh.trr_performance");
events = events.filter(e => e[1] == "security.doh.trrPerformance");
Assert.equal(events.length, aggregator.totalLookups);
for (let event of events) {
info(JSON.stringify(event));
Assert.equal(event.category, "security.doh.trr_performance");
Assert.equal(event.name, "resolved_record");
Assert.equal(event.extra.value, "success");
Assert.equal(event[1], "security.doh.trrPerformance");
Assert.equal(event[2], "resolved");
Assert.equal(event[3], "record");
Assert.equal(event[4], "success");
}
// 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]) {
// 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() {
@@ -125,7 +125,6 @@ add_task(async function test_SuccessfulLookupAggregator() {
});
add_task(async function test_AbortedLookupAggregator() {
Services.fog.testResetFOG();
let deferred = Promise.withResolvers();
let aggregator = new LookupAggregator(() => deferred.resolve(), trrList);
// The aggregator's domain list should correctly reflect our set
@@ -153,7 +152,11 @@ add_task(async function test_AbortedLookupAggregator() {
Assert.ok(!aggregator.captivePortal);
// Ensure we send no telemetry for an aborted run!
let events =
await Glean.securityDohTrrPerformance.resolvedRecord.testGetValue();
Assert.ok(!events || !events.length);
let events = Services.telemetry.snapshotEvents(
Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS,
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(async function test_TRRRacer_cleanRun() {
Services.fog.testResetFOG();
let deferred = Promise.withResolvers();
let racer = new TRRRacer(() => {
deferred.resolve();
@@ -18,12 +17,15 @@ add_task(async function test_TRRRacer_cleanRun() {
await deferred.promise;
Assert.equal(racer._retryCount, 1);
let events =
await Glean.securityDohTrrPerformance.resolvedRecord.testGetValue();
events = events.filter(e => e.category == "security.doh.trr_performance");
let events = Services.telemetry.snapshotEvents(
Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS,
true
).parent;
Assert.ok(events);
events = events.filter(e => e[1] == "security.doh.trrPerformance");
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.
async function testNetworkChange(captivePortal = false) {
@@ -54,7 +56,6 @@ add_task(async function test_TRRRacer_cleanRun() {
});
async function test_TRRRacer_networkFlux_helper(captivePortal = false) {
Services.fog.testResetFOG();
let deferred = Promise.withResolvers();
let racer = new TRRRacer(() => {
deferred.resolve();
@@ -84,12 +85,15 @@ async function test_TRRRacer_networkFlux_helper(captivePortal = false) {
Assert.equal(racer._retryCount, 2);
let events =
await Glean.securityDohTrrPerformance.resolvedRecord.testGetValue();
events = events.filter(e => e.category == "security.doh.trr_performance");
let events = Services.telemetry.snapshotEvents(
Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS,
true
).parent;
Assert.ok(events);
events = events.filter(e => e[1] == "security.doh.trrPerformance");
Assert.equal(events.length, racer._aggregator.totalLookups);
Services.fog.testResetFOG();
Services.telemetry.clearEvents();
if (captivePortal) {
Services.obs.notifyObservers(null, "captive-portal-login-abort");
}
@@ -141,12 +145,15 @@ async function test_TRRRacer_maxRetries_helper(captivePortal = false) {
await deferred.promise;
Assert.equal(racer._retryCount, 5);
let events =
await Glean.securityDohTrrPerformance.resolvedRecord.testGetValue();
events = events.filter(e => e.category == "security.doh.trr_performance");
let events = Services.telemetry.snapshotEvents(
Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS,
true
).parent;
Assert.ok(events);
events = events.filter(e => e[1] == "security.doh.trrPerformance");
Assert.equal(events.length, racer._aggregator.totalLookups);
Services.fog.testResetFOG();
Services.telemetry.clearEvents();
if (captivePortal) {
Services.obs.notifyObservers(null, "captive-portal-login-abort");
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -9,7 +9,6 @@ const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
ActorManagerParent: "resource://gre/modules/ActorManagerParent.sys.mjs",
DoHController: "resource://gre/modules/DoHController.sys.mjs",
EventDispatcher: "resource://gre/modules/Messaging.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
// started up so the startup cache isn't rebuilt on next startup.
Services.startup.trackStartupCrashEnd();
lazy.DoHController.init();
break;
}
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
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
FINAL_TARGET_FILES.defaults.settings.main += [
"doh-config.json",
"doh-providers.json",
]
if CONFIG["MOZ_BUILD_APP"] == "browser":
DIST_SUBDIR = "browser"
# 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/captchadetection/metrics.yaml",
"toolkit/components/cookiebanners/metrics.yaml",
"toolkit/components/doh/metrics.yaml",
"toolkit/components/downloads/metrics.yaml",
"toolkit/components/enterprisepolicies/metrics.yaml",
"toolkit/components/extensions/metrics.yaml",
@@ -110,6 +109,7 @@ firefox_desktop_metrics = [
"browser/actors/metrics.yaml",
"browser/components/asrouter/metrics.yaml",
"browser/components/backup/metrics.yaml",
"browser/components/doh/metrics.yaml",
"browser/components/downloads/metrics.yaml",
"browser/components/firefoxview/metrics.yaml",
"browser/components/genai/metrics.yaml",

View File

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