diff --git a/mozilla/js2/src/js2array.cpp b/mozilla/js2/src/js2array.cpp index 52caa31e8ef..d7af7490102 100644 --- a/mozilla/js2/src/js2array.cpp +++ b/mozilla/js2/src/js2array.cpp @@ -148,7 +148,10 @@ static js2val Array_toString(JS2Metadata *meta, const js2val thisValue, js2val * && !JS2VAL_IS_NULL(result) ) s->append(*meta->toString(result)); if (i < (length - 1)) - s->append(widenCString(",")); + if (meta->version == JS2VERSION_1_2) + s->append(widenCString(", ")); + else + s->append(widenCString(",")); } if (meta->version == JS2VERSION_1_2) s->append(widenCString("]")); diff --git a/mozilla/js2/src/js2metadata.cpp b/mozilla/js2/src/js2metadata.cpp index 0d02d2e4254..be2adcb4297 100644 --- a/mozilla/js2/src/js2metadata.cpp +++ b/mozilla/js2/src/js2metadata.cpp @@ -3953,7 +3953,7 @@ static const uint8 urlCharType[256] = JS2Object *obj = JS2VAL_TO_OBJECT(thisValue); ArrayInstance *arrInst = checked_cast(obj); - uint32 newLength = meta->valToUint32(argv[0]); + uint32 newLength = meta->valToUInt32(argv[0]); if (newLength < arrInst->length) { // need to delete all the elements above the new length bool deleteResult; diff --git a/mozilla/js2/src/js2op_arithmetic.cpp b/mozilla/js2/src/js2op_arithmetic.cpp index 6abd9c17a39..f976baa1526 100644 --- a/mozilla/js2/src/js2op_arithmetic.cpp +++ b/mozilla/js2/src/js2op_arithmetic.cpp @@ -92,7 +92,7 @@ b = pop(); a = pop(); a = meta->toGeneralNumber(a); - int32 count = meta->toInt32(b); + int32 count = meta->valToInt32(b); if (JS2VAL_IS_LONG(a)) { int64 r; JSLL_SHL(r, *JS2VAL_TO_LONG(a), count & 0x3F); @@ -113,7 +113,7 @@ b = pop(); a = pop(); a = meta->toGeneralNumber(a); - int32 count = meta->toInt32(b); + int32 count = meta->valToInt32(b); if (JS2VAL_IS_LONG(a)) { int64 r; JSLL_SHR(r, *JS2VAL_TO_LONG(a), count & 0x3F); @@ -134,7 +134,7 @@ b = pop(); a = pop(); a = meta->toGeneralNumber(a); - int32 count = meta->toInt32(b); + int32 count = meta->valToInt32(b); if (JS2VAL_IS_LONG(a)) { int64 r; JSLL_SHR(r, *JS2VAL_TO_LONG(a), count & 0x3F); @@ -147,7 +147,7 @@ pushULong(r); } else - pushNumber(meta->toUInt32(a) >> (count & 0x1F)); + pushNumber(meta->valToUInt32(a) >> (count & 0x1F)); } break; case eBitwiseAnd: diff --git a/mozilla/js2/src/js2string.cpp b/mozilla/js2/src/js2string.cpp index 832b2239382..30aa9a1064e 100644 --- a/mozilla/js2/src/js2string.cpp +++ b/mozilla/js2/src/js2string.cpp @@ -411,7 +411,7 @@ static js2val String_split(JS2Metadata *meta, const js2val thisValue, js2val *ar if (JS2VAL_IS_UNDEFINED(limitV)) lim = JS2Engine::float64toUInt32(two32minus1); else - lim = meta->toUInt32(limitV); + lim = meta->valToUInt32(limitV); uint32 s = S->size(); uint32 p = 0; @@ -495,7 +495,7 @@ static js2val String_charAt(JS2Metadata *meta, const js2val thisValue, js2val *a uint32 pos = 0; if (argc > 0) - pos = meta->toUInt32(argv[0]); + pos = meta->valToUInt32(argv[0]); if ((pos < 0) || (pos >= str->size())) return STRING_TO_JS2VAL(meta->engine->Empty_StringAtom); @@ -509,14 +509,14 @@ static js2val String_charCodeAt(JS2Metadata *meta, const js2val thisValue, js2va const String *str = meta->toString(thisValue); DEFINE_ROOTKEEPER(rk, str); - uint32 pos = 0; + float64 posd = 0.0; if (argc > 0) - pos = meta->toUInt32(argv[0]); + posd = meta->toInteger(argv[0]); - if ((pos < 0) || (pos >= str->size())) + if ((posd < 0) || (posd >= str->size())) return meta->engine->nanValue; else - return meta->engine->allocNumber((float64)(*str)[pos]); + return meta->engine->allocNumber((float64)(*str)[toUInt32(posd)]); } static js2val String_concat(JS2Metadata *meta, const js2val thisValue, js2val *argv, uint32 argc) @@ -656,7 +656,7 @@ static js2val String_slice(JS2Metadata *meta, const js2val thisValue, js2val *ar uint32 start, end; if (argc > 0) { - int32 arg0 = meta->toInt32(argv[0]); + int32 arg0 = meta->valToInt32(argv[0]); if (arg0 < 0) { arg0 += sourceLength; if (arg0 < 0) @@ -675,7 +675,7 @@ static js2val String_slice(JS2Metadata *meta, const js2val thisValue, js2val *ar start = 0; // XXX argc must be > 1 since the length of the function is 1 if (argc > 1) { - int32 arg1 = meta->toInt32(argv[1]); + int32 arg1 = meta->valToInt32(argv[1]); if (arg1 < 0) { arg1 += sourceLength; if (arg1 < 0)