Changeset 29459 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Jan 14, 2008, 1:12:18 AM (17 years ago)
Author:
[email protected]
Message:

Reviewed by David Kilzer.

http://bugs.webkit.org/show_bug.cgi?id=16787
array.splice() with 1 element not working

Test: fast/js/array-splice.html

  • kjs/array_object.cpp: (KJS::ArrayProtoFuncSplice::callAsFunction): Implement this Mozilla extension, and fix some other edge cases.
Location:
trunk/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r29458 r29459  
     12008-01-14  Alexey Proskuryakov  <[email protected]>
     2
     3        Reviewed by David Kilzer.
     4
     5        http://bugs.webkit.org/show_bug.cgi?id=16787
     6        array.splice() with 1 element not working
     7
     8        Test: fast/js/array-splice.html
     9
     10        * kjs/array_object.cpp:
     11        (KJS::ArrayProtoFuncSplice::callAsFunction): Implement this Mozilla extension, and fix
     12        some other edge cases.
     13
    1142008-01-13  Steve Falkenburg  <[email protected]>
    215
  • trunk/JavaScriptCore/kjs/array_object.cpp

    r29067 r29459  
    431431    JSValue* result = resObj;
    432432    unsigned length = thisObj->get(exec, exec->propertyNames().length)->toUInt32(exec);
     433    if (!args.size())
     434        return jsUndefined();
    433435    int begin = args[0]->toUInt32(exec);
    434436    if (begin < 0)
     
    436438    else
    437439        begin = std::min<int>(begin, length);
    438     unsigned int deleteCount = std::min<int>(std::max<int>(args[1]->toUInt32(exec), 0), length - begin);
     440
     441    unsigned int deleteCount;
     442    if (args.size() > 1)
     443        deleteCount = std::min<int>(std::max<int>(args[1]->toUInt32(exec), 0), length - begin);
     444    else
     445        deleteCount = length - begin;
    439446
    440447    for (unsigned int k = 0; k < deleteCount; k++) {
Note: See TracChangeset for help on using the changeset viewer.