Use a BTreeMap for Document::animation_frame_list (fixes #9834)

The callbacks must stay ordered.
This commit is contained in:
Anthony Ramine 2016-03-02 14:23:47 +01:00
parent f7db68eff7
commit 1d87f61350
4 changed files with 66 additions and 10 deletions

View file

@ -5562,6 +5562,12 @@
"url": "/_mozilla/mozilla/collections.html"
}
],
"mozilla/deterministic-raf.html": [
{
"path": "mozilla/deterministic-raf.html",
"url": "/_mozilla/mozilla/deterministic-raf.html"
}
],
"mozilla/documentElement.html": [
{
"path": "mozilla/documentElement.html",

View file

@ -0,0 +1,43 @@
<!doctype html>
<meta charset="utf-8">
<title></title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
async_test(function (t) {
var i = 0;
var log = [];
var loopB_ended = false;
var loopA = function () {
log.push("A");
if (i++ < 5) {
requestAnimationFrame(loopA);
} else {
assert_true(loopB_ended);
t.step(function () {
assert_array_equals(log,
["A", "B", "A", "B", "A", "B", "A", "B", "A", "B", "A"]);
});
t.done();
}
};
var loopB = function () {
log.push("B");
if (i < 5) {
requestAnimationFrame(loopB);
} else {
assert_false(loopB_ended);
loopB_ended = true;
t.step(function () {
assert_array_equals(log,
["A", "B", "A", "B", "A", "B", "A", "B", "A", "B"]);
});
}
};
loopA();
loopB();
}, "Concurrent requestAnimationFrame loops are deterministic");
</script>