Need a way to unload/reload JavaScript modules (JSM)

RESOLVED DUPLICATE of bug 481603

Status

()

--
enhancement
RESOLVED DUPLICATE of bug 481603
9 years ago
8 years ago

People

(Reporter: gaubugzilla, Unassigned)

Tracking

(Blocks: 1 bug)

Trunk
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [rewrite])

Attachments

(1 attachment)

(Reporter)

Description

9 years ago
Bootstrapped add-ons are supposed to revert everything when they are shut down. This is not possible in case of JavaScript modules however - once the JavaScript modules of the add-on are loaded there is no way to remove them from memory. At the moment I am simply telling these modules to play dead but this will most likely not be sufficient when updating the add-on.
Whiteboard: [rewrite]

Comment 1

8 years ago
This bug is somewhat similar to Bug 535010 - [Enh] Reloading of JS Modules, as a reload is nothing but unload and import again.

Comment 2

8 years ago
Similar enough to call them the same issue for the purposes of this bug.
Summary: Need a way to unload JavaScript modules → Need a way to unload/reload JavaScript modules (JSM)

Updated

8 years ago
Duplicate of this bug: 535010

Comment 4

8 years ago
This bug is similar to Bug 481603 - Add a means to refresh code modules.

Comment 5

8 years ago
Created attachment 508116 [details]
Example of reloadable/deletable jsm content

Since I found little discussion about this issue, here's a tip that circumvents this bug until it is fixed on the API level. It can be used by restartless addons to actually wipe out and then reload any substantial jsm content, or by chrome addons for live jsm refreshes. In order to do this, note that non-exposed jsm content is not sealed and can be easily deleted as well as reloaded with subscript loader. The two small routines implementing this should be defined inside jsm and exposed via a simple maintenance interface. Since exported objects are not effectively mutable, they should only be used in this scenario for providing javascript getters for the clients to access internal, updatable/deletable, 'true' objects. There are minor limitations and inconveniences to this approach, but if you really need the jsm cleanup and refresh functionality now, it should deliver, for all practical reasons.
See working commented example in attachment.
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 481603
You need to log in before you can comment on or make changes to this bug.