Fix 56883.
git-svn-id: svn://10.0.0.236/trunk@81602 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
e92e7d150f
commit
151d31ddc9
@ -342,13 +342,25 @@ public class NativeArray extends ScriptableObject {
|
||||
|
||||
public static String jsFunction_toString(Context cx, Scriptable thisObj,
|
||||
Object[] args, Function funObj)
|
||||
throws JavaScriptException
|
||||
{
|
||||
return toStringHelper(cx, thisObj,
|
||||
cx.getLanguageVersion() == cx.VERSION_1_2);
|
||||
cx.getLanguageVersion() == cx.VERSION_1_2,
|
||||
false);
|
||||
}
|
||||
|
||||
public static String jsFunction_toLocaleString(Context cx,
|
||||
Scriptable thisObj,
|
||||
Object[] args,
|
||||
Function funObj)
|
||||
throws JavaScriptException
|
||||
{
|
||||
return toStringHelper(cx, thisObj, false, true);
|
||||
}
|
||||
|
||||
private static String toStringHelper(Context cx, Scriptable thisObj,
|
||||
boolean toSource)
|
||||
boolean toSource, boolean toLocale)
|
||||
throws JavaScriptException
|
||||
{
|
||||
/* It's probably redundant to handle long lengths in this
|
||||
* function; StringBuffers are limited to 2^31 in java.
|
||||
@ -403,6 +415,15 @@ public class NativeArray extends ScriptableObject {
|
||||
try {
|
||||
// stop recursion.
|
||||
cx.iterating.put(thisObj, Boolean.TRUE);
|
||||
if (toLocale && elem != Undefined.instance &&
|
||||
elem != null)
|
||||
{
|
||||
Scriptable obj = cx.toObject(elem, thisObj);
|
||||
Object tls = ScriptRuntime.getProp(obj,
|
||||
"toLocaleString", thisObj);
|
||||
elem = ScriptRuntime.call(cx, tls, elem,
|
||||
ScriptRuntime.emptyArgs);
|
||||
}
|
||||
result.append(ScriptRuntime.toString(elem));
|
||||
} finally {
|
||||
cx.iterating.remove(thisObj);
|
||||
|
||||
@ -342,13 +342,25 @@ public class NativeArray extends ScriptableObject {
|
||||
|
||||
public static String jsFunction_toString(Context cx, Scriptable thisObj,
|
||||
Object[] args, Function funObj)
|
||||
throws JavaScriptException
|
||||
{
|
||||
return toStringHelper(cx, thisObj,
|
||||
cx.getLanguageVersion() == cx.VERSION_1_2);
|
||||
cx.getLanguageVersion() == cx.VERSION_1_2,
|
||||
false);
|
||||
}
|
||||
|
||||
public static String jsFunction_toLocaleString(Context cx,
|
||||
Scriptable thisObj,
|
||||
Object[] args,
|
||||
Function funObj)
|
||||
throws JavaScriptException
|
||||
{
|
||||
return toStringHelper(cx, thisObj, false, true);
|
||||
}
|
||||
|
||||
private static String toStringHelper(Context cx, Scriptable thisObj,
|
||||
boolean toSource)
|
||||
boolean toSource, boolean toLocale)
|
||||
throws JavaScriptException
|
||||
{
|
||||
/* It's probably redundant to handle long lengths in this
|
||||
* function; StringBuffers are limited to 2^31 in java.
|
||||
@ -403,6 +415,15 @@ public class NativeArray extends ScriptableObject {
|
||||
try {
|
||||
// stop recursion.
|
||||
cx.iterating.put(thisObj, Boolean.TRUE);
|
||||
if (toLocale && elem != Undefined.instance &&
|
||||
elem != null)
|
||||
{
|
||||
Scriptable obj = cx.toObject(elem, thisObj);
|
||||
Object tls = ScriptRuntime.getProp(obj,
|
||||
"toLocaleString", thisObj);
|
||||
elem = ScriptRuntime.call(cx, tls, elem,
|
||||
ScriptRuntime.emptyArgs);
|
||||
}
|
||||
result.append(ScriptRuntime.toString(elem));
|
||||
} finally {
|
||||
cx.iterating.remove(thisObj);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user