Add asserts on people attempting to fetch attributes in the

kNamespaceID_Unknown namespace or call HasAttr on such.  Bug 210314, r+sr=jst
This commit is contained in:
bzbarsky%mit.edu 2003-06-24 06:45:34 +00:00
Родитель 4d14f9afbe
Коммит e5462134b5
4 изменённых файлов: 22 добавлений и 0 удалений

Просмотреть файл

@ -3465,6 +3465,9 @@ nsGenericContainerElement::GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
nsAString& aResult) const
{
NS_ASSERTION(nsnull != aName, "must have attribute name");
NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown,
"must have a real namespace ID!");
if (!aName) {
return NS_ERROR_NULL_POINTER;
}
@ -3507,6 +3510,9 @@ NS_IMETHODIMP_(PRBool)
nsGenericContainerElement::HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const
{
NS_ASSERTION(nsnull != aName, "must have attribute name");
NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown,
"must have a real namespace ID!");
if (nsnull == aName)
return PR_FALSE;

Просмотреть файл

@ -2195,6 +2195,9 @@ nsresult
nsGenericHTMLElement::GetAttr(PRInt32 aNameSpaceID, nsIAtom *aAttribute,
nsIAtom** aPrefix, nsAString& aResult) const
{
NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown,
"must have a real namespace ID!");
nsresult rv;
aResult.Truncate();
@ -2281,6 +2284,8 @@ nsGenericHTMLElement::GetAttr(PRInt32 aNameSpaceID, nsIAtom *aAttribute,
NS_IMETHODIMP_(PRBool)
nsGenericHTMLElement::HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const
{
NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown,
"must have a real namespace ID!");
return mAttributes && mAttributes->HasAttribute(aName, aNameSpaceID);
}

Просмотреть файл

@ -365,6 +365,9 @@ nsSVGElement::GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom** aPrefix,
nsAString& aResult) const
{
NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown,
"must have a real namespace ID!");
return mAttributes->GetAttr(aNameSpaceID, aName, aPrefix, aResult);
}
@ -378,6 +381,8 @@ nsSVGElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
NS_IMETHODIMP_(PRBool)
nsSVGElement::HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const
{
NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown,
"must have a real namespace ID!");
return mAttributes->HasAttr(aNameSpaceID, aName);
}

Просмотреть файл

@ -2600,6 +2600,9 @@ nsXULElement::GetAttr(PRInt32 aNameSpaceID,
nsAString& aResult) const
{
NS_ASSERTION(nsnull != aName, "must have attribute name");
NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown,
"must have a real namespace ID!");
if (nsnull == aName) {
return NS_ERROR_NULL_POINTER;
}
@ -2648,6 +2651,9 @@ NS_IMETHODIMP_(PRBool)
nsXULElement::HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const
{
NS_ASSERTION(nsnull != aName, "must have attribute name");
NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown,
"must have a real namespace ID!");
if (!aName)
return PR_FALSE;