Ignore:
Timestamp:
Mar 13, 2012, 7:12:25 PM (13 years ago)
Author:
[email protected]
Message:

Type conversion of exponential part failed
https://bugs.webkit.org/show_bug.cgi?id=80673

Reviewed by Geoffrey Garen.

  • parser/Lexer.cpp:

(JSC::::lex):

  • runtime/JSGlobalObjectFunctions.cpp:

(JSC::parseInt):
(JSC):
(JSC::jsStrDecimalLiteral): Added another template argument that exposes whether or not
we accept trailing junk to clients of jsStrDecimalLiteral. Also added additional template
parameter for strtod to allow trailing spaces.
(JSC::toDouble):
(JSC::parseFloat): Accept trailing junk, as per the ECMA 262 spec (15.1.2.3).

  • runtime/LiteralParser.cpp:

(JSC::::Lexer::lexNumber):

  • tests/mozilla/expected.html: Update the expected page for run-javascriptcore-tests so that

we will run ecma/TypeConversion/9.3.1-3.js as a regression test now.

  • wtf/dtoa.cpp:

(WTF):
(WTF::strtod): We also needed to sometimes accept trailing spaces to pass a few other tests that were
broken by changing the default allowance of trailing junk in jsStrDecimalLiteral.

  • wtf/dtoa.h:
  • wtf/dtoa/double-conversion.cc: When the AdvanceToNonspace function was lifted out of the

Chromium codebase, the person porting it only thought to check for spaces when skipping whitespace.
A few of our JSC tests check for other types of trailing whitespace, so I've added checks for those
here to cover those cases (horizontal tab, vertical tab, carriage return, form feed, and line feed).

  • wtf/text/WTFString.cpp:

(WTF::toDoubleType): Disallow trailing spaces, as this breaks form input verification stuff.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/wtf/dtoa.h

    r107625 r110657  
    3737
    3838enum AllowTrailingJunkTag { DisallowTrailingJunk = 0, AllowTrailingJunk };
     39enum AllowTrailingSpacesTag { DisallowTrailingSpaces = 0, AllowTrailingSpaces };
    3940
    4041// s00: input string. Must not be 0 and must be terminated by 0.
    4142// se: *se will have the last consumed character position + 1.
    42 template<AllowTrailingJunkTag allowTrailingJunk>
     43template<AllowTrailingJunkTag allowTrailingJunk, AllowTrailingSpacesTag allowTrailingSpaces>
    4344double strtod(const char* s00, char** se);
    4445
Note: See TracChangeset for help on using the changeset viewer.