зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1637680 - Make softDisable setter async. r=mixedpuppy
Some tests rely on the order of execution of the blocklist code which cannot be guaranteed if we don't wait for the enabled state to settle. In particular, when calling `_onUpdate` in `AddonTestUtils.loadBlocklistRawData` in [0] we implicitely assume that all the actions deriving from updating the blocklist settle before the promise is completed, this is not true for the enabled state. Currently the test succedes because `ExtensionPermissions.get` is not actually async in most cases, this is about to change in the next patch. [0]: https://searchfox.org/mozilla-central/rev/559b25eb41c1cbffcb90a34e008b8288312fcd25/toolkit/mozapps/extensions/internal/AddonTestUtils.jsm#925 Differential Revision: https://phabricator.services.mozilla.com/D77937
This commit is contained in:
Родитель
4472fb097a
Коммит
98b2209e91
|
@ -1219,7 +1219,7 @@ this.ExtensionBlocklistRS = {
|
|||
|
||||
// Ensure that softDisabled is false if the add-on is not soft blocked
|
||||
if (state != Ci.nsIBlocklistService.STATE_SOFTBLOCKED) {
|
||||
addon.softDisabled = false;
|
||||
await addon.setSoftDisabled(false);
|
||||
}
|
||||
|
||||
// If an add-on has dropped from hard to soft blocked just mark it as
|
||||
|
@ -1228,7 +1228,7 @@ this.ExtensionBlocklistRS = {
|
|||
state == Ci.nsIBlocklistService.STATE_SOFTBLOCKED &&
|
||||
oldState == Ci.nsIBlocklistService.STATE_BLOCKED
|
||||
) {
|
||||
addon.softDisabled = true;
|
||||
await addon.setSoftDisabled(true);
|
||||
}
|
||||
|
||||
if (
|
||||
|
@ -1243,7 +1243,7 @@ this.ExtensionBlocklistRS = {
|
|||
state == Ci.nsIBlocklistService.STATE_SOFTBLOCKED &&
|
||||
!addon.userDisabled
|
||||
) {
|
||||
addon.softDisabled = true;
|
||||
await addon.setSoftDisabled(true);
|
||||
}
|
||||
// It's a block. We must reset certain preferences.
|
||||
let entry = this._getEntry(addon, this._entries);
|
||||
|
@ -1579,7 +1579,7 @@ this.ExtensionBlocklistMLBF = {
|
|||
// Ensure that softDisabled is false if the add-on is not soft blocked
|
||||
// (by a previous implementation of the blocklist).
|
||||
if (state != Ci.nsIBlocklistService.STATE_SOFTBLOCKED) {
|
||||
addon.softDisabled = false;
|
||||
await addon.setSoftDisabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -607,7 +607,7 @@ class AddonInternal {
|
|||
}
|
||||
|
||||
if (this.inDatabase && updateDatabase) {
|
||||
XPIDatabase.updateAddonDisabledState(this, {
|
||||
await XPIDatabase.updateAddonDisabledState(this, {
|
||||
userDisabled,
|
||||
softDisabled,
|
||||
});
|
||||
|
@ -1163,7 +1163,7 @@ AddonWrapper = class {
|
|||
return addonFor(this).setUserDisabled(true, allowSystemAddons);
|
||||
}
|
||||
|
||||
set softDisabled(val) {
|
||||
async setSoftDisabled(val) {
|
||||
let addon = addonFor(this);
|
||||
if (val == addon.softDisabled) {
|
||||
return val;
|
||||
|
@ -1173,10 +1173,14 @@ AddonWrapper = class {
|
|||
// When softDisabling a theme just enable the active theme
|
||||
if (addon.type === "theme" && val && !addon.userDisabled) {
|
||||
if (addon.isWebExtension) {
|
||||
XPIDatabase.updateAddonDisabledState(addon, { softDisabled: val });
|
||||
await XPIDatabase.updateAddonDisabledState(addon, {
|
||||
softDisabled: val,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
XPIDatabase.updateAddonDisabledState(addon, { softDisabled: val });
|
||||
await XPIDatabase.updateAddonDisabledState(addon, {
|
||||
softDisabled: val,
|
||||
});
|
||||
}
|
||||
} else if (!addon.userDisabled) {
|
||||
// Only set softDisabled if not already disabled
|
||||
|
|
Загрузка…
Ссылка в новой задаче