Changeset 9842 in webkit for trunk/JavaScriptCore/kjs


Ignore:
Timestamp:
Jul 19, 2005, 7:23:57 PM (20 years ago)
Author:
ggaren
Message:

-fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=3991
JSC doesn't implement Array.prototype.toLocaleString()

-test failure: ecma_3/Array/15.4.4.3-1.js

Reviewed by mjs.

  • kjs/array_object.cpp: (ArrayProtoFuncImp::call): now searches for toString and toLocaleString overrides in the array's elements
  • tests/mozilla/expected.html: failures are under 100! woohoo!
File:
1 edited

Legend:

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

    r9768 r9842  
    450450  switch (id) {
    451451  case ToLocaleString:
    452     // TODO  - see 15.4.4.3
    453     // fall through
    454452  case ToString:
    455453
     
    461459
    462460    // fall through
    463 
    464461  case Join: {
    465462    UString separator = ",";
     
    471468      if (k >= 1)
    472469        str += separator;
    473       Value element = thisObj.get(exec,k);
    474       if (element.type() != UndefinedType && element.type() != NullType)
    475         str += element.toString(exec);
     470     
     471      Value element = thisObj.get(exec, k);
     472      if (element.type() == UndefinedType || element.type() == NullType)
     473        continue;
     474
     475      Object o = element.toObject(exec);
     476      Object conversionFunction;
     477      if (id == ToLocaleString) {
     478        conversionFunction = Object::dynamicCast(o.get(exec, toLocaleStringPropertyName));
     479      } else {
     480        conversionFunction = Object::dynamicCast(o.get(exec, toStringPropertyName));
     481      }
     482      str += conversionFunction.call(exec, o, List()).toString(exec);
     483     
    476484      if ( exec->hadException() )
    477         break;
     485        break;
    478486    }
    479487    result = String(str);
Note: See TracChangeset for help on using the changeset viewer.