Re: What's wrong with this small code - getting the DOM
The process crashes on the last line nsresult nres = mEndParent->GetChildNodes(getter_AddRefs(children)); I can see in my vstudio debugger that I am getting an object with this structure: nsIDOMDocument nsISupports __vptr (**some expression which can't be evaluated) (**some expression which can't be evaluated) (**some expression which can't be evaluated) Thanks, Vijay ___ mozilla-embedding mailing list mozilla-embedding@mozilla.org http://mail.mozilla.org/listinfo/mozilla-embedding
Re: What's wrong with this small code - getting the DOM
Vijay wrote: Here is the GetDOM function implementation as well... NS_IMETHODIMP CBrowserImpl::GetDOM(nsIDOMDocument* doc) { nsCOMPtr window; nsCOMPtr ndoc = (nsCOMPtr)doc; Er... what? That doesn't look to me like it should do anything sane at all. In particular, after this code runs in your example as: nsCOMPtr doc; pBrowserFrame->GetBrowserImpl()->GetDOM(doc); |doc| will be null as far as I can tell. -Boris ___ mozilla-embedding mailing list mozilla-embedding@mozilla.org http://mail.mozilla.org/listinfo/mozilla-embedding
Re: What's wrong with this small code - getting the DOM
Vijay wrote: Hi All, In the original code of mfcembed, I have changed this method - void CMfcEmbedApp::OnNewBrowser() { CBrowserFrame *pBrowserFrame = CreateNewBrowserFrame(); //Load the HomePage into the browser view //if(pBrowserFrame && (GetStartupPageMode() == 1)) //pBrowserFrame->m_wndBrowserView.LoadHomePage(); if(pBrowserFrame) { pBrowserFrame->m_wndBrowserView.OpenURL("http://www.google.co.in";); //Sleep here for sometime to wait for document to load nsCOMPtr doc; pBrowserFrame->GetBrowserImpl()->GetDOM(doc); nsIDOMNode* mEndParent = (nsIDOMNode*)doc; nsCOMPtr children; nsresult nres = mEndParent->GetChildNodes(getter_AddRefs(children)); } } In the last line, the exe crashes stating Access Code Violation. Please tell what's wrong with this code? Many thanks, Vijay Can you verify that this line: pBrowserFrame->GetBrowserImpl()->GetDOM(doc); is actually getting the nsIDOMDocument? Also, if you are successfully getting the nsIDOMDocument, can you verify this this line: nsIDOMNode* mEndParent = (nsIDOMNode*)doc; is also getting something and not just failing? Niky Williams ___ mozilla-embedding mailing list mozilla-embedding@mozilla.org http://mail.mozilla.org/listinfo/mozilla-embedding
Re: What's wrong with this small code - getting the DOM
Here is the GetDOM function implementation as well... NS_IMETHODIMP CBrowserImpl::GetDOM(nsIDOMDocument* doc) { nsCOMPtr window; nsCOMPtr ndoc = (nsCOMPtr)doc; mWebBrowser->GetContentDOMWindow(getter_AddRefs(window)); if (window) { window->GetDocument(getter_AddRefs(ndoc)); } return NS_OK; } ___ mozilla-embedding mailing list mozilla-embedding@mozilla.org http://mail.mozilla.org/listinfo/mozilla-embedding
What's wrong with this small code - getting the DOM
Hi All, In the original code of mfcembed, I have changed this method - void CMfcEmbedApp::OnNewBrowser() { CBrowserFrame *pBrowserFrame = CreateNewBrowserFrame(); //Load the HomePage into the browser view //if(pBrowserFrame && (GetStartupPageMode() == 1)) //pBrowserFrame->m_wndBrowserView.LoadHomePage(); if(pBrowserFrame) { pBrowserFrame->m_wndBrowserView.OpenURL("http://www.google.co.in";); //Sleep here for sometime to wait for document to load nsCOMPtr doc; pBrowserFrame->GetBrowserImpl()->GetDOM(doc); nsIDOMNode* mEndParent = (nsIDOMNode*)doc; nsCOMPtr children; nsresult nres = mEndParent->GetChildNodes(getter_AddRefs(children)); } } In the last line, the exe crashes stating Access Code Violation. Please tell what's wrong with this code? Many thanks, Vijay ___ mozilla-embedding mailing list mozilla-embedding@mozilla.org http://mail.mozilla.org/listinfo/mozilla-embedding