Re: help : nsIWebBrowser->GetContentDOMWindow problem !

2005-03-22 Thread Boris Zbarsky
Laurent Mimoun wrote:
what does "we are not setup??!!" mean exactely ?
Exactly what it says.  The browse has not been properly initialized.
rslt = componentManager->CreateInstanceByContractID(
   "@mozilla.org/embedding/browser/nsWebBrowser;1",
   nsnull,
   NS_GET_IID(nsIWebBrowser),
   getter_AddRefs(webBrowser));
OK... This creates the web browser object.  Then you need to initialize it.  I 
believe just QIing to nsIBaseWindow and calling Create() on the result should do 
the job.

All of this needs to be better documented, and will be by Gecko 1.8.
-Boris
___
mozilla-embedding mailing list
mozilla-embedding@mozilla.org
http://mail.mozilla.org/listinfo/mozilla-embedding


help : nsIWebBrowser->GetContentDOMWindow problem !

2005-03-18 Thread Laurent Mimoun
I see an article
(http://www.mozilla.org/editor/Editor_Embedding_Guide.html) and a
source code comment int the article interests me :

nsCOMPtr domWindow;
  nsresult rv = nsIWebBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
  if (NS_FAILED(rv)) return NS_ERROR_FAILURE; // we are not setup??!!

in fact in my developpement i'm exactly in the situation where NS_FAILED(rv)
is true and i don't understand why.

what does "we are not setup??!!" mean exactely ?

i spent a long time on this error so someone can please help me to
understand why i am facing this problem and how to resolve it ?


you can read here my original post here :

http://news-reader.org/article.php?group=netscape.public.mozilla.xpcom&post_nr=4693

My post :
Hello, i use firefox 1.0.1 and write an component that need to retrieve
the current DOM of the current web page displayed in firefox.

But the code below does'nt work.

It crashes here (see complete source code below) :
rslt = webBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));

(i have : rslt = NS_ERROR_UNEXPECTED)

Can you please give me some help ?
Here is my code :
// Component manager
nsCOMPtr componentManager;
nsresult rslt = NS_GetComponentManager(getter_AddRefs(componentManager));
if(NS_FAILED(rslt)) return rslt;

// WebBrowser
nsCOMPtr webBrowser;

rslt = componentManager->CreateInstanceByContractID(
   "@mozilla.org/embedding/browser/nsWebBrowser;1",
   nsnull,
   NS_GET_IID(nsIWebBrowser),
   getter_AddRefs(webBrowser));

if(NS_FAILED(rslt)) return rslt;

// DOM
nsCOMPtr domWindow;
rslt = webBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
if(NS_FAILED(rslt)) return rslt;
___
mozilla-embedding mailing list
mozilla-embedding@mozilla.org
http://mail.mozilla.org/listinfo/mozilla-embedding