Bug 1275449 - Part 1: AnimationEffectTiming::SetEasing crash in page-mode addon context. r=hiro
authorDaisuke Akatsuka <daisuke@mozilla-japan.org>
Wed, 01 Jun 2016 17:40:11 +0900
changeset 324439 f6cde20f6294f7ad98fc1372dade8557a80a935c
parent 324438 3c2ac62acf836714976ba5206a4fd171df8b0d73
child 324440 f746d2a857b8f5bca06a999822c085011c30f58c
push id9671
push userraliiev@mozilla.com
push dateMon, 06 Jun 2016 20:27:52 +0000
treeherdermozilla-aurora@cea65ca3d0bd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershiro
bugs1275449
milestone49.0a1
Bug 1275449 - Part 1: AnimationEffectTiming::SetEasing crash in page-mode addon context. r=hiro MozReview-Commit-ID: DeyC4BiXJNo
dom/animation/AnimationEffectTiming.cpp
--- a/dom/animation/AnimationEffectTiming.cpp
+++ b/dom/animation/AnimationEffectTiming.cpp
@@ -129,20 +129,24 @@ AnimationEffectTiming::SetDirection(cons
   PostSpecifiedTimingUpdated(mEffect);
 }
 
 void
 AnimationEffectTiming::SetEasing(JSContext* aCx,
                                  const nsAString& aEasing,
                                  ErrorResult& aRv)
 {
+  nsIDocument* document = AnimationUtils::GetCurrentRealmDocument(aCx);
+  if (!document) {
+    aRv.Throw(NS_ERROR_FAILURE);
+    return;
+  }
+
   Maybe<ComputedTimingFunction> newFunction =
-    TimingParams::ParseEasing(aEasing,
-                              AnimationUtils::GetCurrentRealmDocument(aCx),
-                              aRv);
+    TimingParams::ParseEasing(aEasing, document, aRv);
   if (aRv.Failed()) {
     return;
   }
 
   if (mTiming.mFunction == newFunction) {
     return;
   }