Ignore:
Timestamp:
Jul 12, 2010, 2:32:34 PM (15 years ago)
Author:
Darin Adler
Message:

2010-07-09 Darin Adler <Darin Adler>

Reviewed by Geoffrey Garen.

String to number coercion is not spec compliant
https://bugs.webkit.org/show_bug.cgi?id=31349

ToNumber should ignore NBSP (\u00a0)
https://bugs.webkit.org/show_bug.cgi?id=25490

  • runtime/JSGlobalObjectFunctions.cpp: (JSC::parseIntOverflow): Added a version that works on UChar.
  • runtime/JSGlobalObjectFunctions.h: Ditto.
  • runtime/UString.cpp: (JSC::isInfinity): Added helper functions. (JSC::UString::toDouble): Use isStrWhiteSpace instead of isSASCIISpace to define what we should skip. Got rid of the code that used CString and UTF8String, instead processing the UChar of the string directly, except for when we call strtod. For strtod, use our own home-grown conversion function that does not try to do any UTF-16 processing. Tidied up the logic a bit as well.

2010-07-09 Darin Adler <Darin Adler>

Reviewed by Geoffrey Garen.

String to number coercion is not spec compliant
https://bugs.webkit.org/show_bug.cgi?id=31349

  • fast/js/ToNumber-expected.txt: Updated to expect more tests to pass.
  • fast/js/parseFloat-expected.txt: Ditto.
  • fast/js/sputnik/Conformance/09_Type_Conversion/9.3_ToNumber/9.3.1_ToNumber_from_String/S9.3.1_A2-expected.txt: Ditto.
  • fast/js/sputnik/Conformance/09_Type_Conversion/9.3_ToNumber/9.3.1_ToNumber_from_String/S9.3.1_A3_T1-expected.txt: Ditto.
  • fast/js/sputnik/Conformance/09_Type_Conversion/9.3_ToNumber/9.3.1_ToNumber_from_String/S9.3.1_A3_T2-expected.txt: Ditto.
  • fast/js/sputnik/Conformance/15_Native_Objects/15.1_The_Global_Object/15.1.2/15.1.2.3_parseFloat/S15.1.2.3_A2_T10-expected.txt: Ditto.
  • fast/js/sputnik/Conformance/15_Native_Objects/15.1_The_Global_Object/15.1.2/15.1.2.3_parseFloat/S15.1.2.3_A2_T3-expected.txt: Ditto.
  • fast/js/sputnik/Conformance/15_Native_Objects/15.1_The_Global_Object/15.1.2/15.1.2.3_parseFloat/S15.1.2.3_A2_T8-expected.txt: Ditto.
  • fast/js/sputnik/Conformance/15_Native_Objects/15.1_The_Global_Object/15.1.2/15.1.2.3_parseFloat/S15.1.2.3_A2_T9-expected.txt: Ditto.
  • fast/js/sputnik/Conformance/15_Native_Objects/15.1_The_Global_Object/15.1.2/15.1.2.3_parseFloat/S15.1.2.3_A6-expected.txt: Ditto.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/JSGlobalObjectFunctions.h

    r60631 r63120  
    11/*
    22 *  Copyright (C) 1999-2000 Harri Porten ([email protected])
    3  *  Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
     3 *  Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
    44 *  Copyright (C) 2007 Cameron Zwarich ([email protected])
    55 *  Copyright (C) 2007 Maks Orlovich
     
    5454    static const double mantissaOverflowLowerBound = 9007199254740992.0;
    5555    double parseIntOverflow(const char*, int length, int radix);
     56    double parseIntOverflow(const UChar*, int length, int radix);
    5657    bool isStrWhiteSpace(UChar);
    5758
Note: See TracChangeset for help on using the changeset viewer.