Bug 1413817 - Use arrow function in file_restyles.html. r?birtles
MozReview-Commit-ID: AcjDRK36d9d
--- 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');