Bug 1744021 - force the update prefs to be disabled for at least one second when changing them, r=bytesized,preferences-reviewers,mstriemer

Differential Revision: https://phabricator.services.mozilla.com/D132959
This commit is contained in:
Gijs Kruitbosch
2021-12-10 21:25:00 +00:00
parent 165e7c0cbe
commit ce071daaba

View File

@@ -1765,6 +1765,7 @@ var gMainPane = {
}
},
_minDisableTime: 1000,
/**
* Selects the correct item in the update radio group
*/
@@ -1796,14 +1797,20 @@ var gMainPane = {
) {
let radiogroup = document.getElementById("updateRadioGroup");
let updateAutoValue = radiogroup.value == "true";
let _disableTimeOverPromise = new Promise(r =>
setTimeout(r, this._minDisableTime)
);
radiogroup.disabled = true;
try {
await UpdateUtils.setAppUpdateAutoEnabled(updateAutoValue);
await _disableTimeOverPromise;
radiogroup.disabled = false;
} catch (error) {
Cu.reportError(error);
await this.readUpdateAutoPref();
await this.reportUpdatePrefWriteError(error);
await Promise.all([
this.readUpdateAutoPref(),
this.reportUpdatePrefWriteError(error),
]);
return;
}