Bug 1435139 - Don't call into RemovePropertyInternal from RemoveProperty when the property doesn't exist. r?bz
MozReview-Commit-ID: 4pDCtiLIORn
--- a/layout/style/nsDOMCSSDeclaration.cpp
+++ b/layout/style/nsDOMCSSDeclaration.cpp
@@ -249,16 +249,20 @@ nsDOMCSSDeclaration::SetProperty(const n
}
NS_IMETHODIMP
nsDOMCSSDeclaration::RemoveProperty(const nsAString& aPropertyName,
nsAString& aReturn)
{
nsresult rv = GetPropertyValue(aPropertyName, aReturn);
NS_ENSURE_SUCCESS(rv, rv);
+ // If the property doesn't exist, it makes no sense to go further.
+ if (aReturn.IsEmpty()) {
+ return NS_OK;
+ }
return RemovePropertyInternal(aPropertyName);
}
/* static */ void
nsDOMCSSDeclaration::GetCSSParsingEnvironmentForRule(css::Rule* aRule,
CSSParsingEnvironment& aCSSParseEnv)
{
StyleSheet* sheet = aRule ? aRule->GetStyleSheet() : nullptr;