Bug 1158551 - calling valueAsString on a length with an invalid string should throw. r=dholbert

This commit is contained in:
Robert Longson 2015-04-28 09:21:52 +01:00
parent be55160c4e
commit 02e303f6e8
2 changed files with 4 additions and 2 deletions

View File

@ -371,7 +371,7 @@ DOMSVGLength::SetValueAsString(const nsAString& aValue, ErrorResult& aRv)
}
if (mVal) {
mVal->SetBaseValueString(aValue, mSVGElement, true);
aRv = mVal->SetBaseValueString(aValue, mSVGElement, true);
return;
}

View File

@ -3,7 +3,7 @@
https://bugzilla.mozilla.org/show_bug.cgi?id=539697
-->
<head>
<title>Test SVGTransform behavior</title>
<title>Test valueAsString behavior</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
@ -35,6 +35,7 @@ function run()
try {
c.r.baseVal.valueAsString = 'rubbish';
ok(false, 'setting a length to rubbish should fail');
} catch (e) {
is(e.name, 'SyntaxError', 'syntax error expected');
is(e.code, DOMException.SYNTAX_ERR, 'syntax error expected');
@ -46,6 +47,7 @@ function run()
try {
m.orientAngle.baseVal.valueAsString = 'rubbish';
ok(false, 'setting an angle to rubbish should fail');
} catch (e) {
is(e.name, 'SyntaxError', 'syntax error expected');
is(e.code, DOMException.SYNTAX_ERR, 'syntax error expected');