I would like to use the following code in an extension:
try
{
Components.utils.import("resource://gre/modules/AddonManager.jsm");
AddonManager.addAddonListener(NFuninstallObserver);
}
catch(e) {}
Unfortunately, JavaScript in Firefox 1.5 considers the third line a syntax error and doesn't process any of the code.
I can replace the line with
eval('Components.utils.import("resource://gre/modules/AddonManager.jsm");');
and everything works fine. Any other suggestions, besides giving up my desire to keep the extension working in Firefox 1.5-4.0.*?