Backed out changeset fccbbed6fc57 (bug 1662430) for Browser-chrome failures in preferences/tests/browser_connection_dnsoverhttps.js. CLOSED TREE

This commit is contained in:
Dorel Luca 2020-09-24 15:04:39 +03:00
Родитель 1e813d19c8
Коммит 3fb0a8d9e1
6 изменённых файлов: 18 добавлений и 63 удалений

Просмотреть файл

@ -1959,9 +1959,6 @@ pref("doh-rollout.provider-steering.enabled", false);
// DoH Rollout: provider details for automatic steering.
pref("doh-rollout.provider-steering.provider-list", "[{ \"name\": \"comcast\", \"canonicalName\": \"doh-discovery.xfinity.com\", \"uri\": \"https://doh.xfinity.com/dns-query\" }]");
// DoH Rollout: whether to clear the mode value at shutdown.
pref("doh-rollout.clearModeOnShutdown", true);
// URL for Learn More link for browser error logging in preferences
pref("browser.chrome.errorReporter.infoURL",
"https://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/nightly-error-collection");

Просмотреть файл

@ -69,10 +69,6 @@ const DISABLED_PREF = "doh-rollout.disable-heuristics";
// tells us to disable it. This pref's effect is to suppress the opt-out CFR.
const SKIP_HEURISTICS_PREF = "doh-rollout.skipHeuristicsCheck";
// Whether to clear doh-rollout.mode on shutdown. When false, the mode value
// that exists at shutdown will be used at startup until heuristics re-run.
const CLEAR_ON_SHUTDOWN_PREF = "doh-rollout.clearModeOnShutdown";
const BREADCRUMB_PREF = "doh-rollout.self-enabled";
// Necko TRR prefs to watch for user-set values.
@ -144,7 +140,7 @@ const DoHController = {
}
this._asyncShutdownBlocker = async () => {
await this.disableHeuristics("shutdown");
await this.disableHeuristics();
};
AsyncShutdown.profileBeforeChange.addBlocker(
@ -162,7 +158,7 @@ const DoHController = {
Preferences.ignore(NETWORK_TRR_MODE_PREF, this);
Preferences.ignore(NETWORK_TRR_URI_PREF, this);
AsyncShutdown.profileBeforeChange.removeBlocker(this._asyncShutdownBlocker);
await this.disableHeuristics("shutdown");
await this.disableHeuristics();
},
// Called to reset state when a new config is available.
@ -419,14 +415,10 @@ const DoHController = {
case "UIDisabled":
Preferences.reset(BREADCRUMB_PREF);
// Fall through.
case "shutdown":
case "rollback":
Preferences.reset(ROLLOUT_MODE_PREF);
break;
case "shutdown":
if (Preferences.get(CLEAR_ON_SHUTDOWN_PREF, true)) {
Preferences.reset(ROLLOUT_MODE_PREF);
}
break;
}
Services.telemetry.recordEvent(
@ -437,20 +429,20 @@ const DoHController = {
);
},
async disableHeuristics(state) {
await this.setState(state);
async disableHeuristics() {
if (!this._heuristicsAreEnabled) {
return;
}
await this.setState("shutdown");
Services.obs.removeObserver(this, kLinkStatusChangedTopic);
Services.obs.removeObserver(this, kConnectivityTopic);
this._heuristicsAreEnabled = false;
},
async rollback() {
await this.disableHeuristics("rollback");
await this.setState("rollback");
await this.disableHeuristics();
},
async runTRRSelection() {
@ -549,8 +541,9 @@ const DoHController = {
switch (pref) {
case NETWORK_TRR_URI_PREF:
case NETWORK_TRR_MODE_PREF:
await this.setState("manuallyDisabled");
Preferences.set(DISABLED_PREF, true);
await this.disableHeuristics("manuallyDisabled");
await this.disableHeuristics();
break;
}
},

Просмотреть файл

@ -75,13 +75,4 @@ add_task(async function testCleanFlow() {
simulateNetworkChange();
await ensureNoTRRModeChange(2);
await checkHeuristicsTelemetry("enable_doh", "netchange");
// Test the clearModeOnShutdown pref. `restartDoHController` does the actual
// test for us between shutdown and startup.
Preferences.set(prefs.CLEAR_ON_SHUTDOWN_PREF, false);
await restartDoHController();
ensureNoTRRSelectionTelemetry();
await ensureNoTRRModeChange(2);
await checkHeuristicsTelemetry("enable_doh", "startup");
Preferences.reset(prefs.CLEAR_ON_SHUTDOWN_PREF);
});

Просмотреть файл

@ -64,7 +64,7 @@ add_task(async function testRollback() {
// Rollback!
setPassingHeuristics();
Preferences.reset(prefs.ENABLED_PREF);
await waitForStateTelemetry(["rollback"]);
await waitForStateTelemetry(["rollback", "shutdown"]);
await ensureTRRMode(undefined);
ensureNoTRRSelectionTelemetry();
await ensureNoHeuristicsTelemetry();
@ -87,7 +87,7 @@ add_task(async function testRollback() {
// Rollback again for good measure! This time with failing heuristics.
Preferences.reset(prefs.ENABLED_PREF);
await waitForStateTelemetry(["rollback"]);
await waitForStateTelemetry(["rollback", "shutdown"]);
await ensureTRRMode(undefined);
ensureNoTRRSelectionTelemetry();
await ensureNoHeuristicsTelemetry();
@ -110,7 +110,7 @@ add_task(async function testRollback() {
// Rollback again, this time with TRR mode set to 2 prior to doing so.
Preferences.reset(prefs.ENABLED_PREF);
await waitForStateTelemetry(["rollback"]);
await waitForStateTelemetry(["rollback", "shutdown"]);
await ensureTRRMode(undefined);
ensureNoTRRSelectionTelemetry();
await ensureNoHeuristicsTelemetry();

Просмотреть файл

@ -46,7 +46,6 @@ const prefs = {
DOORHANGER_USER_DECISION_PREF: "doh-rollout.doorhanger-decision",
DISABLED_PREF: "doh-rollout.disable-heuristics",
SKIP_HEURISTICS_PREF: "doh-rollout.skipHeuristicsCheck",
CLEAR_ON_SHUTDOWN_PREF: "doh-rollout.clearModeOnShutdown",
FIRST_RUN_PREF: "doh-rollout.doneFirstRun",
BALROG_MIGRATION_PREF: "doh-rollout.balrog-migration-done",
PREVIOUS_TRR_MODE_PREF: "doh-rollout.previous.trr.mode",
@ -90,16 +89,6 @@ async function setup() {
// controlled e.g. via Normandy, but for testing let's enable.
Preferences.set(prefs.PROVIDER_STEERING_PREF, true);
// Check that the default value of the clearModeOnShutdown pref is true. This
// forces us to update tests in the future if/when we change the defaut. When
// the time comes, browser_cleanFlow.js needs to be updated to test when this
// pref is true. Currently since the default is true, it tests the false case.
is(
Preferences.get(prefs.CLEAR_ON_SHUTDOWN_PREF),
true,
"Clear mode on shutdown is enabled."
);
// Set up heuristics, all passing by default.
// Google safesearch overrides
@ -240,15 +229,7 @@ async function waitForStateTelemetry(expectedStates) {
}
async function restartDoHController() {
let oldMode = Preferences.get(prefs.ROLLOUT_TRR_MODE_PREF);
await DoHController._uninit();
let newMode = Preferences.get(prefs.ROLLOUT_TRR_MODE_PREF);
let expectClear = Preferences.get(prefs.CLEAR_ON_SHUTDOWN_PREF);
is(
newMode,
expectClear ? undefined : oldMode,
`Mode was ${expectClear ? "cleared" : "persisted"} on shutdown.`
);
await DoHController.init();
}

Просмотреть файл

@ -84,27 +84,20 @@ async function testWithProperties(props, startTime) {
": testWithProperties: testing with " +
JSON.stringify(props)
);
// There are two different signals that the DoHController is ready, depending
// on the config being tested. If we're setting the TRR mode pref, we should
// expect the disable-heuristics pref to be set as the signal. Else, we can
// expect the self-enabled pref as the signal.
let rolloutReadyPromise;
let rolloutReadyPref = ROLLOUT_SELF_ENABLED_PREF;
if (props.hasOwnProperty(TRR_MODE_PREF)) {
if ([2, 3, 5].includes(props[TRR_MODE_PREF])) {
rolloutReadyPromise = waitForPrefObserver(HEURISTICS_DISABLED_PREF);
}
Services.prefs.setIntPref(TRR_MODE_PREF, props[TRR_MODE_PREF]);
}
if (!rolloutReadyPromise) {
rolloutReadyPromise = waitForPrefObserver(ROLLOUT_SELF_ENABLED_PREF);
if ([2, 3, 5].includes(props[TRR_MODE_PREF])) {
rolloutReadyPref = HEURISTICS_DISABLED_PREF;
}
}
if (props.hasOwnProperty(ROLLOUT_ENABLED_PREF)) {
let prefPromise = waitForPrefObserver(rolloutReadyPref);
Services.prefs.setBoolPref(
ROLLOUT_ENABLED_PREF,
props[ROLLOUT_ENABLED_PREF]
);
await rolloutReadyPromise;
await prefPromise;
}
if (props.hasOwnProperty(TRR_CUSTOM_URI_PREF)) {
Services.prefs.setStringPref(