Mircea
Mircea

Reputation: 11623

Updating Firefox addon jsm module code without browser restart

I am developing a Firefox addon that is loaded from a directory instead of an xpi, Firefox extension proxy file. The extension is based on jsm modules.

Is there a way to update those modules to reflect the code changes. The only way to do it now is to close and restart the browser but that its not a sane way to develop anything.

Tried to:

    Components.utils.unload('resource://myextension/mymodule.jsm');
    Components.utils.import('resource://myextension/mymodule.jsm');

but changes are not made.

Upvotes: 2

Views: 174

Answers (1)

Mircea
Mircea

Reputation: 11623

Got the answer from Victor Porof. In order to make this work you need to clear first the cache:

var obs = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
obs.notifyObservers(null, "startupcache-invalidate", null);

Hope this helps anyone

Upvotes: 1

Related Questions