/
parent.js
26 lines (26 loc) · 883 Bytes
/
parent.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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: {}};
}
};