Bug 1049975 - Part 1: Support null effect. draft
authorBoris Chiou <boris.chiou@gmail.com>
Tue, 12 Jul 2016 11:42:49 +0800
changeset 405229 96a04750a707a14ddce8caf1de28e215914f9b9f
parent 404988 01748a2b1a463f24efd9cd8abad9ccfd76b037b8
child 405230 0a6fb0c0d6eac014233cbce43f26dc61c0aa7aff
push id27442
push userbmo:boris.chiou@gmail.com
push dateThu, 25 Aug 2016 04:26:27 +0000
bugs1049975
milestone51.0a1
Bug 1049975 - Part 1: Support null effect. MozReview-Commit-ID: 7ougqvbIVuD
dom/animation/Animation.cpp
dom/base/domerr.msg
testing/web-platform/meta/web-animations/interfaces/Animation/constructor.html.ini
xpcom/base/ErrorList.h
--- a/dom/animation/Animation.cpp
+++ b/dom/animation/Animation.cpp
@@ -89,22 +89,16 @@ namespace {
 Animation::Constructor(const GlobalObject& aGlobal,
                        KeyframeEffectReadOnly* aEffect,
                        const Optional<AnimationTimeline*>& aTimeline,
                        ErrorResult& aRv)
 {
   nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports());
   RefPtr<Animation> animation = new Animation(global);
 
-  if (!aEffect) {
-    // Bug 1049975: We do not support null effect yet.
-    aRv.Throw(NS_ERROR_DOM_ANIM_NO_EFFECT_ERR);
-    return nullptr;
-  }
-
   AnimationTimeline* timeline;
   if (aTimeline.WasPassed()) {
     timeline = aTimeline.Value();
   } else {
     nsIDocument* document =
       AnimationUtils::GetCurrentRealmDocument(aGlobal.Context());
     if (!document) {
       aRv.Throw(NS_ERROR_FAILURE);
@@ -1121,16 +1115,20 @@ Animation::FlushStyle() const
 void
 Animation::PostUpdate()
 {
   nsPresContext* presContext = GetPresContext();
   if (!presContext) {
     return;
   }
 
+  if (!mEffect) {
+    return;
+  }
+
   Maybe<NonOwningAnimationTarget> target = mEffect->GetTarget();
   if (!target) {
     return;
   }
 
   presContext->EffectCompositor()
              ->RequestRestyle(target->mElement,
                               target->mPseudoType,
--- a/dom/base/domerr.msg
+++ b/dom/base/domerr.msg
@@ -114,17 +114,16 @@ DOM4_MSG_DEF(BtParmInvalidError,  "Inval
 DOM4_MSG_DEF(BtUnhandledError,    "Unhandled",  NS_ERROR_DOM_BLUETOOTH_UNHANDLED)
 DOM4_MSG_DEF(BtAuthFailureError,  "Authentication failure",  NS_ERROR_DOM_BLUETOOTH_AUTH_FAILURE)
 DOM4_MSG_DEF(BtRmtDevDownError,   "Remote device down",  NS_ERROR_DOM_BLUETOOTH_RMT_DEV_DOWN)
 DOM4_MSG_DEF(BtAuthRejectedError, "Authentication rejected",  NS_ERROR_DOM_BLUETOOTH_AUTH_REJECTED)
 
 /* Web Animations errors */
 
 DOM4_MSG_DEF(NotSupportedError, "Animation to or from an underlying value is not yet supported.", NS_ERROR_DOM_ANIM_MISSING_PROPS_ERR)
-DOM4_MSG_DEF(NotSupportedError, "Animation with no effect is not yet supported.", NS_ERROR_DOM_ANIM_NO_EFFECT_ERR)
 
 /* common global codes (from nsError.h) */
 
 DOM_MSG_DEF(NS_OK                                  , "Success")
 DOM_MSG_DEF(NS_ERROR_NOT_INITIALIZED               , "Component not initialized")
 DOM_MSG_DEF(NS_ERROR_ALREADY_INITIALIZED           , "Component already initialized")
 DOM_MSG_DEF(NS_ERROR_NOT_IMPLEMENTED               , "Method not implemented")
 DOM_MSG_DEF(NS_NOINTERFACE                         , "Component does not have requested interface")
deleted file mode 100644
--- a/testing/web-platform/meta/web-animations/interfaces/Animation/constructor.html.ini
+++ /dev/null
@@ -1,14 +0,0 @@
-[constructor.html]
-  type: testharness
-  [Animation can be constructed with null effect and null timeline]
-    expected: FAIL
-    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1049975
-
-  [Animation can be constructed with null effect and non-null timeline]
-    expected: FAIL
-    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1049975
-
-  [Animation can be constructed with null effect and no timeline parameter]
-    expected: FAIL
-    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1049975
-
--- a/xpcom/base/ErrorList.h
+++ b/xpcom/base/ErrorList.h
@@ -949,17 +949,16 @@
   ERROR(NS_ERROR_SIGNED_APP_MANIFEST_INVALID,   FAILURE(1)),
 #undef MODULE
 
   /* ======================================================================= */
   /* 39: NS_ERROR_MODULE_DOM_ANIM */
   /* ======================================================================= */
 #define MODULE NS_ERROR_MODULE_DOM_ANIM
   ERROR(NS_ERROR_DOM_ANIM_MISSING_PROPS_ERR,              FAILURE(1)),
-  ERROR(NS_ERROR_DOM_ANIM_NO_EFFECT_ERR,                  FAILURE(2)),
 #undef MODULE
 
   /* ======================================================================= */
   /* 40: NS_ERROR_MODULE_DOM_PUSH */
   /* ======================================================================= */
 #define MODULE NS_ERROR_MODULE_DOM_PUSH
   ERROR(NS_ERROR_DOM_PUSH_INVALID_REGISTRATION_ERR, FAILURE(1)),
   ERROR(NS_ERROR_DOM_PUSH_DENIED_ERR,               FAILURE(2)),