Boris Zbarsky wrote:
Michael A. Borisov wrote:
Does anybody know what happened to nsIDocShell in FF3.5?
Nothing.
Before for FF3.0.x I just did do_queryInterface for nsIWebBrowser
instance.
Which presumably returned 0, assuming that's what you actually did.
Certainly there's no mention of nsIDocShell in
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/embedding/browser/webBrowser/nsWebBrowser.cpp&rev=1.169&mark=168-185#168
-Boris
Ok, I tried another way which I learned from Galeon.
int CoMozEmbed::docShell(nsIDocShell **docShell) const
{
CO_CHECK_POINTER(docShell);
int res;
nsCOMPtr<nsIDocShellTreeItem> browserAsItem;
if (!(browserAsItem = do_QueryInterface(_browser)))
return CO_ERROR(Co::MSG_NO_INTERFACE, "nsIDocShellTreeItem");
// Get the owner for that item.
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
if (NS_FAILED(res =
browserAsItem->GetTreeOwner(getter_AddRefs(treeOwner))))
return CO_ERROR(qPrintable(errorString(res)));
CO_CHECK_POINTER(treeOwner);
// Get the primary content shell as an item.
nsCOMPtr<nsIDocShellTreeItem> contentItem;
if (NS_FAILED(res =
treeOwner->GetPrimaryContentShell(getter_AddRefs(contentItem))))
return CO_ERROR(qPrintable(errorString(res)));
CO_CHECK_POINTER(contentItem);
// QI that back to a doc shell.
nsCOMPtr<nsIDocShell> ds;
if (!(ds = do_QueryInterface(contentItem)))
return CO_ERROR(Co::MSG_NO_INTERFACE, "nsIDocShell");
*docShell = ds.get();
NS_IF_ADDREF(*docShell);
return CO_OK;
}
The last do_QueryInterface returns 0 in FF3.5. But everything is OK in
FF3.0.x.
So, what is the right way to get that interface?
Thank you,
Michael
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding