Changeset 18715 in webkit for trunk/JavaScriptCore/kjs/value.cpp


Ignore:
Timestamp:
Jan 9, 2007, 9:38:46 AM (18 years ago)
Author:
ap
Message:

2007-01-09 Mitz Pettel <[email protected]>

Reviewed by Darin.

JavaScriptCore:

  • JavaScriptCore.exp:
  • kjs/value.cpp: (KJS::JSValue::toInt32): Folded toInt32Inline into this method, which was its only caller. (KJS::JSValue::toUInt32): Added a variant that reports if the conversion has succeeded.
  • kjs/value.h:

WebCore:

  • bindings/js/kjs_html.cpp: (KJS::JSHTMLCollectionProtoFunc::callAsFunction): Changed item() to fall back to namedItem() if its argument does not convert to a number.

LayoutTests:

  • fast/dom/collection-namedItem-via-item-expected.txt: Added.
  • fast/dom/collection-namedItem-via-item.html: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/value.cpp

    r17372 r18715  
    5656}
    5757
    58 inline int32_t JSValue::toInt32Inline(ExecState* exec, bool& ok) const
     58int32_t JSValue::toInt32(ExecState* exec) const
     59{
     60    bool ok;
     61    return toInt32(exec, ok);
     62}
     63
     64int32_t JSValue::toInt32(ExecState* exec, bool& ok) const
    5965{
    6066    ok = true;
     
    7985}
    8086
    81 int32_t JSValue::toInt32(ExecState* exec) const
     87uint32_t JSValue::toUInt32(ExecState* exec) const
    8288{
    8389    bool ok;
    84     return toInt32(exec, ok);
     90    return toUInt32(exec, ok);
    8591}
    8692
    87 int32_t JSValue::toInt32(ExecState* exec, bool& ok) const
     93uint32_t JSValue::toUInt32(ExecState* exec, bool& ok) const
    8894{
    89     return toInt32Inline(exec, ok);
    90 }
     95    ok = true;
    9196
    92 uint32_t JSValue::toUInt32(ExecState *exec) const
    93 {
    9497    uint32_t i;
    9598    if (getUInt32(i))
     
    97100
    98101    double d = roundValue(exec, const_cast<JSValue*>(this));
    99     if (isNaN(d) || isInf(d))
     102    if (isNaN(d) || isInf(d)) {
     103        ok = false;
    100104        return 0;
     105    }
    101106    double d32 = fmod(d, D32);
    102107
Note: See TracChangeset for help on using the changeset viewer.