Changeset 17610 in webkit
- Timestamp:
- Nov 6, 2006 12:30:01 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r17587 r17610 1 2006-11-06 Mark Rowe <bdash@webkit.org> 2 3 Reviewed by the wonderful Mitz Pettel. 4 5 http://bugs.webkit.org/show_bug.cgi?id=11524 6 Bug 11524: REGRESSION(r9842): Array.prototype.join should use ToString operator rather than calling toString on each element 7 8 * kjs/array_object.cpp: 9 (ArrayProtoFunc::callAsFunction): Use ToString operator on each element rather than calling their toString method. 10 1 11 2006-11-03 Steve Falkenburg <sfalken@apple.com> 2 12 -
trunk/JavaScriptCore/kjs/array_object.cpp
r17372 r17610 470 470 static HashSet<JSObject*> visitedElems; 471 471 if (visitedElems.contains(thisObj)) 472 return jsString("");472 return jsString(""); 473 473 UString separator = ","; 474 474 UString str = ""; … … 476 476 visitedElems.add(thisObj); 477 477 if (id == Join && !args[0]->isUndefined()) 478 separator = args[0]->toString(exec);478 separator = args[0]->toString(exec); 479 479 for (unsigned int k = 0; k < length; k++) { 480 if (k >= 1)481 str += separator;482 483 JSValue *element = thisObj->get(exec, k);484 if (element->isUndefinedOrNull())485 continue;486 487 bool fallback = false;488 if (id == ToLocaleString) {489 JSObject *o = element->toObject(exec);490 JSValue *conversionFunction = o->get(exec, toLocaleStringPropertyName);491 if (conversionFunction->isObject() && static_cast<JSObject *>(conversionFunction)->implementsCall()) {492 str += static_cast<JSObject*>(conversionFunction)->call(exec, o, List())->toString(exec);493 } else {494 // try toString() fallback495 fallback = true;480 if (k >= 1) 481 str += separator; 482 483 JSValue* element = thisObj->get(exec, k); 484 if (element->isUndefinedOrNull()) 485 continue; 486 487 bool fallback = false; 488 if (id == ToLocaleString) { 489 JSObject* o = element->toObject(exec); 490 JSValue* conversionFunction = o->get(exec, toLocaleStringPropertyName); 491 if (conversionFunction->isObject() && static_cast<JSObject*>(conversionFunction)->implementsCall()) 492 str += static_cast<JSObject*>(conversionFunction)->call(exec, o, List())->toString(exec); 493 else 494 // try toString() fallback 495 fallback = true; 496 496 } 497 } 498 499 if (id == ToString || id == Join || fallback) { 500 if (element->isObject()) { 501 JSObject *o = static_cast<JSObject *>(element); 502 JSValue *conversionFunction = o->get(exec, toStringPropertyName); 503 if (conversionFunction->isObject() && static_cast<JSObject *>(conversionFunction)->implementsCall()) { 504 str += static_cast<JSObject *>(conversionFunction)->call(exec, o, List())->toString(exec); 505 } else { 506 visitedElems.remove(thisObj); 507 return throwError(exec, RangeError, "Can't convert " + o->className() + " object to string"); 508 } 509 } else { 510 str += element->toString(exec); 511 } 512 } 513 514 if ( exec->hadException() ) 515 break; 497 498 if (id == ToString || id == Join || fallback) 499 str += element->toString(exec); 500 501 if (exec->hadException()) 502 break; 516 503 } 517 504 visitedElems.remove(thisObj); -
trunk/LayoutTests/ChangeLog
r17591 r17610 1 2006-11-06 Mark Rowe <bdash@webkit.org> 2 3 Reviewed by the wonderful Mitz Pettel. 4 5 Test for http://bugs.webkit.org/show_bug.cgi?id=11524 6 Bug 11524: REGRESSION(r9842): Array.prototype.join should use ToString operator rather than calling toString on each element 7 8 * fast/js/array-join-bug-11524-expected.txt: Added. 9 * fast/js/array-join-bug-11524.html: Added. 10 * fast/js/resources/array-join-bug-11524.js: Added. 11 1 12 2006-11-04 Alexey Proskuryakov <ap@nypop.com> 2 13
Note: See TracChangeset
for help on using the changeset viewer.