Home  |  Blog Help Out  |  How-To Guides  |  Why Use Mozilla  |  About Jeremy

Extensions

Contact
Jeremy Gillick

Get Firefox!

ExtensionUninstaller API Technical Documentation

< BACK | INDEX | NEXT >

Using the ExtensionUninstaller API

The API is written to do most of the work for you. All you need to do is supply the application's chrome URI. The chrome URI is what you specify in the contents.rdf as the main "about" attibute. It starts with "urn:mozilla:package:" and is followed by the application's name. For example, the SwitchProxy chrome URI is "urn:mozilla:package:switchproxy"

Let's start by showing an example, then explaining what it does.

1: var oExtUninstall = new ExtensionUninstall("urn:mozilla:package:switchproxy"); 2: var success = oExtUninstall.uninstall(); 3: oExtUninstall.showLogDialog(true, opener); Line 1:

Initialize the ExtensionUninstall object with the application's chrome uri

Line 2:

Uninstall the application. This will return "true" or "false", weather the uninstall was successful or not.

Line 3

Opens the built-in API's log tree dialog. Setting the first argument to true makes the dialog modal. The second argument tells the API where to open the dialog from (what object to call "openDialog()" from) You don't have to use the internal log dialog, you can retrieve the logs yourself and display as you see fit.

Final Note

You should also have some good user interaction here as well. It's important to ask the user if they are really sure they want to uninstall it, and to let them know if it was successful or not.


< BACK | INDEX | NEXT >



Copyright © 2004 Jeremy Gillick, All rights reserved
All the content and code presented on this site is owned solely by Jeremy Gillick