Re: How to get currently selected tab index and its content
Josh Matthews <[email protected]> Tue, 30 Mar 2010 04:13:53 +1300
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Message-ID | <[email protected]> |
On 03/29/2010 11:18 PM, veeru wrote:
> Hi,
>
> I am developing an XPCOM component in c++. I am able to get number of
> tabs currently opened using XBL. Please see the code below:
>
> ////////////////////////////////////////////C O D
> E//////////////////////////////////////////
> nsresult rv;
> nsCOMPtr<nsIWindowMediator> windowMediator
> = do_GetService(NS_WINDOWMEDIATOR_CONTRACTID,&rv);
> NS_ENSURE_SUCCESS(rv,rv);
> PRUint32 len;
> nsString temp;
>
> nsCOMPtr<nsIDOMDocument> curDoc;
> nsCOMPtr<nsIDOMElement> domEl;
> nsCOMPtr<nsIDOMNodeList> tabbrowser;
> nsCOMPtr<nsIDOMDocument> doc;
> nsCOMPtr<nsIDOMWindowInternal> dwi;
> windowMediator->GetMostRecentWindow(L"navigator:browser",
> getter_AddRefs(dwi));
> if (dwi)
> {
> dwi->GetDocument(getter_AddRefs(doc));
> if (doc)
> {
> nsCOMPtr<nsIDOMDocumentXBL> xbl(do_QueryInterface(doc));
> if (xbl)
> return NS_ERROR_FAILURE;
This condition looks wrong to me, especially since you later use xbl->
Cheers,
Josh