зеркало из https://github.com/mozilla/pjs.git
Fixes to getElementsByTagName to avoid returning nodes that aren't elements.
This commit is contained in:
Родитель
bb7cb946bb
Коммит
caaaa239f1
|
@ -2151,6 +2151,11 @@ RDFElementImpl::GetElementsByTagName(nsIDOMNode* aNode,
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
element = do_QueryInterface(child);
|
||||
if (!element)
|
||||
continue;
|
||||
|
||||
if (aTagName.Equals("*")) {
|
||||
if (NS_FAILED(rv = aElements->AppendNode(child))) {
|
||||
NS_ERROR("unable to append element to node list");
|
||||
|
@ -2213,6 +2218,11 @@ RDFElementImpl::GetElementsByAttribute(nsIDOMNode* aNode,
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
element = do_QueryInterface(child);
|
||||
if (!element)
|
||||
continue;
|
||||
|
||||
nsAutoString name;
|
||||
nsCOMPtr<nsIContent> pContent;
|
||||
pContent = do_QueryInterface(child);
|
||||
|
|
|
@ -2907,6 +2907,11 @@ XULDocumentImpl::GetElementsByTagName(nsIDOMNode* aNode,
|
|||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
element = do_QueryInterface(aNode);
|
||||
if (!element)
|
||||
return NS_OK;
|
||||
|
||||
if (aTagName.Equals("*")) {
|
||||
if (NS_FAILED(rv = aElements->AppendNode(aNode))) {
|
||||
NS_ERROR("unable to append element to node list");
|
||||
|
@ -2968,6 +2973,11 @@ XULDocumentImpl::GetElementsByAttribute(nsIDOMNode* aNode,
|
|||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
element = do_QueryInterface(aNode);
|
||||
if (!element)
|
||||
return NS_OK;
|
||||
|
||||
nsAutoString name;
|
||||
nsCOMPtr<nsIContent> pContent;
|
||||
pContent = do_QueryInterface(aNode);
|
||||
|
|
|
@ -2151,6 +2151,11 @@ RDFElementImpl::GetElementsByTagName(nsIDOMNode* aNode,
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
element = do_QueryInterface(child);
|
||||
if (!element)
|
||||
continue;
|
||||
|
||||
if (aTagName.Equals("*")) {
|
||||
if (NS_FAILED(rv = aElements->AppendNode(child))) {
|
||||
NS_ERROR("unable to append element to node list");
|
||||
|
@ -2213,6 +2218,11 @@ RDFElementImpl::GetElementsByAttribute(nsIDOMNode* aNode,
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
element = do_QueryInterface(child);
|
||||
if (!element)
|
||||
continue;
|
||||
|
||||
nsAutoString name;
|
||||
nsCOMPtr<nsIContent> pContent;
|
||||
pContent = do_QueryInterface(child);
|
||||
|
|
|
@ -2907,6 +2907,11 @@ XULDocumentImpl::GetElementsByTagName(nsIDOMNode* aNode,
|
|||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
element = do_QueryInterface(aNode);
|
||||
if (!element)
|
||||
return NS_OK;
|
||||
|
||||
if (aTagName.Equals("*")) {
|
||||
if (NS_FAILED(rv = aElements->AppendNode(aNode))) {
|
||||
NS_ERROR("unable to append element to node list");
|
||||
|
@ -2968,6 +2973,11 @@ XULDocumentImpl::GetElementsByAttribute(nsIDOMNode* aNode,
|
|||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
element = do_QueryInterface(aNode);
|
||||
if (!element)
|
||||
return NS_OK;
|
||||
|
||||
nsAutoString name;
|
||||
nsCOMPtr<nsIContent> pContent;
|
||||
pContent = do_QueryInterface(aNode);
|
||||
|
|
|
@ -2151,6 +2151,11 @@ RDFElementImpl::GetElementsByTagName(nsIDOMNode* aNode,
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
element = do_QueryInterface(child);
|
||||
if (!element)
|
||||
continue;
|
||||
|
||||
if (aTagName.Equals("*")) {
|
||||
if (NS_FAILED(rv = aElements->AppendNode(child))) {
|
||||
NS_ERROR("unable to append element to node list");
|
||||
|
@ -2213,6 +2218,11 @@ RDFElementImpl::GetElementsByAttribute(nsIDOMNode* aNode,
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
element = do_QueryInterface(child);
|
||||
if (!element)
|
||||
continue;
|
||||
|
||||
nsAutoString name;
|
||||
nsCOMPtr<nsIContent> pContent;
|
||||
pContent = do_QueryInterface(child);
|
||||
|
|
Загрузка…
Ссылка в новой задаче