зеркало из https://github.com/mozilla/gecko-dev.git
Bug 347762 - Log nsSVGLength2 and nsSVGNumber2 parse failures to error console. r=tor,sr=bzbarsky
This commit is contained in:
Родитель
91b403086b
Коммит
e4ec268e27
|
@ -226,13 +226,7 @@ nsSVGElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
// expects a length.
|
||||
// To accomodate this "erronous" value, we'll insert a proxy
|
||||
// object between ourselves and the actual value object:
|
||||
nsAutoString attributeName;
|
||||
aAttribute->ToString(attributeName);
|
||||
const nsAFlatString& attributeValue = PromiseFlatString(aValue);
|
||||
const PRUnichar *strings[] = { attributeName.get(), attributeValue.get() };
|
||||
nsSVGUtils::ReportToConsole(GetOwnerDoc(),
|
||||
"AttributeParseWarning",
|
||||
strings, NS_ARRAY_LENGTH(strings));
|
||||
ReportAttributeParseFailure(GetOwnerDoc(), aAttribute, aValue);
|
||||
nsCOMPtr<nsISVGValue> proxy;
|
||||
nsresult rv =
|
||||
NS_CreateSVGStringProxyValue(svg_value, getter_AddRefs(proxy));
|
||||
|
@ -267,6 +261,7 @@ nsSVGElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
nsresult rv = lengthInfo.mLengths[i].SetBaseValueString(aValue, this,
|
||||
PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
ReportAttributeParseFailure(GetOwnerDoc(), aAttribute, aValue);
|
||||
return PR_FALSE;
|
||||
}
|
||||
aResult.SetTo(aValue);
|
||||
|
@ -281,6 +276,7 @@ nsSVGElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
nsresult rv = numberInfo.mNumbers[i].SetBaseValueString(aValue, this,
|
||||
PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
ReportAttributeParseFailure(GetOwnerDoc(), aAttribute, aValue);
|
||||
return PR_FALSE;
|
||||
}
|
||||
aResult.SetTo(aValue);
|
||||
|
@ -995,3 +991,16 @@ nsSVGElement::GetAnimatedNumberValues(float *aFirst, ...)
|
|||
va_end(args);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSVGElement::ReportAttributeParseFailure(nsIDocument* aDocument,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue)
|
||||
{
|
||||
nsAutoString attributeName;
|
||||
aAttribute->ToString(attributeName);
|
||||
const nsAFlatString& attributeValue = PromiseFlatString(aValue);
|
||||
const PRUnichar *strings[] = { attributeName.get(), attributeValue.get() };
|
||||
return nsSVGUtils::ReportToConsole(aDocument,
|
||||
"AttributeParseWarning",
|
||||
strings, NS_ARRAY_LENGTH(strings));
|
||||
}
|
||||
|
|
|
@ -193,6 +193,12 @@ protected:
|
|||
nsAttrAndChildArray mMappedAttributes;
|
||||
|
||||
PRPackedBool mSuppressNotification;
|
||||
|
||||
private:
|
||||
static nsresult
|
||||
ReportAttributeParseFailure(nsIDocument* aDocument,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче