Bug 1472859 - Part 1: Avoid crashing which is in case the all values of keyframes are same. r=gl a=lizzard
authorDaisuke Akatsuka <dakatsuka@mozilla.com>
Tue, 03 Jul 2018 16:22:28 +0900
changeset 477849 79290fd284cfc2226df07b793287d9c2037f2f10
parent 477848 6ab86ccd136dbaa90824c81ce76469ba83b80c71
child 477850 e5972354da953a684cda4885accf6539eb09eae6
push id9445
push userarchaeopteryx@coole-files.de
push dateSat, 07 Jul 2018 21:43:02 +0000
treeherdermozilla-beta@0a939a1cd7f9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgl, lizzard
bugs1472859
milestone62.0
Bug 1472859 - Part 1: Avoid crashing which is in case the all values of keyframes are same. r=gl a=lizzard 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) {