Bug 1277456 part 4 - Use the document associated with an AnimationEffectTiming object as the context for parsing easing rather than the current realm document; r=bz
authorBrian Birtles <birtles@gmail.com>
Wed, 13 Jul 2016 13:22:13 +0900
changeset 305208 9b2815fda1131214e7cab0fd24adb1854483c80f
parent 305207 e85703fad4a6f65ea1512b829524f4db6e4f44a5
child 305209 b6dd3c6ec969170a0151b7369a2528c8f4363b1d
push id79518
push usercbook@mozilla.com
push dateSun, 17 Jul 2016 08:09:59 +0000
treeherdermozilla-inbound@711963e8daa3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1277456
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1277456 part 4 - Use the document associated with an AnimationEffectTiming object as the context for parsing easing rather than the current realm document; r=bz MozReview-Commit-ID: 4LhbIUIz6Vd
dom/animation/AnimationEffectTiming.cpp
dom/animation/AnimationEffectTiming.h
dom/animation/test/mozilla/test_set-easing.html
dom/bindings/Bindings.conf
--- a/dom/animation/AnimationEffectTiming.cpp
+++ b/dom/animation/AnimationEffectTiming.cpp
@@ -125,28 +125,20 @@ AnimationEffectTiming::SetDirection(cons
   }
 
   mTiming.mDirection = aDirection;
 
   PostSpecifiedTimingUpdated(mEffect);
 }
 
 void
-AnimationEffectTiming::SetEasing(JSContext* aCx,
-                                 const nsAString& aEasing,
-                                 ErrorResult& aRv)
+AnimationEffectTiming::SetEasing(const nsAString& aEasing, ErrorResult& aRv)
 {
-  nsIDocument* document = AnimationUtils::GetCurrentRealmDocument(aCx);
-  if (!document) {
-    aRv.Throw(NS_ERROR_FAILURE);
-    return;
-  }
-
   Maybe<ComputedTimingFunction> newFunction =
-    TimingParams::ParseEasing(aEasing, document, aRv);
+    TimingParams::ParseEasing(aEasing, mDocument, aRv);
   if (aRv.Failed()) {
     return;
   }
 
   if (mTiming.mFunction == newFunction) {
     return;
   }
 
--- a/dom/animation/AnimationEffectTiming.h
+++ b/dom/animation/AnimationEffectTiming.h
@@ -30,17 +30,17 @@ public:
   void SetDelay(double aDelay);
   void SetEndDelay(double aEndDelay);
   void SetFill(const FillMode& aFill);
   void SetIterationStart(double aIterationStart, ErrorResult& aRv);
   void SetIterations(double aIterations, ErrorResult& aRv);
   void SetDuration(const UnrestrictedDoubleOrString& aDuration,
                    ErrorResult& aRv);
   void SetDirection(const PlaybackDirection& aDirection);
-  void SetEasing(JSContext* aCx, const nsAString& aEasing, ErrorResult& aRv);
+  void SetEasing(const nsAString& aEasing, ErrorResult& aRv);
 
 private:
   KeyframeEffect* MOZ_NON_OWNING_REF mEffect;
 };
 
 } // namespace dom
 } // namespace mozilla
 
--- a/dom/animation/test/mozilla/test_set-easing.html
+++ b/dom/animation/test/mozilla/test_set-easing.html
@@ -1,32 +1,35 @@
 <!doctype html>
 <head>
 <meta charset=utf-8>
-<title>Tests AnimationTimingFunction::SetEasing in sandbox</title>
+<title>Test setting easing in sandbox</title>
 <script src="/tests/SimpleTest/SimpleTest.js"></script>
 <script src="/tests/SimpleTest/SpawnTask.js"></script>
 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
 </head>
 <body>
 
 <script>
 "use strict";
 
 add_task(function* set_easing() {
   const div = document.createElement("div");
   document.body.appendChild(div);
   div.animate({ opacity: [0, 1] }, 100000 );
 
   const contentScript = function() {
-    doesThrow(() => {
+    try {
       document.getAnimations()[0].effect.timing.easing = "linear";
-    }, "AnimationTimingFunction::SetEasing should throw in sandbox.");
+      ok(true, 'Setting easing should not throw in sandbox');
+    } catch (e) {
+      ok(false, 'Setting easing should not throw in sandbox');
+    }
   };
 
   const sandbox = new SpecialPowers.Cu.Sandbox(window);
   sandbox.importFunction(document, "document");
-  sandbox.importFunction(SimpleTest.doesThrow, "doesThrow");
+  sandbox.importFunction(SimpleTest.ok, "ok");
   SpecialPowers.Cu.evalInSandbox(`(${contentScript.toSource()})()`, sandbox);
 });
 
 </script>
 </body>
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -52,22 +52,16 @@ DOMInterfaces = {
 'AbstractWorker': {
     'concrete': False
 },
 
 'AnimationEffectReadOnly': {
     'concrete': False
 },
 
-'AnimationEffectTiming': {
-    'implicitJSContext': {
-        'setterOnly': [ 'easing' ]
-    }
-},
-
 'AnimationTimeline': {
     'concrete': False
 },
 
 'AnonymousContent': {
     'wrapperCache': False
 },