Changeset 114195 in webkit
- Timestamp:
- Apr 13, 2012 6:29:00 PM (12 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r114192 r114195 1 2012-04-13 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r114185. 4 http://trac.webkit.org/changeset/114185 5 https://bugs.webkit.org/show_bug.cgi?id=83967 6 7 Broke a bunch of JavaScript related tests (Requested by 8 andersca on #webkit). 9 10 * runtime/ArrayPrototype.cpp: 11 (JSC::arrayProtoFuncToString): 12 (JSC::arrayProtoFuncToLocaleString): 13 * runtime/CommonIdentifiers.h: 14 * tests/mozilla/ecma/Array/15.4.4.2.js: 15 (getTestCases): 16 1 17 2012-04-13 Gavin Barraclough <barraclough@apple.com> 2 18 -
trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp
r114185 r114195 255 255 JSValue thisValue = exec->hostThisValue(); 256 256 257 JSObject* thisObject = thisValue.toObject(exec); 258 if (exec->hadException()) 259 return JSValue::encode(jsUndefined()); 260 261 JSValue function = JSValue(thisObject).get(exec, exec->propertyNames().join); 262 if (!function.isCell()) 263 return objectProtoFuncToString(exec); 264 265 CallData callData; 266 CallType callType = getCallData(function, callData); 267 if (callType == CallTypeNone) 268 return objectProtoFuncToString(exec); 269 270 if (!isJSArray(thisObject) || callType != CallTypeHost || callData.native.function != arrayProtoFuncJoin) 271 return JSValue::encode(call(exec, function, callType, callData, thisObject, exec->emptyList())); 272 273 ASSERT(isJSArray(thisValue)); 257 bool isRealArray = isJSArray(thisValue); 258 if (!isRealArray && !thisValue.inherits(&JSArray::s_info)) 259 return throwVMTypeError(exec); 274 260 JSArray* thisObj = asArray(thisValue); 275 261 276 262 unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec); 277 263 if (exec->hadException()) … … 288 274 for (unsigned k = 0; k < length; k++) { 289 275 JSValue element; 290 if ( thisObj->canGetIndex(k))276 if (isRealArray && thisObj->canGetIndex(k)) 291 277 element = thisObj->getIndex(k); 292 278 else … … 346 332 JSValue thisValue = exec->hostThisValue(); 347 333 348 JSObject* thisObj = thisValue.toObject(exec);349 if (exec->hadException())350 return JSValue::encode(jsUndefined());334 if (!thisValue.inherits(&JSArray::s_info)) 335 return throwVMTypeError(exec); 336 JSObject* thisObj = asArray(thisValue); 351 337 352 338 unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec); … … 375 361 str = call(exec, conversionFunction, callType, callData, element, exec->emptyList()).toUString(exec); 376 362 else 377 return throwVMTypeError(exec);363 str = element.toUString(exec); 378 364 if (exec->hadException()) 379 365 return JSValue::encode(jsUndefined()); 380 366 stringJoiner.append(str); 381 } else 382 return JSValue::encode(jsEmptyString(exec)); 367 } 383 368 } 384 369 -
trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h
r114185 r114195 73 73 macro(valueOf) \ 74 74 macro(writable) \ 75 macro(displayName)\ 76 macro(join) 75 macro(displayName) 77 76 78 77 #define JSC_COMMON_IDENTIFIERS_EACH_KEYWORD(macro) \ -
trunk/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.2.js
r114185 r114195 56 56 array[item++] = new TestCase( SECTION, "(new Array(void 0,null)).toString()", ",", (new Array(void 0,null)).toString() ); 57 57 58 array[item++] = new TestCase( SECTION,59 "{__proto__: Array.prototype, 0: 'a', 1: 'b', 2: 'c', length: 3}.toString()",60 "a,b,c",61 {__proto__: Array.prototype, 0: 'a', 1: 'b', 2: 'c', length: 3}.toString() );62 array[item++] = new TestCase( SECTION,63 "{__proto__: Array.prototype, 0: 'a', 1: 'b', 2: 'c', join: function() { return 'join' }}.toString()",64 "join",65 {__proto__: Array.prototype, 0: 'a', 1: 'b', 2: 'c', join: function() { return 'join' }}.toString() );66 array[item++] = new TestCase( SECTION,67 "Array.prototype.toString.call({join: function() { return 'join' }})",68 "join",69 Array.prototype.toString.call({join: function() { return 'join' }}) );70 array[item++] = new TestCase( SECTION,71 "Array.prototype.toString.call({sort: function() { return 'sort' }})",72 "[object Object]",73 Array.prototype.toString.call({sort: function() { return 'sort' }}) );74 array[item++] = new TestCase( SECTION,75 "Array.prototype.toString.call(new Date)",76 "[object Date]",77 Array.prototype.toString.call(new Date) );78 array[item++] = new TestCase( SECTION,79 "Number.prototype.join = function() { return 'number join' }; Array.prototype.toString.call(42)",80 "number join",81 eval("Number.prototype.join = function() { return 'number join' }; Array.prototype.toString.call(42)") );82 83 58 var EXPECT_STRING = ""; 84 59 var MYARR = new Array(); … … 93 68 array[item++] = new TestCase( SECTION, "MYARR.toString()", EXPECT_STRING, MYARR.toString() ); 94 69 95 array[item++] = new TestCase( SECTION,96 "Array.prototype.join = function() { return 'join' }; [0, 1, 2].toString()",97 "join",98 eval("Array.prototype.join = function() { return 'join' }; [0, 1, 2].toString()") );99 70 100 71 return ( array );
Note: See TracChangeset
for help on using the changeset viewer.