Bug 1206345 - Force a state update in browser_animation_reconstructState.js; r=jdescottes
authorPatrick Brosset <pbrosset@mozilla.com>
Tue, 12 Apr 2016 15:24:38 +0200
changeset 330826 f6622c3b8aa7c9a80fb285ac091212dfcd0fbda1
parent 330825 fc46dfa8cfc9c8397122b606b27689b89e7ef629
child 330827 89cfa8c724e1fcb0909e1414b6051dbd62b40105
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdescottes
bugs1206345
milestone48.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 1206345 - Force a state update in browser_animation_reconstructState.js; r=jdescottes This test wasn't using refreshState, instead it used getCurrentState. What refreshState does on top of getCurrentState is it stores the new state locally. getCurrentState isn't meant to be called externally, it is only meant to be an actor method interceptor that reconstructs the missing state. So the test should have used refreshState from the start. Turns out it worked in most cases because the animation did have a startTime when the test retrieved it, so it had a previousStartTime. But, if for some reason, the animation has a startTime=null when the test starts, then the value never gets to the front, and bad things happen. MozReview-Commit-ID: 2nEIKHMHsCS
devtools/server/tests/browser/browser_animation_reconstructState.js
--- a/devtools/server/tests/browser/browser_animation_reconstructState.js
+++ b/devtools/server/tests/browser/browser_animation_reconstructState.js
@@ -2,17 +2,17 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Check that, even though the AnimationPlayerActor only sends the bits of its
 // state that change, the front reconstructs the whole state everytime.
 
-add_task(function*() {
+add_task(function* () {
   let {client, walker, animations} =
     yield initAnimationsFrontForUrl(MAIN_DOMAIN + "animation.html");
 
   yield playerHasCompleteStateAtAllTimes(walker, animations);
 
   yield closeDebuggerClient(client);
   gBrowser.removeCurrentTab();
 });
@@ -24,15 +24,15 @@ function* playerHasCompleteStateAtAllTim
 
   // Get the list of state key names from the initialstate.
   let keys = Object.keys(player.initialState);
 
   // Get the state over and over again and check that the object returned
   // contains all keys.
   // Normally, only the currentTime will have changed in between 2 calls.
   for (let i = 0; i < 10; i++) {
-    let state = yield player.getCurrentState();
+    yield player.refreshState();
     keys.forEach(key => {
-      ok(typeof state[key] !== "undefined",
+      ok(typeof player.state[key] !== "undefined",
          "The state retrieved has key " + key);
     });
   }
 }