Bug 630056 - Don't throw on setting miterLimit and ignore non-positive values; r+a=roc
authorMs2ger <ms2ger@gmail.com>
Wed, 02 Feb 2011 08:46:44 +1300
changeset 61743 301997f0df6207f0d411015b156f62a8da303e56
parent 61742 263e4f35b7975fd80eb6ac0ae7956013c4e82ea8
child 61744 22aa43f18646fef1b3804e7bcf2ed2b88b4536e6
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs630056
milestone2.0b11pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 630056 - Don't throw on setting miterLimit and ignore non-positive values; r+a=roc
content/canvas/src/nsCanvasRenderingContext2D.cpp
content/canvas/test/test_canvas.html
--- a/content/canvas/src/nsCanvasRenderingContext2D.cpp
+++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp
@@ -3163,18 +3163,18 @@ nsCanvasRenderingContext2D::GetLineJoin(
         return NS_ERROR_FAILURE;
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsCanvasRenderingContext2D::SetMiterLimit(float miter)
 {
-    if (!FloatValidate(miter))
-        return NS_ERROR_DOM_SYNTAX_ERR;
+    if (!FloatValidate(miter) || miter <= 0.0)
+        return NS_OK;
 
     mThebes->SetMiterLimit(miter);
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsCanvasRenderingContext2D::GetMiterLimit(float *miter)
 {
--- a/content/canvas/test/test_canvas.html
+++ b/content/canvas/test/test_canvas.html
@@ -9824,38 +9824,38 @@ var ctx = canvas.getContext('2d');
 var _thrown_outer = false;
 try {
 
 ctx.miterLimit = 1.5;
 ok(ctx.miterLimit === 1.5, "ctx.miterLimit === 1.5");
 
 ctx.miterLimit = 1.5;
 ctx.miterLimit = 0;
-todo(ctx.miterLimit === 1.5, "ctx.miterLimit === 1.5");
+ok(ctx.miterLimit === 1.5, "ctx.miterLimit === 1.5");
 
 ctx.miterLimit = 1.5;
 ctx.miterLimit = -1;
-todo(ctx.miterLimit === 1.5, "ctx.miterLimit === 1.5");
+ok(ctx.miterLimit === 1.5, "ctx.miterLimit === 1.5");
 
 ctx.miterLimit = 1.5;
 ctx.miterLimit = Infinity;
-todo(ctx.miterLimit === 1.5, "ctx.miterLimit === 1.5");
+ok(ctx.miterLimit === 1.5, "ctx.miterLimit === 1.5");
 
 ctx.miterLimit = 1.5;
 ctx.miterLimit = -Infinity;
-todo(ctx.miterLimit === 1.5, "ctx.miterLimit === 1.5");
+ok(ctx.miterLimit === 1.5, "ctx.miterLimit === 1.5");
 
 ctx.miterLimit = 1.5;
 ctx.miterLimit = NaN;
-todo(ctx.miterLimit === 1.5, "ctx.miterLimit === 1.5");
-
-} catch (e) {
-    _thrown_outer = true;
-}
-todo(!_thrown_outer, 'should not throw exception');
+ok(ctx.miterLimit === 1.5, "ctx.miterLimit === 1.5");
+
+} catch (e) {
+    _thrown_outer = true;
+}
+ok(!_thrown_outer, 'should not throw exception');
 
 
 }
 </script>
 
 <!-- [[[ test_2d.line.miter.lineedge.html ]]] -->
 
 <p>Canvas test: 2d.line.miter.lineedge - bug 401791</p>