Bug 16672

Summary: Number.toString does not throw exceptions like it should
Product: WebKit Reporter: Eric Seidel (no email) <eric>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.4   
Bug Depends on:    
Bug Blocks: 16652    
Attachments:
Description Flags
Reviewed by Sam. sam: review+

Description Eric Seidel (no email) 2007-12-30 00:16:58 PST
Number.toString does not throw exceptions like it should

Patch to fix this coming up.
Comment 1 Eric Seidel (no email) 2007-12-30 00:17:58 PST
Created attachment 18180 [details]
        Reviewed by Sam.


        Update Number.toString to properly throw exceptions.
        Cleanup code in Number.toString implementation.

        * kjs/number_object.cpp:
        (KJS::numberToString):
        * kjs/object.cpp:
        (KJS::Error::create): Remove bogus debug lines.
---
 JavaScriptCore/ChangeLog                           |   12 +++
 JavaScriptCore/kjs/number_object.cpp               |  100 +++++++++++---------
 JavaScriptCore/kjs/object.cpp                      |   12 ---
 LayoutTests/ChangeLog                              |   13 +++
 .../fast/js/number-toExponential-expected.txt      |   12 ++-
 LayoutTests/fast/js/number-toExponential.html      |   13 +++
 LayoutTests/fast/js/number-toString-expected.txt   |   25 +++---
 LayoutTests/fast/js/resources/number-toString.js   |    1 +
 8 files changed, 114 insertions(+), 74 deletions(-)
Comment 2 Sam Weinig 2007-12-30 00:37:45 PST
Comment on attachment 18180 [details]
        Reviewed by Sam.

This can be move up a little to return a little earlier.
+    double x = v->toNumber(exec);
+    if (isnan(x) || isinf(x))
+        return jsString(UString::from(x));

The change to object.cpp seems unrelated.

We should also test toString() with a fractional argument.

r=me
Comment 3 Eric Seidel (no email) 2007-12-30 00:43:13 PST
r29036