Bug 1109390 part 4 - Make DevTools animation actor wait for asynchronous pause; r=pbrosset
authorBrian Birtles <birtles@gmail.com>
Tue, 24 Mar 2015 09:21:08 +0900
changeset 265497 c12acbaf33d8bd32491b7161800831cb8ab6f40f
parent 265496 cb71bf27300ce899920a2c6b89d66c61211c7547
child 265498 c4fe64d3a1c5dcfbb9ffadaa04d6084d1e92fe8d
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspbrosset
bugs1109390
milestone39.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 1109390 part 4 - Make DevTools animation actor wait for asynchronous pause; r=pbrosset Although pause() is not yet asynchronous, any time we finish calling it the ready promise should be resolved so we can safely wait on the ready promise after calling pause already. This way, once pause() becomes async later in this bug, code relying on this actor will continue to work.
toolkit/devtools/server/actors/animation.js
--- a/toolkit/devtools/server/actors/animation.js
+++ b/toolkit/devtools/server/actors/animation.js
@@ -245,16 +245,17 @@ let AnimationPlayerActor = ActorClass({
     }
   }),
 
   /**
    * Pause the player.
    */
   pause: method(function() {
     this.player.pause();
+    return this.player.ready;
   }, {
     request: {},
     response: {}
   }),
 
   /**
    * Play the player.
    * This method only returns when the animation has left its pending state.
@@ -508,20 +509,23 @@ let AnimationsActor = exports.Animations
       this.allAnimationsPaused = false;
     }
   },
 
   /**
    * Pause all animations in the current tabActor's frames.
    */
   pauseAll: method(function() {
+    let readyPromises = [];
     for (let player of this.getAllAnimationPlayers()) {
       player.pause();
+      readyPromises.push(player.ready);
     }
     this.allAnimationsPaused = true;
+    return promise.all(readyPromises);
   }, {
     request: {},
     response: {}
   }),
 
   /**
    * Play all animations in the current tabActor's frames.
    * This method only returns when the animations have left their pending states.