Backed out changeset 28a9e4b075af (bug 1613659) for doh-rollout related failures CLOSED TREE

This commit is contained in:
Bogdan Tara 2020-02-06 21:54:47 +02:00
Родитель 0a7e661a03
Коммит 3f6cc7f3b5
3 изменённых файлов: 14 добавлений и 143 удалений

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

@ -617,39 +617,21 @@ const setup = {
) {
rollout.init();
} else {
log("Disabled, aborting!");
log(
"Disabled, aborting! Watching `doh-rollout.enabled` pref for change event"
);
// Listen for changes to the enabled pref. TODO: Also listen after init
// and properly handle the value of enabled changing to false.
browser.experiments.preferences.onPrefChanged.addListener(
function listener() {
browser.experiments.preferences.onPrefChanged.removeListener(
listener
);
setup.start();
}
);
}
},
};
log("Watching `doh-rollout.enabled` pref");
browser.experiments.preferences.onPrefChanged.addListener(async () => {
let enabled = await rollout.getSetting(DOH_ENABLED_PREF, false);
if (enabled) {
setup.start();
} else {
// Reset the TRR mode if we were running normally with no user-interference.
if (await stateManager.shouldRunHeuristics()) {
await stateManager.setState("disabled");
}
// Remove our listeners.
browser.networkStatus.onConnectionChanged.removeListener(
rollout.onConnectionChanged
);
try {
browser.captivePortal.onStateChange.removeListener(
rollout.onCaptiveStateChanged
);
} catch (e) {
// Captive Portal Service is disabled.
}
}
});
rollout.getSetting(DOH_ENABLED_PREF, false).then(enabled => {
if (enabled) {
setup.start();
}
});
setup.start();

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

@ -8,5 +8,4 @@ skip-if = debug # Bug 1548006 - reloading an addon upsets the leak checker.
[browser_doorhanger_newProfile.js]
[browser_policyOverride.js]
skip-if = (!debug && bits == 64) #Bug 1605297
[browser_rollback.js]
[browser_userInterference.js]

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

@ -1,110 +0,0 @@
"use strict";
add_task(setup);
add_task(async function testRollback() {
// Set up a passing environment and enable DoH.
setPassingHeuristics();
let promise = waitForDoorhanger();
Preferences.set(prefs.DOH_ENABLED_PREF, true);
await BrowserTestUtils.waitForCondition(() => {
return Preferences.get(prefs.DOH_SELF_ENABLED_PREF);
});
is(Preferences.get(prefs.DOH_SELF_ENABLED_PREF), true, "Breadcrumb saved.");
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, EXAMPLE_URL);
let panel = await promise;
is(
Preferences.get(prefs.DOH_DOORHANGER_SHOWN_PREF),
undefined,
"Doorhanger shown pref undefined before user interaction."
);
// Click the doorhanger's "accept" button.
let button = panel.querySelector(".popup-notification-primary-button");
promise = BrowserTestUtils.waitForEvent(panel, "popuphidden");
EventUtils.synthesizeMouseAtCenter(button, {});
await promise;
await ensureTRRMode(2);
await checkHeuristicsTelemetry("enable_doh", "startup");
await BrowserTestUtils.waitForCondition(() => {
return Preferences.get(prefs.DOH_DOORHANGER_SHOWN_PREF);
});
is(
Preferences.get(prefs.DOH_DOORHANGER_SHOWN_PREF),
true,
"Doorhanger shown pref saved."
);
is(
Preferences.get(prefs.DOH_DOORHANGER_USER_DECISION_PREF),
"UIOk",
"Doorhanger decision saved."
);
is(
Preferences.get(prefs.DOH_SELF_ENABLED_PREF),
true,
"Breadcrumb not cleared."
);
BrowserTestUtils.removeTab(tab);
// Change the environment to failing and simulate a network change.
setFailingHeuristics();
simulateNetworkChange();
await ensureTRRMode(0);
await checkHeuristicsTelemetry("disable_doh", "netchange");
// Trigger another network change.
simulateNetworkChange();
await ensureNoTRRModeChange(0);
await checkHeuristicsTelemetry("disable_doh", "netchange");
// Rollback!
setPassingHeuristics();
Preferences.reset(prefs.DOH_ENABLED_PREF);
await ensureTRRMode(0);
simulateNetworkChange();
await ensureNoTRRModeChange(0);
await ensureNoHeuristicsTelemetry();
// Re-enable.
Preferences.set(prefs.DOH_ENABLED_PREF, true);
await ensureTRRMode(2);
await checkHeuristicsTelemetry("enable_doh", "startup");
// Change the environment to failing and simulate a network change.
setFailingHeuristics();
simulateNetworkChange();
await ensureTRRMode(0);
await checkHeuristicsTelemetry("disable_doh", "netchange");
// Rollback again for good measure! This time with failing heuristics.
Preferences.reset(prefs.DOH_ENABLED_PREF);
await ensureTRRMode(0);
simulateNetworkChange();
await ensureNoTRRModeChange(0);
await ensureNoHeuristicsTelemetry();
// Re-enable.
Preferences.set(prefs.DOH_ENABLED_PREF, true);
await ensureTRRMode(0);
await checkHeuristicsTelemetry("disable_doh", "startup");
// Change the environment to passing and simulate a network change.
setPassingHeuristics();
simulateNetworkChange();
await ensureTRRMode(2);
await checkHeuristicsTelemetry("enable_doh", "netchange");
// Rollback again, this time with TRR mode set to 2 prior to doing so.
Preferences.reset(prefs.DOH_ENABLED_PREF);
await ensureTRRMode(0);
simulateNetworkChange();
await ensureNoTRRModeChange(0);
await ensureNoHeuristicsTelemetry();
});