> nsIRegistry understands the format of the version registry, but there is
not
> enough information stored there (unlike Communicator) for you to perform
an
> uninstall.  In order to be able to uninstall we have to log the actions we
> have taken somewhere. The registry performance was too slow and we don't
> need random access to the data anyway, so a streamed logfile of some kind
> should suffice.

Thanks for your answer, Dan. You are right. My motivation here was to have
one special uninstall.js for each package to provide the processing
instructions for uninstalling the package. This is intended for an interim
solution until mozilla provides a more generic mechanism.

The uninstall.js should provide the functionality for the following tasks:
- Delete all files and archives that belongs to the requested package (In
general these files reside in the chrome and component directory)
- Remove all entries that belongs to the package from the chrome registry
(This includes information that has been stored in all-content.rdf,
all-skin.rdf, all-local.rdf file and maybe some of the overlay files. Until
uninstallChrome works fine, this must be done manually ;-(
- Remove entries from the version and perhaps from the component registry.

Currently I have got problems with the last task. Assuming I had installed a
package with the registry package name "myCompany/myPackage" and Version
"a.b.c.d", there should be a corresponding entry in the version registry.
(The version registry resides in mozver.dat file (Windows). Is this right?).
After installation the call InstallTrigger.getVersion("myCompany/myPackage")
should return "a.b.c.d".

Okay, that is basic stuff. So now I would like to uninstall the whole
package and especially I would like to remove the corresponding version
entry. I tried the following:

// open version registry
var oRegistry = Components.classes["@mozilla.org/registry;1"];
oRegistry = oRegistry.createInstance(Components.interfaces.nsIRegistry);
oRegistry.openWellKnownRegistry(Components.interfaces.nsIRegistry.Applicatio
nRegistry);

// works fine so far, but what now??? I assume the following instructions
should be
var oVersionRegistryRootKey =
Components.interfaces.nsIRegistry.VersionRegistry;

// That would be nice. Unfortunately there are only predefined settings in
the interface for the Users and Common branch. (Mmh, okay I suppose that the
version registry has its own branch in the registry, but maybe I am wrong.
But if I am right, what would be the correct key for the
VersionRegistryRootKey here??)

oRegistry.removeKey(oVersionRegistryRootKey, "myCompany/myPackage");
oRegistry.pack();
oRegistry.flush();
// Mmmh and again I am not sure, if this will really do the job ;-(  And by
the way: Where is the close() method in nsIRegistry??)


Thanks to all, Klaus











Reply via email to