Changeset 114195 in webkit


Ignore:
Timestamp:
Apr 13, 2012 6:29:00 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Unreviewed, rolling out r114185.
http://trac.webkit.org/changeset/114185
https://bugs.webkit.org/show_bug.cgi?id=83967

Broke a bunch of JavaScript related tests (Requested by
andersca on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-04-13

  • runtime/ArrayPrototype.cpp:

(JSC::arrayProtoFuncToString):
(JSC::arrayProtoFuncToLocaleString):

  • runtime/CommonIdentifiers.h:
  • tests/mozilla/ecma/Array/15.4.4.2.js:

(getTestCases):

Location:
trunk/Source/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r114192 r114195  
     12012-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
    1172012-04-13  Gavin Barraclough  <barraclough@apple.com>
    218
  • trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp

    r114185 r114195  
    255255    JSValue thisValue = exec->hostThisValue();
    256256
    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);
    274260    JSArray* thisObj = asArray(thisValue);
    275 
     261   
    276262    unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
    277263    if (exec->hadException())
     
    288274    for (unsigned k = 0; k < length; k++) {
    289275        JSValue element;
    290         if (thisObj->canGetIndex(k))
     276        if (isRealArray && thisObj->canGetIndex(k))
    291277            element = thisObj->getIndex(k);
    292278        else
     
    346332    JSValue thisValue = exec->hostThisValue();
    347333
    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);
    351337
    352338    unsigned length = thisObj->get(exec, exec->propertyNames().length).toUInt32(exec);
     
    375361                str = call(exec, conversionFunction, callType, callData, element, exec->emptyList()).toUString(exec);
    376362            else
    377                 return throwVMTypeError(exec);
     363                str = element.toUString(exec);
    378364            if (exec->hadException())
    379365                return JSValue::encode(jsUndefined());
    380366            stringJoiner.append(str);
    381         } else
    382             return JSValue::encode(jsEmptyString(exec));
     367        }
    383368    }
    384369
  • trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h

    r114185 r114195  
    7373    macro(valueOf) \
    7474    macro(writable) \
    75     macro(displayName)\
    76     macro(join)
     75    macro(displayName)
    7776
    7877#define JSC_COMMON_IDENTIFIERS_EACH_KEYWORD(macro) \
  • trunk/Source/JavaScriptCore/tests/mozilla/ecma/Array/15.4.4.2.js

    r114185 r114195  
    5656    array[item++] = new TestCase( SECTION,  "(new Array(void 0,null)).toString()",    ",",    (new Array(void 0,null)).toString() );
    5757
    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 
    8358    var EXPECT_STRING = "";
    8459    var MYARR = new Array();
     
    9368    array[item++] = new TestCase( SECTION, "MYARR.toString()",  EXPECT_STRING,  MYARR.toString() );
    9469
    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()") );
    9970
    10071    return ( array );
Note: See TracChangeset for help on using the changeset viewer.