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