Bug 1333539 - Part 1: Do not try to send animations without timeline. r=birtles

1333539-2.html is the test case that crashes without |!aAnimation->GetTimeline()|
check in AddAnimationForProperty().

MozReview-Commit-ID: 8UxYL8o63E1

--HG--
extra : rebase_source : af3247df257bc79e507113e2843854f478675a5b
This commit is contained in:
Hiroyuki Ikezoe 2017-02-02 15:11:15 +09:00
Родитель 4d5ef610ea
Коммит e07498e3e8
5 изменённых файлов: 70 добавлений и 1 удалений

Просмотреть файл

@ -279,6 +279,7 @@ public:
bool IsPlaying() const
{
return mPlaybackRate != 0.0 &&
mTimeline &&
(PlayState() == AnimationPlayState::Running ||
mPendingState == PendingState::PlayPending);
}

Просмотреть файл

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<meta charset="UTF-8">
<script>
window.onload = function(){
let body = document.getElementsByTagName("body")[0];
let target = document.createElement("div");
let anim1 = new Animation();
let anim2 = new Animation();
let effect = new KeyframeEffect(target, { opacity: [ 0, 1 ] }, 1000);
body.appendChild(target);
target.appendChild(document.createElement("meter"));
anim1.startTime = 88;
anim1.timeline = null;
anim1.pause();
anim1.effect = effect;
anim2.effect = effect;
anim1.effect = effect;
Promise.all([anim1.ready, anim2.ready]).then(function() {
document.documentElement.classList.remove("reftest-wait");
});
};
</script>
</head>
<body></body>
</html>

Просмотреть файл

@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
div {
width: 100px;
height: 100px;
background-color: blue;
}
</style>
<script>
window.onload = function(){
let body = document.getElementsByTagName("body")[0];
let target = document.createElement("div");
let anim1 = new Animation();
let anim2 = new Animation();
let effect = new KeyframeEffect(target, { opacity: [ 0, 1 ] }, 1000);
body.appendChild(target);
anim1.startTime = 88;
anim1.timeline = null;
anim1.pause();
anim1.effect = effect;
anim2.effect = effect;
anim1.effect = effect;
// Put another opacity animation on the top of the effect stack so that we
// try to send a lower priority animation that has no timeline to the
// compositor.
let anim3 = target.animate({ opacity : [ 1, 0 ] }, 1000);
Promise.all([anim1.ready, anim2.ready, anim2.ready]).then(function() {
document.documentElement.classList.remove("reftest-wait");
});
};
</script>
</head>
<body></body>
</html>

Просмотреть файл

@ -21,4 +21,6 @@ skip-if(stylo) pref(dom.animations-api.core.enabled,true) load 1325193-1.html #
skip-if(stylo) pref(dom.animations-api.core.enabled,true) load 1330190-1.html # bug 1311257
skip-if(stylo) pref(dom.animations-api.core.enabled,true) load 1330190-2.html # bug 1311257
skip-if(stylo) pref(dom.animations-api.core.enabled,true) load 1330513-1.html # bug 1311257
skip-if(stylo) pref(dom.animations-api.core.enabled,true) load 1333539-1.html
skip-if(stylo) pref(dom.animations-api.core.enabled,true) load 1333539-2.html
skip-if(stylo) pref(dom.animations-api.core.enabled,true) load 1333418-1.html # bug 1311257

Просмотреть файл

@ -517,7 +517,7 @@ AddAnimationForProperty(nsIFrame* aFrame, const AnimationProperty& aProperty,
const ComputedTiming computedTiming =
aAnimation->GetEffect()->GetComputedTiming();
Nullable<TimeDuration> startTime = aAnimation->GetCurrentOrPendingStartTime();
animation->startTime() = startTime.IsNull()
animation->startTime() = startTime.IsNull() || !aAnimation->GetTimeline()
? TimeStamp()
: aAnimation->GetTimeline()->
ToTimeStamp(startTime.Value());