I use wxMozilla (for wxWidgets) and it works with GRE from Firefox
1.0.8. I'm using VC2003 and XP.
I'm trying to update wxMozilla to use it with Firefox 1.5.7 but there
are severals errors :
rv = nsComponentManager::RegisterFactory(kPromptServiceCID,
"Prompt Service",
"@mozilla.org/embedcomp/prompt-service;1",
promptFactory,
PR_TRUE); // replace existing
In /mozilla/embeddings/test/wxEmbed, I've found
nsCOMPtr<nsIComponentRegistrar> registrar;
NS_GetComponentRegistrar(getter_AddRefs(registrar));
if (registrar)
registrar->RegisterFactory(cid, aDescription,
contractID.get(),
factory);
I don't know if the 5th argument needs more code
I've also problems with APIs :
GetChromeEventHandler :
nsCOMPtr<nsPIDOMWindow> piWin(do_QueryInterface(rootWindow));
nsCOMPtr<nsIChromeEventHandler> chromeHandler;
piWin->GetChromeEventHandler(getter_AddRefs(chromeHandler));
> 'nsPIDOMWindow::GetChromeEventHandler' : function does not take 1 arguments
//This code lets us handle mouse events generated by Mozilla
nsCOMPtr<nsPIDOMWindow> domWindowPrivate =
do_QueryInterface(domWindow);
// and the root window for that DOM window
nsCOMPtr<nsIDOMWindowInternal> rootWindow;
domWindowPrivate->GetPrivateRoot( getter_AddRefs(rootWindow) );
> 'nsPIDOMWindow::GetPrivateRoot' : function does not take 1 arguments
And finally,
nsresult rv =
nsComponentManager::CreateInstance(NS_SIMPLEURI_CONTRACTID, nsnull,
NS_GET_IID(nsIURI), (void**)&url);
wxASSERT_MSG(NS_SUCCEEDED(rv), wxT("Could not create an instance of
the url"));
rv = url->SetSpec(nsCAutoString(utf8_buffer));
I've tried to convert to use nsIComponentRegistrar :
nsCOMPtr<nsIComponentRegistrar> compReg;
nsresult rv = NS_GetComponentRegistrar(getter_AddRefs(compReg));
rv = compReg->CreateInstance(NS_SIMPLEURI_CONTRACTID, nsnull,
NS_GET_IID(nsIURI), (void**)&url);
wxASSERT_MSG(NS_SUCCEEDED(rv), wxT("Could not create an instance of the
url"));
rv = url->SetSpec(nsCAutoString(utf8_buffer));
> 'CreateInstance' : is not a member of 'nsDerivedSafe<T>'
maybe i have to use do_Create instead of CreateInstance ?
At least, I've also set MOZILLA_INTERNAL_API because wxMozilla seem to
use old api for string.
Sorry, for this long post
If somebody can help or provide somes links for doc
Excuse me if I've posted to wrong newsgroup.
Thanks,
Michael
I've managed to fix my problems :
*) RegisterFactory with 5 parameters, it seems to works without the 5
*) GetChromeEventHandler and GetPrivateRoot :
I've changed
nsCOMPtr<nsPIDOMWindow> domWindowPrivate =
do_QueryInterface(domWindow);
nsCOMPtr<nsIDOMWindowInternal> rootWindow;
domWindowPrivate->GetPrivateRoot(getter_AddRefs(rootWindow));
to
nsCOMPtr<nsPIDOMWindow> domWindowPrivate =
do_QueryInterface(domWindow);
nsCOMPtr<nsIDOMWindowInternal> rootWindow;
rootWindow = domWindowPrivate->GetPrivateRoot();
(same thing for GetChromeEventHandler)
*) with CreateInstance(NS_SIMPLEURI_CONTRACTID ...
I use do_CreateInstance :
nsCOMPtr<nsIURI> url = do_CreateInstance( NS_SIMPLEURI_CONTRACTID, &rv
);
rv = url->SetSpec(nsCAutoString(utf8_buffer));
Finally, I've a lot of errors linkings but thanks to
http://developer.mozilla.org/en/docs/XPCOM_Glue, it's ok
But, severals problems remains :
crash of wxMozilla with a <form with a password field
crash with any url in https
Maybe more work to fully enabled --enable-single-profile ?
Thanks,
Michael
my about:buildconfig
--enable-application=browser
--disable-ldap
--disable-mailnews
--enable-extensions=cookie,xml-rpc,xmlextras,pref,transformiix,universalchardet,webservices,inspector,gnomevfs
--enable-crypto
--disable-composer
--enable-single-profile
--disable-profilesharing
--disable-tests
--disable-debug
--enable-optimize
--disable-mailnews
--disable-ldap
--without-system-nspr
--without-system-zlib
--without-system-jpeg
--without-system-png
--without-system-mng
--enable-crypto
> I've tried to convert to use nsIComponentRegistrar :
> nsCOMPtr<nsIComponentRegistrar> compReg;
> nsresult rv = NS_GetComponentRegistrar(getter_AddRefs(compReg));
> rv = compReg->CreateInstance(NS_SIMPLEURI_CONTRACTID, nsnull,
> NS_GET_IID(nsIURI), (void**)&url);
> wxASSERT_MSG(NS_SUCCEEDED(rv), wxT("Could not create an instance of the
> url"));
> rv = url->SetSpec(nsCAutoString(utf8_buffer));
> > 'CreateInstance' : is not a member of 'nsDerivedSafe<T>'
>
> maybe i have to use do_Create instead of CreateInstance ?
Yes, use do_CreateInstance instead when using nsCOMPtr.
I strongly suggest you check out
http://developer.mozilla.org/en/docs/XPCOM if you really want to
understand what you're doing in this area (component registration, what
an nsCOMPtr is, and what-not -- good guides for this is all there!)
/Håkan