Bug 1415010 - Bind onanimationxx handlers before creating EventWatcher. r?birtles draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Tue, 07 Nov 2017 10:30:07 +0900
changeset 693895 b4503a0d919760b16f6dcc9a40739571d3f24636
parent 693894 667f91789c4c6a65ec8f81d24e56dc39af27a784
child 739182 5118a1230f9d758dc434acdf46b8de3b061e9f43
push id87963
push userhikezoe@mozilla.com
push dateTue, 07 Nov 2017 01:31:18 +0000
reviewersbirtles
bugs1415010
milestone58.0a1
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
dom/animation/test/css-animations/file_event-order.html
--- 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] =