Hiroyuki Ikezoe
ikezo****@users*****
Tue Apr 25 15:28:32 JST 2006
Index: kazehakase/src/mozilla/kz-mozwrapper.cpp diff -u kazehakase/src/mozilla/kz-mozwrapper.cpp:1.112 kazehakase/src/mozilla/kz-mozwrapper.cpp:1.113 --- kazehakase/src/mozilla/kz-mozwrapper.cpp:1.112 Tue Apr 25 14:31:31 2006 +++ kazehakase/src/mozilla/kz-mozwrapper.cpp Tue Apr 25 15:28:32 2006 @@ -1557,72 +1557,49 @@ GList **list) { nsresult rv; - PRUint32 num = 0; gboolean flag = FALSE; const PRUnichar aLiteral[] = { 'a', '\0' }; - // get frame window - nsCOMPtr<nsIDOMWindowCollection> frames; - domWindow->GetFrames(getter_AddRefs(frames)); - - if (frames) - { - frames->GetLength(&num); - } - if (num != 0) - { - for (PRUint32 i = 0; i < num; i++) - { - nsCOMPtr<nsIDOMWindow> childWindow; - frames->Item(i, getter_AddRefs(childWindow)); - rv = GetDestAnchorsFromWindow(childWindow, list); - if (NS_SUCCEEDED(rv)) - flag |= TRUE; - } - } - else - { - nsCOMPtr<nsIDOMDocument> domDoc; - domWindow->GetDocument(getter_AddRefs(domDoc)); + nsCOMPtr<nsIDOMDocument> domDoc; + domWindow->GetDocument(getter_AddRefs(domDoc)); - nsCOMPtr<nsIDOMNodeList> nodeList; - rv = domDoc->GetElementsByTagName(nsEmbedString(aLiteral), - getter_AddRefs(nodeList)); - if (NS_FAILED(rv) || !nodeList) return NS_ERROR_FAILURE; + nsCOMPtr<nsIDOMNodeList> nodeList; + rv = domDoc->GetElementsByTagName(nsEmbedString(aLiteral), + getter_AddRefs(nodeList)); + if (NS_FAILED(rv) || !nodeList) return NS_ERROR_FAILURE; - PRUint32 num; - rv = nodeList->GetLength(&num); - if (NS_FAILED(rv) || num < 1) return NS_ERROR_FAILURE; + PRUint32 num; + rv = nodeList->GetLength(&num); + if (NS_FAILED(rv) || num < 1) return NS_ERROR_FAILURE; - nsEmbedCString docURL; - GetDocumentUrl(docURL); + nsEmbedCString docURL; + GetDocumentUrl(docURL); - // store links to GList - nsCOMPtr<nsIDOMNode> node; - for (PRUint32 i = 0; i < num; i++) - { - rv = nodeList->Item(i, getter_AddRefs(node)); - if (NS_FAILED(rv) || !node) continue; + // store links to GList + nsCOMPtr<nsIDOMNode> node; + for (PRUint32 i = 0; i < num; i++) + { + rv = nodeList->Item(i, getter_AddRefs(node)); + if (NS_FAILED(rv) || !node) continue; - // check the node has name attribute or id attribure. - char *value = NULL; - GetAttributeFromNode(node, "name", &value); - if (!value) - GetAttributeFromNode(node, "id", &value); - if (!value) - continue; - - char *uri; - uri = g_strdup_printf ("%s#%s", docURL.get(), value); - g_free(value); - - KzBookmark *link; - link = kz_bookmark_new_with_attrs(NULL, uri, NULL); - *list = g_list_append(*list, link); - g_free(uri); + // check the node has name attribute or id attribure. + char *value = NULL; + GetAttributeFromNode(node, "name", &value); + if (!value) + GetAttributeFromNode(node, "id", &value); + if (!value) + continue; + + char *uri; + uri = g_strdup_printf ("%s#%s", docURL.get(), value); + g_free(value); + + KzBookmark *link; + link = kz_bookmark_new_with_attrs(NULL, uri, NULL); + *list = g_list_append(*list, link); + g_free(uri); - flag = TRUE; - } + flag = TRUE; } return flag ? NS_OK : NS_ERROR_FAILURE;