Bug 1415010 - Bind onanimationxx handlers before creating EventWatcher. r?birtles
So that we can surely receive these animation events in the handler before
the EventWatcher receives the events.
MozReview-Commit-ID: 9jVJ3TgwYeq
--- a/dom/animation/test/css-animations/file_event-order.html
+++ b/dom/animation/test/css-animations/file_event-order.html
@@ -33,28 +33,29 @@ events (${expectedEvents.map(event => ev
'Event target should match');
assert_equals(expectedEvents[i][2], actualEvent.elapsedTime,
'Event\'s elapsed time should match');
});
}
function setupAnimation(t, animationStyle, receiveEvents) {
const div = addDiv(t, { style: "animation: " + animationStyle });
- const watcher = new EventWatcher(t, div, [ 'animationstart',
- 'animationiteration',
- 'animationend' ]);
['start', 'iteration', 'end'].forEach(name => {
div['onanimation' + name] = evt => {
receiveEvents.push({ type: evt.type,
target: evt.target,
elapsedTime: evt.elapsedTime });
};
});
+ const watcher = new EventWatcher(t, div, [ 'animationstart',
+ 'animationiteration',
+ 'animationend' ]);
+
const animation = div.getAnimations()[0];
return [animation, watcher, div];
}
promise_test(t => {
let events = [];
const [animation1, watcher1, div1] =