I noticed an occasional error logged on disabling the bootstrapped addon.
function shutdown:
function shutdown(data, reason) {
forEachOpenWindow(unloadFromWindow);
Services.wm.removeListener(WindowListener);
Components.utils.unload('chrome://myaddon/content/main.jsm');
}
Sometimes, it came up with an error on disabling the addon:
NotFoundError: Node was not found main.jsm:112
Is it that the Components.utils.unload()
is asynchronous?
1- Is that the case or is it due to some other issue?
2- If that is the case, how should it be dealt with?
3- Can the Components.utils.unload()
be added to (processed in) the JSM that it is removing (removing itself)?
4- Any other suggestions?
Update:
Next test:
Disable -- no error
Enable/Disable -- 1 error (above)
Enable/Disable -- 2 error (above)
Enable/Disable -- 3 error (above)
Enable/Disable -- 4 error (above)
Enable/Disable -- 5 error (above)
Now that is strange ....
Update 2:
I found the problem.... typo/error in one of the listeners so it was NOT removed on shutdown()
and with every subsequent enable/disable one more listeners was added...that was why the number of errors increased each time :)