0
C++을 사용하여 Firefox 확장 프로그램을 작성 중입니다.C++에서 탭 URL 받기
나는 해당 URL을 얻기 위해 탭을 열거합니다.
nsCOMPtr<nsIWindowMediator> windowMediator = do_GetService(NS_WINDOWMEDIATOR_CONTRACTID, &rv);
windowMediator->GetMostRecentWindow(L"navigator:browser", getter_AddRefs(dwi));
dwi->GetDocument(getter_AddRefs(doc));
nsCOMPtr<nsIDOMDocumentXBL> xbl(do_QueryInterface(doc));
doc->GetElementById(NS_LITERAL_STRING("content"), getter_AddRefs(domEl));
nsCOMPtr<nsIDOMElement> pAnoEl;
xbl->GetAnonymousElementByAttribute(
domEl,
NS_LITERAL_STRING("anonid"),
NS_LITERAL_STRING("tabcontainer"),
getter_AddRefs(pAnoEl)
);
nsString retval;
PRBool bRet = 0;
nsCOMPtr<nsIDOMNodeList> nodeList;
pAnoEl->GetChildNodes(getter_AddRefs(nodeList));
nsCOMPtr<nsIDOMNode> domNode;
rv = nodeList->GetLength(&len);
for (PRUint32 i = 0; i < len; i++)
{
nodeList->Item(i, getter_AddRefs(domNode));
nsCOMPtr<nsIDOMXULElement> xulElement = do_QueryInterface(domNode);
nsCOMPtr<nsIBoxObject> boxObject;
xulElement->GetBoxObject(getter_AddRefs(boxObject));
nsCOMPtr<nsIBrowserBoxObject> browserboxObject = do_QueryInterface(boxObject);
}
nsIBrowserBoxObject 오류 코드와 함께 실패 얻기를위한 위의 코드의 QueryInterface에서 :
다음은 의사입니다 NS_ERROR_NO_INTERFACE.
탭 URL을 가져 오는 방법을 제안 해주세요.
도와주세요!
감사합니다. Vaibhav.