Re: Starting Mozilla from XPCShell (revisited)
[email protected] (Ugen)
| Newsgroups | gmane.comp.mozilla.devel.xpcom |
|---|---|
| Organization | http://groups.google.com/ |
| Message-ID | <[email protected]> |
[email protected] (Ugen) wrote in message OK...i got it to work , but it requires a patch to make commandLineService scriptable. Trivial patch indeed. Who can i submit the patch to? Here it is included: ------------------------------- CUT --------------------------------- --- mozilla/xpfe/appshell/src/nsCommandLineService.cpp Sat Apr 27 01:32:51 2002 +++ mozilla/xpfe/appshell/src/nsCommandLineService.cpp.new Thu Aug 15 13:35:33 2002 @@ -88,11 +88,11 @@ } NS_IMETHODIMP -nsCmdLineService::Initialize(int aArgc, char ** aArgv) +nsCmdLineService::Initialize(unsigned int aArgc, const char ** aArgv) { - PRInt32 i=0; + PRUint32 i=0; nsresult rv = nsnull; // Save aArgc and argv @@ -163,7 +163,7 @@ // Append the url to the arrays //mArgList.AppendElement((void *)PL_strdup("-url")); - mArgValueList.AppendElement(ProcessURLArg(aArgv[i])); + mArgValueList.AppendElement(ProcessURLArg((char *)aArgv[i])); mArgCount++; continue; } @@ -182,7 +182,7 @@ * Append the url to the arrays */ mArgList.AppendElement(NS_REINTERPRET_CAST(void*, nsCRT::strdup("-url"))); - mArgValueList.AppendElement(ProcessURLArg(aArgv[i])); + mArgValueList.AppendElement(ProcessURLArg((char *)aArgv[i])); mArgCount++; } else { --- mozilla/xpfe/appshell/public/nsICmdLineService.idl Fri Sep 28 16:13:18 2001 +++ mozilla/xpfe/appshell/public/nsICmdLineService.idl.new Thu Aug 15 13:35:15 2002 @@ -56,7 +56,8 @@ * Warning: This will hold a reference to the original argv * passed into Initialze(); */ - [noscript] void initialize(in long argc, out string argv); + //[noscript] void initialize(in long argc, out string argv); + void initialize(in unsigned long argc, [array,size_is(argc)] in string argv); /** * getCmdLineValue ------------------------------------------------------------------------- Here is what the script should look like, it's a bit different from the example: ---------------------------- var EventQClass = Components.classes['@mozilla.org/event-queue-service;1']; var EventQObj = EventQClass.getService(Components.interfaces.nsIEventQueueService); EventQObj.createThreadEventQueue(); var AppShellClass = Components.classes['@mozilla.org/appshell/appShellService;1']; var AppShellObj = AppShellClass.getService(Components.interfaces.nsIAppShellService); var URLClass = Components.classes['@mozilla.org/network/standard-url;1']; var URLObj = URLClass.createInstance(Components.interfaces.nsIURL); var cmdLineClass = Components.classes['@mozilla.org/appshell/commandLineService;1'] var cmdLineObject = cmdLineClass.getService(Components.interfaces.nsICmdLineService) cmdLineObject.initialize(1, ["xpcshell"]) URLObj.spec="http://www.yahoo.com"; AppShellObj.initialize(cmdLineObject,null); var test = new Object(); toto = AppShellObj.createTopLevelWindow(null,URLObj, true,true, Components.interfaces.nsIWebBrowserChrome.CHROME_ALL, 640,800,test); toto.showModal() URLObj.spec="http://www.nando.net"; toto = AppShellObj.createTopLevelWindow(null,URLObj, true,true, Components.interfaces.nsIWebBrowserChrome.CHROME_ALL, 640,800,test); toto.showModal() ~ ----------------------------------------------