Bug 1472859 - Part 1: Avoid crashing which is in case the all values of keyframes are same. r?gl draft
authorDaisuke Akatsuka <dakatsuka@mozilla.com>
Tue, 03 Jul 2018 16:22:28 +0900
changeset 813435 6e749853fe4d8ed6ddf30a789ee99cd39256d6cb
parent 813430 b99ce02fe667efcdd382e0fbcfadf65e4fa42d5b
child 813436 b884f30ddf0caae74a98a45bd5ddddb434365b4f
push id114905
push userbmo:dakatsuka@mozilla.com
push dateTue, 03 Jul 2018 07:23:30 +0000
reviewersgl
bugs1472859
milestone63.0a1
Bug 1472859 - Part 1: Avoid crashing which is in case the all values of keyframes are same. r?gl MozReview-Commit-ID: Bz60drhwohf
devtools/client/inspector/animation/components/keyframes-graph/ColorPath.js
--- a/devtools/client/inspector/animation/components/keyframes-graph/ColorPath.js
+++ b/devtools/client/inspector/animation/components/keyframes-graph/ColorPath.js
@@ -28,17 +28,17 @@ class ColorPath extends ComputedStylePat
     return "color";
   }
 
   getPropertyValue(keyframe) {
     return keyframe.value;
   }
 
   propToState({ keyframes }) {
-    const maxObject = { distance: 0 };
+    const maxObject = { distance: -Number.MAX_VALUE };
 
     for (let i = 0; i < keyframes.length - 1; i++) {
       const value1 = getRGBA(keyframes[i].value);
       for (let j = i + 1; j < keyframes.length; j++) {
         const value2 = getRGBA(keyframes[j].value);
         const distance = getRGBADistance(value1, value2);
 
         if (maxObject.distance >= distance) {