JSLib Uninstall Problems

View: New views
2 Messages — Rating Filter:   Alert me  

JSLib Uninstall Problems

by pickel jones :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Greetings all,

Thanks for all the great work on JSLib; it provides a much needed JS scripting layer overtop FF/etc.

I'm having a slight issue related to the "jslibUninstall" function:

I'm using this function with a notification callback, eg:

jslibUninstall('packageName', Package_UninstallDone);

This works (callback is indeed executed), however when I attempt to perform post-uninstall cleanup within the notification callback, things go wrong.

Specifically, I'm attempting to modify some preferences settings on the *second* execution of the callback function (stage == true).  When I attempt this, the uninstall throws an exception and fails.

It seems to be related to the fact that the global variable 'Components' is no longer available on the second execution of this callback handler.  "Components" *is* available on the first execution of the callback.  See my callback code below:


function AlchemyTB_UninstallDone(filesList, stage)
{
    if (stage == true)
    {
        try
        {
            var prefs = Components.classes["@ mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
        }
        catch (e)
        {
        }
    }
}

Note, if i change the above to "if (stage == false)", it's able to retrieve the Preferences service.  Stage == true, no dice.

Is there something I need to do to access/reinitialize global objects like "Components" so they can be used within the second callback execution?  Otherwise, I don't see how it's possible to remove preferences after an uninstall has occurred.

Any help would be appreciated, many thanks !



_______________________________________________
Jslib mailing list
Jslib@...
http://mozdev.org/mailman/listinfo/jslib

Re: JSLib Uninstall Problems

by Pete Collins :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


>
>
> Is there something I need to do to access/reinitialize global objects
> like "Components" so they can be used within the second callback
> execution?  Otherwise, I don't see how it's possible to remove
> preferences after an uninstall has occurred.
>
> Any help would be appreciated, many thanks !


If you notice, uninstall was written back in 2003 when there was no way
to uninstall an xpi package. It was written for the old seamonkey
mozilla suite.

If you are using Firefox, it is not recommended you use uninstall as the
installation architecture has changed a lot since.

You can uninstall via script using Extension Manager interfaces ...

If you have some global prefs you wish to remove, you can add a listener
that will notify you when your extension is being uninstalled, but prefs
these days are usually set in the extensions bundled prefs file which is
removed when the add-on is uninstalled.

--pete

--
Pete Collins - Founder, Mozdev Group Inc.
www.mozdevgroup.com
Mozilla Software Development Solutions
tel: 1-719-302-5811
fax: 1-719-302-5813

_______________________________________________
Jslib mailing list
Jslib@...
http://mozdev.org/mailman/listinfo/jslib
LightInTheBox - Buy quality products at wholesale price