[Project_owners] nsIWindowWatcher.openWindow and command line arguments

Sergey Yanovich ynvich at gmail.com
Wed Nov 21 23:59:03 PST 2007


Jean-Denis Girard wrote:
> Does anyone have a working example of passing command line parameter 
> from js component to firefox extension ?

Your command line handler is a service (singleton). Save command line 
parameter in its member.

   ...
   this.param = cmdLine.handleFlagWithParam("phone", false);;
   ...

When your extension is loaded, get a pointer to  the handler, and read 
the command line parameter.

   ...
   var param = Components.classes[]
     .getService(Components.interfaces.nsISupports)
     .wrappedJSObject.param;
   ...

You will probably need to make your command-line handler variable by 
replacing 'const' with 'var' in declaration.

--
Sergey Yanovich


More information about the Project_owners mailing list