summaryrefslogtreecommitdiff
path: root/toolkit/mozapps/extensions/internal/XPIProvider.jsm
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2023-07-07 19:41:06 +0200
committerMoonchild <moonchild@palemoon.org>2023-07-07 19:41:06 +0200
commitea9077a8a5fd8b9f7d5397d18e84aa20fb87f406 (patch)
tree64c21104a540df2812482dcc520952869db04ebf /toolkit/mozapps/extensions/internal/XPIProvider.jsm
parentb4af6b6265ed489acbc3dc5a2fd9d4ed7f783b13 (diff)
parentaf5dbfc12003e61f21d2a7c71f239d18ae3945cf (diff)
downloaduxp-0515adfd4794b530246b180804d8f01fc4bfae72.tar.gz
Merge branch 'master' into releaseRC_20230707RB_20230711
Diffstat (limited to 'toolkit/mozapps/extensions/internal/XPIProvider.jsm')
-rw-r--r--toolkit/mozapps/extensions/internal/XPIProvider.jsm121
1 files changed, 11 insertions, 110 deletions
diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
index add3f3d727..4249e3a0bd 100644
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -196,12 +196,10 @@ const TYPES = {
locale: 8,
multipackage: 32,
dictionary: 64,
- experiment: 128,
};
const RESTARTLESS_TYPES = new Set([
"dictionary",
- "experiment",
"locale",
]);
@@ -943,30 +941,13 @@ function loadManifestFromRDF(aUri, aStream) {
if (addon.type == "theme") {
addon.userDisabled = !!LightweightThemeManager.currentTheme ||
addon.internalName != XPIProvider.selectedSkin;
- }
- // Experiments are disabled by default. It is up to the Experiments Manager
- // to enable them (it drives installation).
- else if (addon.type == "experiment") {
- addon.userDisabled = true;
- }
- else {
+ } else {
addon.userDisabled = false;
addon.softDisabled = addon.blocklistState == Blocklist.STATE_SOFTBLOCKED;
}
addon.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DEFAULT;
- // Experiments are managed and updated through an external "experiments
- // manager." So disable some built-in mechanisms.
- if (addon.type == "experiment") {
- addon.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DISABLE;
- addon.updateURL = null;
- addon.updateKey = null;
-
- addon.targetApplications = [];
- addon.targetPlatforms = [];
- }
-
// Load the storage service before NSS (nsIRandomGenerator),
// to avoid a SQLite initialization error (bug 717904).
let storage = Services.storage;
@@ -1827,8 +1808,6 @@ this.XPIProvider = {
// Keep track of the newest file in each add-on, in case we want to
// report it.
_mostRecentlyModifiedFile: {},
- // Experiments are disabled by default. Track ones that are locally enabled.
- _enabledExperiments: null,
// A Map from an add-on install to its ID
_addonFileMap: new Map(),
#ifdef MOZ_DEVTOOLS
@@ -2002,8 +1981,6 @@ this.XPIProvider = {
this.installLocationsByName = {};
// Hook for tests to detect when saving database at shutdown time fails
this._shutdownError = null;
- // Clear the set of enabled experiments (experiments disabled by default).
- this._enabledExperiments = new Set();
let hasRegistry = ("nsIWindowsRegKey" in Ci);
@@ -2316,19 +2293,8 @@ this.XPIProvider = {
* Persists changes to XPIProvider.bootstrappedAddons to its store (a pref).
*/
persistBootstrappedAddons: function XPI_persistBootstrappedAddons() {
- // Experiments are disabled upon app load, so don't persist references.
- let filtered = {};
- for (let id in this.bootstrappedAddons) {
- let entry = this.bootstrappedAddons[id];
- if (entry.type == "experiment") {
- continue;
- }
-
- filtered[id] = entry;
- }
-
Services.prefs.setCharPref(PREF_BOOTSTRAP_ADDONS,
- JSON.stringify(filtered));
+ JSON.stringify(this.bootstrappedAddons));
},
/**
@@ -4486,15 +4452,11 @@ this.XPIProvider = {
let appDisabledChanged = aAddon.appDisabled != appDisabled;
// Update the properties in the database.
- // We never persist this for experiments because the disabled flags
- // are controlled by the Experiments Manager.
- if (aAddon.type != "experiment") {
- XPIDatabase.setAddonProperties(aAddon, {
- userDisabled: aUserDisabled,
- appDisabled: appDisabled,
- softDisabled: aSoftDisabled
- });
- }
+ XPIDatabase.setAddonProperties(aAddon, {
+ userDisabled: aUserDisabled,
+ appDisabled: appDisabled,
+ softDisabled: aSoftDisabled
+ });
if (appDisabledChanged) {
AddonManagerPrivate.callAddonListeners("onPropertyChanged",
@@ -6383,17 +6345,6 @@ AddonInternal.prototype = {
},
isCompatibleWith: function AddonInternal_isCompatibleWith(aAppVersion, aPlatformVersion) {
- // Experiments are installed through an external mechanism that
- // limits target audience to compatible clients. We trust it knows what
- // it's doing and skip compatibility checks.
- //
- // This decision does forfeit defense in depth. If the experiments system
- // is ever wrong about targeting an add-on to a specific application
- // or platform, the client will likely see errors.
- if (this.type == "experiment") {
- return true;
- }
-
let app = this.matchingTargetApplication;
if (!app)
return false;
@@ -6607,13 +6558,6 @@ AddonInternal.prototype = {
if (!(this.inDatabase))
return permissions;
- // Experiments can only be uninstalled. An uninstall reflects the user
- // intent of "disable this experiment." This is partially managed by the
- // experiments manager.
- if (this.type == "experiment") {
- return AddonManager.PERM_CAN_UNINSTALL;
- }
-
if (!this.appDisabled) {
if (this.userDisabled || this.softDisabled) {
permissions |= AddonManager.PERM_CAN_ENABLE;
@@ -6876,11 +6820,6 @@ function AddonWrapper(aAddon) {
return aAddon.applyBackgroundUpdates;
});
this.__defineSetter__("applyBackgroundUpdates", function AddonWrapper_applyBackgroundUpdatesSetter(val) {
- if (this.type == "experiment") {
- logger.warn("Setting applyBackgroundUpdates on an experiment is not supported.");
- return;
- }
-
if (val != AddonManager.AUTOUPDATE_DEFAULT &&
val != AddonManager.AUTOUPDATE_DISABLE &&
val != AddonManager.AUTOUPDATE_ENABLE) {
@@ -6945,15 +6884,10 @@ function AddonWrapper(aAddon) {
return AddonManager.PENDING_UNINSTALL;
}
- // Extensions have an intentional inconsistency between what the DB says is
- // enabled and what we say to the ouside world. so we need to cover up that
- // lie here as well.
- if (aAddon.type != "experiment") {
- if (aAddon.active && aAddon.disabled)
- pending |= AddonManager.PENDING_DISABLE;
- else if (!aAddon.active && !aAddon.disabled)
- pending |= AddonManager.PENDING_ENABLE;
- }
+ if (aAddon.active && aAddon.disabled)
+ pending |= AddonManager.PENDING_DISABLE;
+ else if (!aAddon.active && !aAddon.disabled)
+ pending |= AddonManager.PENDING_ENABLE;
if (aAddon.pendingUpgrade)
pending |= AddonManager.PENDING_UPGRADE;
@@ -6990,10 +6924,6 @@ function AddonWrapper(aAddon) {
});
this.__defineGetter__("userDisabled", function AddonWrapper_userDisabledGetter() {
- if (XPIProvider._enabledExperiments.has(aAddon.id)) {
- return false;
- }
-
return aAddon.softDisabled || aAddon.userDisabled;
});
this.__defineSetter__("userDisabled", function AddonWrapper_userDisabledSetter(val) {
@@ -7001,14 +6931,6 @@ function AddonWrapper(aAddon) {
return val;
}
- if (aAddon.type == "experiment") {
- if (val) {
- XPIProvider._enabledExperiments.delete(aAddon.id);
- } else {
- XPIProvider._enabledExperiments.add(aAddon.id);
- }
- }
-
if (aAddon.inDatabase) {
if (aAddon.type == "theme" && val) {
if (aAddon.internalName == XPIProvider.defaultSkin)
@@ -7066,14 +6988,6 @@ function AddonWrapper(aAddon) {
};
this.findUpdates = function AddonWrapper_findUpdates(aListener, aReason, aAppVersion, aPlatformVersion) {
- // Short-circuit updates for experiments because updates are handled
- // through the Experiments Manager.
- if (this.type == "experiment") {
- AddonManagerPrivate.callNoUpdateListeners(this, aListener, aReason,
- aAppVersion, aPlatformVersion);
- return;
- }
-
new UpdateChecker(aAddon, aListener, aReason, aAppVersion, aPlatformVersion);
};
@@ -7810,17 +7724,4 @@ var addonTypes = [
AddonManager.TYPE_UI_HIDE_EMPTY | AddonManager.TYPE_SUPPORTS_UNDO_RESTARTLESS_UNINSTALL),
];
-// We only register experiments support if the application supports them.
-// Ideally, we would install an observer to watch the pref. Installing
-// an observer for this pref is not necessary here and may be buggy with
-// regards to registering this XPIProvider twice.
-if (Preferences.get("experiments.supported", false)) {
- addonTypes.push(
- new AddonManagerPrivate.AddonType("experiment",
- URI_EXTENSION_STRINGS,
- STRING_TYPE_NAME,
- AddonManager.VIEW_TYPE_LIST, 11000,
- AddonManager.TYPE_UI_HIDE_EMPTY | AddonManager.TYPE_SUPPORTS_UNDO_RESTARTLESS_UNINSTALL));
-}
-
AddonManagerPrivate.registerProvider(XPIProvider, addonTypes);