diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index e3be58d5a7fb..415172e30501 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -3993,25 +3993,23 @@ PresShell::GoToAnchor(const nsAString& aAnchorName, PRBool aScroll) // Find a matching list of named nodes rv = htmlDoc->GetElementsByName(aAnchorName, getter_AddRefs(list)); if (NS_SUCCEEDED(rv) && list) { - PRUint32 count; PRUint32 i; - list->GetLength(&count); // Loop through the named nodes looking for the first anchor - for (i = 0; i < count; i++) { + for (i = 0; PR_TRUE; i++) { nsCOMPtr node; rv = list->Item(i, getter_AddRefs(node)); - if (NS_FAILED(rv)) { + if (!node) { // End of list break; } // Ensure it's an anchor element - nsCOMPtr element = do_QueryInterface(node); - nsAutoString tagName; - if (element && NS_SUCCEEDED(element->GetTagName(tagName))) { - ToLowerCase(tagName); - if (tagName.Equals(NS_LITERAL_STRING("a"))) { - content = do_QueryInterface(element); + content = do_QueryInterface(node); + if (content) { + nsCOMPtr tag; + content->GetTag(*getter_AddRefs(tag)); + if (tag == nsHTMLAtoms::a) { break; } + content = nsnull; } } } @@ -4025,14 +4023,12 @@ PresShell::GoToAnchor(const nsAString& aAnchorName, PRBool aScroll) // Get the list of anchor elements rv = doc->GetElementsByTagNameNS(nameSpace, NS_LITERAL_STRING("a"), getter_AddRefs(list)); if (NS_SUCCEEDED(rv) && list) { - PRUint32 count; PRUint32 i; - list->GetLength(&count); // Loop through the named nodes looking for the first anchor - for (i = 0; i < count; i++) { + for (i = 0; PR_TRUE; i++) { nsCOMPtr node; rv = list->Item(i, getter_AddRefs(node)); - if (NS_FAILED(rv)) { + if (!node) { // End of list break; } // Compare the name attribute diff --git a/layout/html/base/src/nsPresShell.cpp b/layout/html/base/src/nsPresShell.cpp index e3be58d5a7fb..415172e30501 100644 --- a/layout/html/base/src/nsPresShell.cpp +++ b/layout/html/base/src/nsPresShell.cpp @@ -3993,25 +3993,23 @@ PresShell::GoToAnchor(const nsAString& aAnchorName, PRBool aScroll) // Find a matching list of named nodes rv = htmlDoc->GetElementsByName(aAnchorName, getter_AddRefs(list)); if (NS_SUCCEEDED(rv) && list) { - PRUint32 count; PRUint32 i; - list->GetLength(&count); // Loop through the named nodes looking for the first anchor - for (i = 0; i < count; i++) { + for (i = 0; PR_TRUE; i++) { nsCOMPtr node; rv = list->Item(i, getter_AddRefs(node)); - if (NS_FAILED(rv)) { + if (!node) { // End of list break; } // Ensure it's an anchor element - nsCOMPtr element = do_QueryInterface(node); - nsAutoString tagName; - if (element && NS_SUCCEEDED(element->GetTagName(tagName))) { - ToLowerCase(tagName); - if (tagName.Equals(NS_LITERAL_STRING("a"))) { - content = do_QueryInterface(element); + content = do_QueryInterface(node); + if (content) { + nsCOMPtr tag; + content->GetTag(*getter_AddRefs(tag)); + if (tag == nsHTMLAtoms::a) { break; } + content = nsnull; } } } @@ -4025,14 +4023,12 @@ PresShell::GoToAnchor(const nsAString& aAnchorName, PRBool aScroll) // Get the list of anchor elements rv = doc->GetElementsByTagNameNS(nameSpace, NS_LITERAL_STRING("a"), getter_AddRefs(list)); if (NS_SUCCEEDED(rv) && list) { - PRUint32 count; PRUint32 i; - list->GetLength(&count); // Loop through the named nodes looking for the first anchor - for (i = 0; i < count; i++) { + for (i = 0; PR_TRUE; i++) { nsCOMPtr node; rv = list->Item(i, getter_AddRefs(node)); - if (NS_FAILED(rv)) { + if (!node) { // End of list break; } // Compare the name attribute diff --git a/xpfe/components/autocomplete/resources/content/autocomplete.xml b/xpfe/components/autocomplete/resources/content/autocomplete.xml index 75addb5a2d38..90079ae08bdf 100644 --- a/xpfe/components/autocomplete/resources/content/autocomplete.xml +++ b/xpfe/components/autocomplete/resources/content/autocomplete.xml @@ -1575,7 +1575,7 @@