From bcd7a6a95e7b16c62aff8c0385a0bb1c2052bd61 Mon Sep 17 00:00:00 2001 From: Dirk Steinmetz Date: Thu, 25 Jul 2024 21:19:31 +0200 Subject: [PATCH] cachingfix: remove obsolete experiment Recent versions of Thunderbird only permit to load modules from resource:// and chrome:// URIs, so the cachingfix experiment is no longer useful. If you relied on it, consider migrating to the ResourceUrl experiment aviailable in Thunderbird's add-on developer support repository at https://github.com/thundernest/addon-developer-support/ --- experiments/cachingfix/README.md | 28 -------------------- experiments/cachingfix/api.json | 6 ----- experiments/cachingfix/manifest-snippet.json | 13 --------- experiments/cachingfix/parent.js | 26 ------------------ 4 files changed, 73 deletions(-) delete mode 100644 experiments/cachingfix/README.md delete mode 100644 experiments/cachingfix/api.json delete mode 100644 experiments/cachingfix/manifest-snippet.json delete mode 100644 experiments/cachingfix/parent.js diff --git a/experiments/cachingfix/README.md b/experiments/cachingfix/README.md deleted file mode 100644 index f0f0d43..0000000 --- a/experiments/cachingfix/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# CachingFix - -This WebExtension Experiment helps with cache-related cleanup tasks when -disabling, uninstalling or updating the add-on. - -## Usage - -Copy the experiment into your add-on and add it to your manifest.json: -``` -{ - "experiment_apis": { - "ex_cachingfix": { - "schema": "experiments/cachingfix/api.json", - "parent": { - "scopes": ["addon_parent"], - "paths": [["ex_cachingfix"]], - "script": "experiments/cachingfix/parent.js", - "events": ["startup"] - } - } - } -} -``` - -After adding the experiment, you no longer need to unload JSMs loaded from -the WebExtension's rootURI (file://- or jar://-URLs) or invalidate the -startup cache by hand. You do not need to invoke the API in any way, the -experiment is activated automatically. diff --git a/experiments/cachingfix/api.json b/experiments/cachingfix/api.json deleted file mode 100644 index 9b6f3aa..0000000 --- a/experiments/cachingfix/api.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - { - "namespace": "ex_cachingfix", - "description": "This experiment automatically unloads all other experiment's JSMs and clears caches to enable correct update behavior. It does not need to get called in any way, just including it is sufficient." - } -] diff --git a/experiments/cachingfix/manifest-snippet.json b/experiments/cachingfix/manifest-snippet.json deleted file mode 100644 index 8605889..0000000 --- a/experiments/cachingfix/manifest-snippet.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "experiment_apis": { - "ex_cachingfix": { - "schema": "experiments/cachingfix/api.json", - "parent": { - "scopes": ["addon_parent"], - "paths": [["ex_cachingfix"]], - "script": "experiments/cachingfix/parent.js", - "events": ["startup"] - } - } - } -} diff --git a/experiments/cachingfix/parent.js b/experiments/cachingfix/parent.js deleted file mode 100644 index 454edc5..0000000 --- a/experiments/cachingfix/parent.js +++ /dev/null @@ -1,26 +0,0 @@ -var ex_cachingfix = class extends ExtensionCommon.ExtensionAPI { - onStartup() { - // we're not actually interested in startup, we need the event only - // to ensure this experiment gets loaded. - } - onShutdown(isAppShutdown) { - if (isAppShutdown) { - return; // the application gets unloaded anyway - } - // Unload JSMs of this add-on - const Cu = Components.utils; - const rootURI = this.extension.rootURI.spec; - for (let module of Cu.loadedModules) { - if (module.startsWith(rootURI)) { - Cu.unload(module); - } - } - // Clear caches that could prevent upgrades from working properly - const Services = globalThis.Services || - ChromeUtils.import("resource://gre/modules/Services.jsm").Services; - Services.obs.notifyObservers(null, "startupcache-invalidate", null); - } - getAPI(context) { - return {ex_cachingfix: {}}; - } -}; -- 2.43.2