Bug 1395971 - Use arrow function in file_deferred_start.html. r=birtles, a=test-only
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Fri, 01 Jun 2018 05:21:22 +0900
changeset 473682 b0ca6f6810d6d8209ccdeab3e7bea443e21c9712
parent 473681 d8e96c3c3c8c17ab85ee3cd09f27ad3baa03675e
child 473683 6036d334f8c91565da5ce962073ed566af117c81
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbirtles, test-only
bugs1395971
milestone61.0
Bug 1395971 - Use arrow function in file_deferred_start.html. r=birtles, a=test-only MozReview-Commit-ID: 9o1M78IOB1c
dom/animation/test/mozilla/file_deferred_start.html
--- a/dom/animation/test/mozilla/file_deferred_start.html
+++ b/dom/animation/test/mozilla/file_deferred_start.html
@@ -11,32 +11,32 @@
   background-color: white;
 }
 </style>
 <body>
 <script>
 'use strict';
 
 function waitForDocLoad() {
-  return new Promise(function(resolve, reject) {
+  return new Promise((resolve, reject) => {
     if (document.readyState === 'complete') {
       resolve();
     } else {
       window.addEventListener('load', resolve);
     }
   });
 }
 
 function waitForPaints() {
-  return new Promise(function(resolve, reject) {
+  return new Promise((resolve, reject) => {
     waitForAllPaintsFlushed(resolve);
   });
 }
 
-promise_test(function(t) {
+promise_test(t => {
   // Test that empty animations actually start.
   //
   // Normally we tie the start of animations to when their first frame of
   // the animation is rendered. However, for animations that don't actually
   // trigger a paint (e.g. because they are empty, or are animating something
   // that doesn't render or is offscreen) we want to make sure they still
   // start.
   //
@@ -45,48 +45,48 @@ promise_test(function(t) {
   // have other paint events taking place which might, by luck, happen to
   // trigger animations that otherwise would not have been triggered, leading to
   // false positives.
   //
   // As a result, it's better to wait until we have a more stable state before
   // continuing.
   var div;
   var promiseCallbackDone = false;
-  return waitForDocLoad().then(function() {
+  return waitForDocLoad().then(() => {
     div = addDiv(t);
 
     return waitForPaints();
-  }).then(function() {
+  }).then(() => {
     div.style.animation = 'empty 1000s';
     var animation = div.getAnimations()[0];
 
-    animation.ready.then(function() {
+    animation.ready.then(() => {
       promiseCallbackDone = true;
-    }).catch(function() {
+    }).catch(() => {
       assert_unreached('ready promise was rejected');
     });
 
     // We need to wait for up to three frames. This is because in some
     // cases it can take up to two frames for the initial layout
     // to take place. Even after that happens we don't actually resolve the
     // ready promise until the following tick.
     return waitForAnimationFrames(3);
-  }).then(function() {
+  }).then(() => {
     assert_true(promiseCallbackDone,
                 'ready promise for an empty animation was resolved'
                 + ' within three animation frames');
   });
 }, 'Animation.ready is resolved for an empty animation');
 
 // Test that compositor animations with delays get synced correctly
 //
 // NOTE: It is important that we DON'T use
 // SpecialPowers.DOMWindowUtils.advanceTimeAndRefresh here since that takes
 // us through a different code path.
-promise_test(function(t) {
+promise_test(t => {
   assert_false(SpecialPowers.DOMWindowUtils.isTestControllingRefreshes,
                'Test should run without the refresh driver being under'
                + ' test control');
 
   // This test only applies to compositor animations
   if (!isOMTAEnabled()) {
     return;
   }
@@ -117,17 +117,17 @@ promise_test(function(t) {
 }, 'Starting an animation with a delay starts from the correct point');
 
 // Test that compositor animations with a playback rate start at the
 // appropriate point.
 //
 // NOTE: As with the previous test, it is important that we DON'T use
 // SpecialPowers.DOMWindowUtils.advanceTimeAndRefresh here since that takes
 // us through a different code path.
-promise_test(function(t) {
+promise_test(t => {
   assert_false(SpecialPowers.DOMWindowUtils.isTestControllingRefreshes,
                'Test should run without the refresh driver being under'
                + ' test control');
 
   // This test only applies to compositor animations
   if (!isOMTAEnabled()) {
     return;
   }