Bug 1413817 - Use arrow function in file_restyles.html. r?birtles draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Thu, 09 Nov 2017 08:06:35 +0900
changeset 695296 8fb61cd238331f9ec20fdc05b786dba7ac48082f
parent 695295 d399469b5a942039ab942f9072c68e6e6c597f09
child 695297 686255678267d540fbf9f35f517ebf7709d5a7c4
push id88383
push userhikezoe@mozilla.com
push dateThu, 09 Nov 2017 00:26:11 +0000
reviewersbirtles
bugs1413817
milestone58.0a1
Bug 1413817 - Use arrow function in file_restyles.html. r?birtles MozReview-Commit-ID: AcjDRK36d9d
dom/animation/test/mozilla/file_restyles.html
--- a/dom/animation/test/mozilla/file_restyles.html
+++ b/dom/animation/test/mozilla/file_restyles.html
@@ -50,37 +50,37 @@ function observeStyling(frameCount, onFr
     SpecialPowers.wrap(window)
                  .QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
                  .getInterface(SpecialPowers.Ci.nsIWebNavigation)
                  .QueryInterface(SpecialPowers.Ci.nsIDocShell);
 
   docShell.recordProfileTimelineMarkers = true;
   docShell.popProfileTimelineMarkers();
 
-  return new Promise(function(resolve) {
-    return waitForAnimationFrames(frameCount, onFrame).then(function() {
+  return new Promise(resolve => {
+    return waitForAnimationFrames(frameCount, onFrame).then(() => {
       var markers = docShell.popProfileTimelineMarkers();
       docShell.recordProfileTimelineMarkers = false;
-      var stylingMarkers = markers.filter(function(marker, index) {
+      var stylingMarkers = markers.filter((marker, index) => {
         return marker.name == 'Styles' && marker.isAnimationOnly;
       });
       resolve(stylingMarkers);
     });
   });
 }
 
 function ensureElementRemoval(aElement) {
-  return new Promise(function(resolve) {
+  return new Promise(resolve => {
     aElement.remove();
     waitForAllPaintsFlushed(resolve);
   });
 }
 
 function waitForWheelEvent(aTarget) {
-  return new Promise(function(resolve, reject) {
+  return new Promise(resolve => {
     // Get the scrollable target element position in this window coordinate
     // system to send a wheel event to the element.
     var targetRect = aTarget.getBoundingClientRect();
     var centerX = targetRect.left + targetRect.width / 2;
     var centerY = targetRect.top + targetRect.height / 2;
 
     sendWheelAndPaintNoFlush(aTarget, centerX, centerY,
                              { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
@@ -101,17 +101,17 @@ function add_task_if_omta_enabled(test) 
     info(test.name + " is skipped because OMTA is disabled");
     return;
   }
   add_task(test);
 }
 
 // We need to wait for all paints before running tests to avoid contaminations
 // from styling of this document itself.
-waitForAllPaints(function() {
+waitForAllPaints(() => {
   add_task(async function restyling_for_main_thread_animations() {
     var div = addDiv(null, { style: 'animation: background-color 100s' });
     var animation = div.getAnimations()[0];
 
     await animation.ready;
     ok(!SpecialPowers.wrap(animation).isRunningOnCompositor);
 
     var markers = await observeStyling(5);
@@ -191,17 +191,17 @@ waitForAllPaints(function() {
 
     var animation = div.getAnimations()[0];
     var initialRect = div.getBoundingClientRect();
 
     await animation.finished;
 
     var mouseX = initialRect.left + initialRect.width / 2;
     var mouseY = initialRect.top + initialRect.height / 2;
-    var markers = await observeStyling(5, function() {
+    var markers = await observeStyling(5, () => {
       // We can't use synthesizeMouse here since synthesizeMouse causes
       // layout flush.
       synthesizeMouseAtPoint(mouseX++, mouseY++,
                              { type: 'mousemove' }, window);
     });
 
     is(markers.length, 0,
        'Bug 1219236: Finished transitions should never cause restyles ' +
@@ -214,17 +214,17 @@ waitForAllPaints(function() {
     var animation = div.getAnimations()[0];
 
     var initialRect = div.getBoundingClientRect();
 
     await animation.finished;
 
     var mouseX = initialRect.left + initialRect.width / 2;
     var mouseY = initialRect.top + initialRect.height / 2;
-    var markers = await observeStyling(5, function() {
+    var markers = await observeStyling(5, () => {
       // We can't use synthesizeMouse here since synthesizeMouse causes
       // layout flush.
       synthesizeMouseAtPoint(mouseX++, mouseY++,
                              { type: 'mousemove' }, window);
     });
 
     is(markers.length, 0,
        'Bug 1219236: Finished animations should never cause restyles ' +
@@ -487,17 +487,17 @@ waitForAllPaints(function() {
       { style: 'overflow-y: scroll; height: 20px;' });
     var div = addDiv(null,
       { style: 'animation: background-color 100s; position: relative; top: 100px;' });
     parentElement.appendChild(div);
     var animation = div.getAnimations()[0];
 
     await animation.ready;
 
-    var markers = await observeStyling(1, function() {
+    var markers = await observeStyling(1, () => {
       parentElement.style.height = '100px';
     });
 
     is(markers.length, 1,
        'Animations running on the main-thread which was in scrolled out ' +
        'elements should update restyling soon after the element moved in ' +
        'view by resizing');