Bug 1361951 - Add null check for nsIDocument in ComputeAnimationDistance.
MozReview-Commit-ID: GFMmT8bMKzP
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -2685,20 +2685,22 @@ nsDOMWindowUtils::ComputeAnimationDistan
Element* element = content->AsElement();
AnimationValue v1 = AnimationValue::FromString(property, aValue1, element);
AnimationValue v2 = AnimationValue::FromString(property, aValue2, element);
if (v1.IsNull() || v2.IsNull()) {
return NS_ERROR_ILLEGAL_VALUE;
}
- nsIPresShell* shell = element->GetComposedDoc()->GetShell();
- RefPtr<nsStyleContext> styleContext = shell
- ? nsComputedDOMStyle::GetStyleContext(element, nullptr, shell)
- : nullptr;
+ RefPtr<nsStyleContext> styleContext;
+ nsIDocument* doc = element->GetComposedDoc();
+ if (doc && doc->GetShell()) {
+ styleContext =
+ nsComputedDOMStyle::GetStyleContext(element, nullptr, doc->GetShell());
+ }
*aResult = v1.ComputeDistance(property, v2, styleContext);
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::GetAnimationTypeForLonghand(const nsAString& aProperty,
nsAString& aResult)
{