Chromium Code Reviews| Index: dart/frog/leg/lib/js_helper.dart |
| diff --git a/dart/frog/leg/lib/js_helper.dart b/dart/frog/leg/lib/js_helper.dart |
| index 6c534e90f663c6203e24d558ce69cb792792849d..1817c5ad354d622daacaa43be50a6bf39e0bec11 100644 |
| --- a/dart/frog/leg/lib/js_helper.dart |
| +++ b/dart/frog/leg/lib/js_helper.dart |
| @@ -1141,7 +1141,13 @@ class MathNatives { |
| checkNull(str); |
| if (str is !String) throw new IllegalArgumentException(); |
| var ret = JS('num', @'parseFloat($0)', str); |
| - if (ret.isNaN() && str != 'NaN') throw new BadNumberFormatException(str); |
| + if (ret == 0 && (str.startsWith("0x") || str.startsWith("0X"))) { |
| + // TODO(ahe): This is unspecified, but tested by co19. |
|
floitsch
2012/02/29 15:33:46
please file a bug that this should not be allowed.
ahe
2012/02/29 18:42:55
I have filed a co19 bug.
|
| + ret = JS('num', @'parseInt($0)', str); |
| + } |
| + if (ret.isNaN() && str != 'NaN' && str != '-NaN') { |
| + throw new BadNumberFormatException(str); |
| + } |
| return ret; |
| } |