Re: Using of xpcom components in install.js

Daniel Veditz <[email protected]> Fri, 13 May 2005 11:51:06 -0700
Newsgroups gmane.comp.mozilla.devel.xpinstall
Organization Another Netscape Collabra Server User
Message-ID <[email protected]>
The install script context is extremely limited. You've got the basic 
javascript language and then methods defined on the global Install 
objects. You can manipulate files, but not much more. In particular you 
can't load any XPCOM components from the install script.

Vinod Mukkamala wrote:
> Hello Everybody,
> 
> I am unable to use xpcom object in install.js. Let me explain what I am 
> doing here. I am trying to install a bunch of components. For this I am 
> using the firefox-installer XPI engine version 1.0.3. Modified the 
> config.ini file to match my needs. The first component I install is 
> XPCom, followed by Component C1 and C2. Once component C2 is installed, 
> I need to change a file from C2 so that it contains the location of C1. 
> For this, I am trying to read the file using
> 
> var localFile = Components.classes["@mozilla.org/file/local;1"].
>              createInstance(Components.interfaces.nsILocalFile);
> localFile.initWithPath(filePath);
> 
> But I always get "uncaught exception: Components is not defined". I even 
> tried this code as suggested by Dan Veditz after installing XPCom, but I 
> still get the same error.
> 
>     refreshPlugins(true);
> 
> Kindly suggest how to solve this issue.
> 
> Thanks,
> VM