Skip to content

Commit

Permalink
Auto merge of #14605 - emilio:crashtest-bug-1323717, r=SimonSapin
Browse files Browse the repository at this point in the history
style: Avoid ending up with an invalid keyframe when inf or NaN are a…

<!-- Please describe your changes on the following line: -->

Fixes: https://bugzilla.mozilla.org/show_bug.cgi?id=1323717

r? @SimonSapin

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14605)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Dec 16, 2016
2 parents 7fecaa3 + fa01716 commit da42fea
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
5 changes: 3 additions & 2 deletions components/style/keyframes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ impl KeyframePercentage {
KeyframePercentage::new(1.)
} else {
let percentage = try!(input.expect_percentage());
if percentage > 1. || percentage < 0. {
if percentage >= 0. && percentage <= 1. {
KeyframePercentage::new(percentage)
} else {
return Err(());
}
KeyframePercentage::new(percentage)
};

Ok(percentage)
Expand Down
6 changes: 6 additions & 0 deletions tests/wpt/mozilla/meta/MANIFEST.json
Original file line number Diff line number Diff line change
Expand Up @@ -8294,6 +8294,12 @@
"url": "/_mozilla/mozilla/iterable.html"
}
],
"mozilla/keyframe-infinite-percentage.html": [
{
"path": "mozilla/keyframe-infinite-percentage.html",
"url": "/_mozilla/mozilla/keyframe-infinite-percentage.html"
}
],
"mozilla/lenient_this.html": [
{
"path": "mozilla/lenient_this.html",
Expand Down
15 changes: 15 additions & 0 deletions tests/wpt/mozilla/tests/mozilla/keyframe-infinite-percentage.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!doctype html>
<meta charset="utf-8">
<title>Shouldn't end up with an invalid keyframe when inf or nan are at play.</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
@keyframes anim {
0e309% {}
}
</style>
<script>
test(function() {
assert_true(true, "Doesn't crash");
}, "Doesn't crash");
</script>

0 comments on commit da42fea

Please sign in to comment.