Re: Not able to get nsIDOMHTMLDocument from nsIDOMDocument
mads <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Message-ID | <[email protected]> |
>Your usecase is exactly the same with 1.8 and 1.9?
>Or is it possible that you're trying to use documents which aren't HTML
>documents? Maybe plain XML, or SVG or XUL document?
Thanks for the reply. I tried to use the same code base for Moz 1.9 which
worked fine in Moz 1.8. The code that I am trying on simple google home page
only.
Here is the sample code written in C++.
nsCOMPtr<nsIWindowMediator> iWindowMediator =
do_GetService(NS_WINDOWMEDIATOR_CONTRACTID, &result);
result = iWindowMediator->GetXULWindowEnumerator(0, getter_AddRefs(enum));
// enum - nsISimpleEnumerator
//iWindowMediator->Release() ; // This is commented in Moz 1.9 as I am
getting compiler error.
nsCOMPtr<nsISupports> pis ;
nsresult result ;
while(((result = enum->GetNext( getter_AddRefs(pis))) == NS_OK) && next ==
0 && pis != 0 )
{
nsCOMPtr<nsIXULWindow> webShellWindow(do_QueryInterface(pis, &result));
if (webShellWindow != 0 )
{
webShellWindow->GetDocShell(getter_AddRefs(DocShell)); // DocShell -
nsIDocShell
nsIDOMWindowPtr domWindow(do_GetInterface(DocShell));
nsIDOMDocumentPtr domDocument = 0 ;
if (window->GetDocument(getter_AddRefs(domDocument)) == NS_OK)
{
nsIDOMNSDocumentPtr doc = do_QueryInterface(domDocument) ; // This is
working fine
nsIDOMHTMLDocumentPtr htmlDocument = do_QueryInterface(domDocument) ; //
This is not working and getting null reference
}
}
}
Please let me know if I did any thing wrong.
--
View this message in context: http://www.nabble.com/Not-able-to-get-nsIDOMHTMLDocument-from-nsIDOMDocument-tp21079467p21123715.html
Sent from the Mozilla - DOM mailing list archive at Nabble.com.