Bug 1463372 - Part 1: Introduce createdTime to keyframes progress bar. r=pbro
authorDaisuke Akatsuka <dakatsuka@mozilla.com>
Fri, 25 May 2018 17:01:20 +0900
changeset 419957 b1be8a677b2229504f4e08a50aea60e4282e41cd
parent 419956 96d23f930840388cc6d0d2339022340ff32fd114
child 419958 4d264b49431fb926782c5ce0514eaa946389aa0d
push id64477
push userdakatsuka@mozilla.com
push dateFri, 25 May 2018 22:37:46 +0000
treeherderautoland@4d264b49431f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspbro
bugs1463372
milestone62.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 1463372 - Part 1: Introduce createdTime to keyframes progress bar. r=pbro MozReview-Commit-ID: Biy0AhZZxLQ
devtools/client/inspector/animation/components/KeyframesProgressBar.js
--- a/devtools/client/inspector/animation/components/KeyframesProgressBar.js
+++ b/devtools/client/inspector/animation/components/KeyframesProgressBar.js
@@ -57,22 +57,27 @@ class KeyframesProgressBar extends PureC
 
   onCurrentTimeUpdated(currentTime) {
     const { animation, timeScale } = this.props;
     this.updateOffset(currentTime, animation, timeScale);
   }
 
   updateOffset(currentTime, animation, timeScale) {
     const {
+      createdTime,
       playbackRate,
-      previousStartTime = 0,
     } = animation.state;
 
-    const time =
-      (timeScale.minStartTime + currentTime - previousStartTime) * playbackRate;
+    // If createdTime is not defined (which happens when connected to server older
+    // than FF62), use previousStartTime instead. See bug 1454392
+    const baseTime = typeof createdTime === "undefined"
+                       ? (animation.state.previousStartTime || 0)
+                       : createdTime;
+    const time = (timeScale.minStartTime + currentTime - baseTime) * playbackRate;
+
     if (isNaN(time)) {
       // Setting an invalid currentTime will throw so bail out if time is not a number for
       // any reason.
       return;
     }
 
     this.simulatedAnimation.currentTime = time;
     const offset = this.element.offsetWidth *