Ignore:
Timestamp:
Jul 12, 2003, 9:01:36 AM (22 years ago)
Author:
darin
Message:

Reviewed by Dave.

  • fixed 3272777 -- array object indices treated as integers by Safari, but as strings in other web browsers

JavaScriptCore did not implement the proper rule for what an array index is.

  • kjs/array_object.cpp: (getArrayIndex): Added. Implements the rule from the specification, which also provides a handy "not an array index" value of 232-1. (ArrayInstanceImp::get): Use getArrayIndex. (ArrayInstanceImp::put): Ditto. (ArrayInstanceImp::hasProperty): Ditto. (ArrayInstanceImp::setLength): Ditto.
  • kjs/identifier.h: Removed now-unused toULong, and added toStrictUInt32, in both cases forwarding functions that forward to UString.
  • kjs/ustring.h: Added toStringUInt32.
  • kjs/ustring.cpp: (UString::toStrictUInt32): Added. Converts a string to a 32-bit unsigned integer, and rejects any string that does not exactly match the way the integer would be formatted on output. This is the rule documented in the ECMA language standard.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/identifier.h

    r4206 r4630  
    5151        bool isEmpty() const { return _ustring.isEmpty(); }
    5252       
    53         unsigned long toULong(bool *ok) const { return _ustring.toULong(ok); }
    5453        uint32_t toUInt32(bool *ok) const { return _ustring.toUInt32(ok); }
     54        uint32_t toStrictUInt32(bool *ok) const { return _ustring.toStrictUInt32(ok); }
    5555        double toDouble() const { return _ustring.toDouble(); }
    5656       
Note: See TracChangeset for help on using the changeset viewer.