Bug 1242872 - Part 9: Should not assume any order of animations in MurationObserver. r?pbrosset
After patch 7, the order of animations in MutationObserver has been reversed.
When we want to use the animations ordering by something, we need to sort it first.
MozReview-Commit-ID: 7xOYNsuSbvA
--- a/devtools/server/tests/browser/browser_animation_emitMutations.js
+++ b/devtools/server/tests/browser/browser_animation_emitMutations.js
@@ -25,20 +25,20 @@ add_task(function*() {
yield node.modifyAttributes([
{attributeName: "class", newValue: "multiple-animations"}
]);
let changes = yield onMutations;
ok(true, "The mutations event was emitted");
is(changes.length, 2, "There are 2 changes in the mutation event");
ok(changes.every(({type}) => type === "added"), "Both changes are additions");
- is(changes[0].player.initialState.name, "move",
- "The first added animation is 'move'");
- is(changes[1].player.initialState.name, "glow",
- "The first added animation is 'glow'");
+
+ let names = changes.map(c => c.player.initialState.name).sort();
+ is(names[0], "glow", "The animation 'glow' was added");
+ is(names[1], "move", "The animation 'move' was added");
info("Store the 2 new players for comparing later");
let p1 = changes[0].player;
let p2 = changes[1].player;
info("Listen for removed animations");
onMutations = once(animations, "mutations");