Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(584)

Issue 157109: Fix toInt32 and toUint32 around NaN and Infinity (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
16 years, 4 months ago by MikeSamuel
Modified:
16 years, 3 months ago
Reviewers:
DavidSarah, davidsarah.hopwood, metaweta
CC:
google-caja-discuss_googlegroups.com
Base URL:
http://google-caja.googlecode.com/svn/trunk/
Visibility:
Public.

Description

Operation.fold depended on a faulty implementation of toInt32 and toUint32. Submitted @3891

Patch Set 1 #

Patch Set 2 : Fix toInt32 and toUint32 around NaN and Infinity #

Total comments: 2

Patch Set 3 : Fix toInt32 and toUint32 around NaN and Infinity #

Patch Set 4 : Fix toInt32 and toUint32 around NaN and Infinity #

Patch Set 5 : Fix toInt32 and toUint32 around NaN and Infinity #

Patch Set 6 : Fix toInt32 and toUint32 around NaN and Infinity #

Unified diffs Side-by-side diffs Delta from patch set Stats (+150 lines, -8 lines) Patch
M src/com/google/caja/parser/js/Operation.java View 1 2 3 4 5 3 chunks +44 lines, -5 lines 0 comments Download
M tests/com/google/caja/parser/js/ExpressionTest.java View 1 2 3 4 chunks +106 lines, -3 lines 0 comments Download

Messages

Total messages: 7
MikeSamuel
16 years, 4 months ago (2009-11-20 16:38:22 UTC) #1
DavidSarah
http://codereview.appspot.com/157109/diff/1003/6 File src/com/google/caja/parser/js/Operation.java (left): http://codereview.appspot.com/157109/diff/1003/6#oldcode681 src/com/google/caja/parser/js/Operation.java:681: return (int) n; (int) converts NaN to 0, so ...
16 years, 4 months ago (2009-11-20 18:23:34 UTC) #2
DavidSarah
This is surprisingly tricky. I think the following is correct. private static final double TwoToThe32 ...
16 years, 4 months ago (2009-11-20 20:01:07 UTC) #3
DavidSarah
Typo in the last comment: should be "in the algorithm for ToUint32". (Note the case ...
16 years, 4 months ago (2009-11-20 20:05:46 UTC) #4
metaweta
Nice tests. LGTM. (It might be worth running them in Rhino once.)
16 years, 3 months ago (2009-12-04 18:47:14 UTC) #5
MikeSamuel
I ran the below in Rhino and got js> load('/tmp/t') js: "/tmp/t", line 2: exception ...
16 years, 3 months ago (2009-12-04 19:00:22 UTC) #6
DavidSarah
16 years, 3 months ago (2009-12-05 01:06:11 UTC) #7
LGTM
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b