org.mozilla.javascript

Class ScriptRuntime

Known Direct Subclasses:
OptRuntime

public class ScriptRuntime
extends java.lang.Object

This is the class that implements the runtime.
Author:
Norris Boyd

Field Summary

static Class
BooleanClass
static Class
ByteClass
static Class
CharacterClass
static Class
ClassClass
static Class
ContextClass
static Class
ContextFactoryClass
static Class
DateClass
static Class
DoubleClass
static Class
FloatClass
static Class
FunctionClass
static Class
IntegerClass
static Class
LongClass
static double
NaN
static Double
NaNobj
static Class
NumberClass
static Class
ObjectClass
static Class
ScriptableClass
static Class
ScriptableObjectClass
static Class
ShortClass
static Class
StringClass
static Object[]
emptyArgs
static String[]
emptyStrings
static double
negativeZero

Constructor Summary

ScriptRuntime()
No instances should be created.

Method Summary

static Object
add(Object val1, Object val2, Context cx)
static Object
applyOrCall(boolean isApply, Context cx, Scriptable scope, Scriptable thisObj, Object[] args)
Function.prototype.apply and Function.prototype.call See Ecma 15.3.4.[34]
static Scriptable
bind(Context cx, Scriptable scope, String id)
Returns the object in the scope chain that has a given property.
static Object
call(Context cx, Object fun, Object thisArg, Object[] args, Scriptable scope)
Deprecated. The method is only present for compatibility.
static Ref
callRef(Callable function, Scriptable thisObj, Object[] args, Context cx)
Perform function call in reference context.
static Object
callSpecial(Context cx, Callable fun, Scriptable thisObj, Object[] args, Scriptable scope, Scriptable callerThis, int callType, String filename, int lineNumber)
static RegExpProxy
checkRegExpProxy(Context cx)
static boolean
cmp_LE(Object val1, Object val2)
static boolean
cmp_LT(Object val1, Object val2)
static EcmaError
constructError(String error, String message)
static EcmaError
constructError(String error, String message, String sourceName, int lineNumber, String lineSource, int columnNumber)
static Scriptable
createFunctionActivation(NativeFunction funObj, Scriptable scope, Object[] args)
static Object
delete(Object obj, Object id, Context cx)
The delete operator See ECMA 11.4.1 In ECMA 0.19, the description of the delete operator (11.4.1) assumes that the [[Delete]] method returns a value.
static boolean
deleteObjectElem(Scriptable target, Object elem, Context cx)
static Object
doTopCall(Callable callable, Context cx, Scriptable scope, Scriptable thisObj, Object[] args)
static Object
elemIncrDecr(Object obj, Object index, Context cx, int incrDecrMask)
static void
enterActivationFunction(Context cx, Scriptable scope)
static Scriptable
enterDotQuery(Object value, Scriptable scope)
static Scriptable
enterWith(Object obj, Context cx, Scriptable scope)
static Object
enumId(Object enumObj, Context cx)
static Object
enumInit(Object value, Context cx, boolean enumValues)
static Boolean
enumNext(Object enumObj)
static boolean
eq(Object x, Object y)
Equality See ECMA 11.9
static String
escapeAttributeValue(Object value, Context cx)
Escapes the reserved characters in a value of an attribute
static String
escapeString(String s)
static String
escapeString(String s, char escapeQuote)
For escaping strings printed by object and array literals; not quite the same as 'escape.'
static String
escapeTextValue(Object value, Context cx)
Escapes the reserved characters in a value of a text node
static Object
evalSpecial(Context cx, Scriptable scope, Object thisArg, Object[] args, String filename, int lineNumber)
The eval function property of the global object.
static void
exitActivationFunction(Context cx)
static Object[]
getArrayElements(Scriptable object)
static Callable
getElemFunctionAndThis(Object obj, Object elem, Context cx)
Prepare for calling obj[id](...): return function corresponding to obj[id] and make obj properly converted to Scriptable available as ScriptRuntime.lastStoredScriptable() for consumption as thisObj.
static ScriptableObject
getGlobal(Context cx)
static ScriptableObject
getLibraryScopeOrNull(Scriptable scope)
static String
getMessage(String messageId, Object[] arguments)
static String
getMessage0(String messageId)
static String
getMessage1(String messageId, Object arg1)
static String
getMessage2(String messageId, Object arg1, Object arg2)
static String
getMessage3(String messageId, Object arg1, Object arg2, Object arg3)
static String
getMessage4(String messageId, Object arg1, Object arg2, Object arg3, Object arg4)
static Callable
getNameFunctionAndThis(String name, Context cx, Scriptable scope)
Prepare for calling name(...): return function corresponding to name and make current top scope available as ScriptRuntime.lastStoredScriptable() for consumption as thisObj.
static Object
getObjectElem(Object obj, Object elem, Context cx)
Call obj.[[Get]](id)
static Object
getObjectElem(Scriptable obj, Object elem, Context cx)
static Object
getObjectIndex(Object obj, double dblIndex, Context cx)
static Object
getObjectIndex(Scriptable obj, int index, Context cx)
static Object
getObjectProp(Object obj, String property, Context cx)
Version of getObjectElem when elem is a valid JS identifier name.
static Object
getObjectProp(Scriptable obj, String property, Context cx)
static Callable
getPropFunctionAndThis(Object obj, String property, Context cx)
Prepare for calling obj.property(...): return function corresponding to obj.property and make obj properly converted to Scriptable available as ScriptRuntime.lastStoredScriptable() for consumption as thisObj.
static RegExpProxy
getRegExpProxy(Context cx)
static Scriptable
getTopCallScope(Context cx)
static Object
getTopLevelProp(Scriptable scope, String id)
static Callable
getValueFunctionAndThis(Object value, Context cx)
Prepare for calling (...): return function corresponding to and make parent scope of the function available as ScriptRuntime.lastStoredScriptable() for consumption as thisObj.
static boolean
hasObjectElem(Scriptable target, Object elem, Context cx)
static boolean
hasTopCall(Context cx)
static boolean
in(Object a, Object b, Context cx)
The in operator.
static void
initFunction(Context cx, Scriptable scope, NativeFunction function, int type, boolean fromEvalCode)
static void
initScript(NativeFunction funObj, Scriptable thisObj, Context cx, Scriptable scope, boolean evalScript)
static ScriptableObject
initStandardObjects(Context cx, ScriptableObject scope, boolean sealed)
static boolean
instanceOf(Object a, Object b, Context cx)
The instanceof operator.
static boolean
isArrayObject(Object obj)
static boolean
isJSLineTerminator(int c)
static boolean
isRhinoRuntimeType(Class cl)
static boolean
jsDelegatesTo(Scriptable lhs, Scriptable rhs)
Delegates to
static Scriptable
lastStoredScriptable(Context cx)
static long
lastUint32Result(Context cx)
static Scriptable
leaveDotQuery(Scriptable scope)
static Scriptable
leaveWith(Scriptable scope)
static Ref
memberRef(Object obj, Object namespace, Object elem, Context cx, int memberTypeFlags)
static Ref
memberRef(Object obj, Object elem, Context cx, int memberTypeFlags)
static Object
name(Context cx, Scriptable scope, String name)
Looks up a name in the scope chain and returns its value.
static Object
nameIncrDecr(Scriptable scopeChain, String id, int incrDecrMask)
Deprecated. The method is only present for compatibility.
static Object
nameIncrDecr(Scriptable scopeChain, String id, Context cx, int incrDecrMask)
static Ref
nameRef(Object namespace, Object name, Context cx, Scriptable scope, int memberTypeFlags)
static Ref
nameRef(Object name, Context cx, Scriptable scope, int memberTypeFlags)
static Scriptable
newArrayLiteral(Object[] objects, int[] skipIndexces, Context cx, Scriptable scope)
static Scriptable
newCatchScope(Throwable t, Scriptable lastCatchScope, String exceptionName, Context cx, Scriptable scope)
static Scriptable
newObject(Object fun, Context cx, Scriptable scope, Object[] args)
Operator new.
static Scriptable
newObject(Context cx, Scriptable scope, String constructorName, Object[] args)
static Scriptable
newObjectLiteral(Object[] propertyIds, Object[] propertyValues, int[] getterSetters, Context cx, Scriptable scope)
static Scriptable
newObjectLiteral(Object[] propertyIds, Object[] propertyValues, Context cx, Scriptable scope)
Deprecated. This method only present for compatibility.
static Object
newSpecial(Context cx, Object fun, Object[] args, Scriptable scope, int callType)
static RuntimeException
notFoundError(Scriptable object, String property)
static RuntimeException
notFunctionError(Object value)
static RuntimeException
notFunctionError(Object value, Object messageHelper)
static String
numberToString(double d, int base)
static Object[]
padArguments(Object[] args, int count)
Helper function for builtin objects that use the varargs form.
static Object
propIncrDecr(Object obj, String id, Context cx, int incrDecrMask)
static Object
refDel(Ref ref, Context cx)
static Object
refGet(Ref ref, Context cx)
static Object
refIncrDecr(Ref ref, Context cx, int incrDecrMask)
static Object
refSet(Ref ref, Object value, Context cx)
static Object
searchDefaultNamespace(Context cx)
static Object
setConst(Scriptable bound, Object value, Context cx, String id)
static Object
setDefaultNamespace(Object namespace, Context cx)
static void
setFunctionProtoAndParent(BaseFunction fn, Scriptable scope)
static Object
setName(Scriptable bound, Object value, Context cx, Scriptable scope, String id)
static Object
setObjectElem(Object obj, Object elem, Object value, Context cx)
static Object
setObjectElem(Scriptable obj, Object elem, Object value, Context cx)
static Object
setObjectIndex(Object obj, double dblIndex, Object value, Context cx)
static Object
setObjectIndex(Scriptable obj, int index, Object value, Context cx)
static Object
setObjectProp(Object obj, String property, Object value, Context cx)
Version of setObjectElem when elem is a valid JS identifier name.
static Object
setObjectProp(Scriptable obj, String property, Object value, Context cx)
static void
setObjectProtoAndParent(ScriptableObject object, Scriptable scope)
static void
setRegExpProxy(Context cx, RegExpProxy proxy)
static boolean
shallowEq(Object x, Object y)
static Ref
specialRef(Object obj, String specialProperty, Context cx)
static void
storeUint32Result(Context cx, long value)
static long
testUint32String(String str)
If str is a decimal presentation of Uint32 value, return it as long.
static boolean
toBoolean(Object val)
Convert the value to a boolean.
static boolean
toBoolean(Object[] args, int index)
static int
toInt32(Object val)
See ECMA 9.5.
static int
toInt32(Object[] args, int index)
static int
toInt32(double d)
static double
toInteger(Object val)
See ECMA 9.4.
static double
toInteger(Object[] args, int index)
static double
toInteger(double d)
static double
toNumber(Object val)
Convert the value to a number.
static double
toNumber(Object[] args, int index)
static double
toNumber(String s)
ToNumber applied to the String type See ECMA 9.3.1
static Scriptable
toObject(Context cx, Scriptable scope, Object val)
Convert the value to an object.
static Scriptable
toObject(Context cx, Scriptable scope, Object val, Class staticClass)
Deprecated. Use toObject(Context,Scriptable,Object) instead.
static Scriptable
toObject(Scriptable scope, Object val)
static Scriptable
toObject(Scriptable scope, Object val, Class staticClass)
Deprecated. Use toObject(Scriptable,Object) instead.
static Scriptable
toObjectOrNull(Context cx, Object obj)
static String
toString(Object val)
Convert the value to a string.
static String
toString(Object[] args, int index)
static String
toString(double val)
Optimized version of toString(Object) for numbers.
static char
toUint16(Object val)
See ECMA 9.7.
static long
toUint32(Object val)
static long
toUint32(double d)
See ECMA 9.6.
static EcmaError
typeError(String message)
static EcmaError
typeError0(String messageId)
static EcmaError
typeError1(String messageId, String arg1)
static EcmaError
typeError2(String messageId, String arg1, String arg2)
static EcmaError
typeError3(String messageId, String arg1, String arg2, String arg3)
static String
typeof(Object value)
The typeof operator
static String
typeofName(Scriptable scope, String id)
The typeof operator that correctly handles the undefined case
static RuntimeException
undefCallError(Object object, Object id)
static RuntimeException
undefReadError(Object object, Object id)
static RuntimeException
undefWriteError(Object object, Object id, Object value)
static Object
updateDotQuery(boolean value, Scriptable scope)
static Boolean
wrapBoolean(boolean b)
static Integer
wrapInt(int i)
static Number
wrapNumber(double x)

Field Details

BooleanClass

public static final Class BooleanClass

ByteClass

public static final Class ByteClass

CharacterClass

public static final Class CharacterClass

ClassClass

public static final Class ClassClass

ContextClass

public static final Class ContextClass

ContextFactoryClass

public static final Class ContextFactoryClass

DateClass

public static final Class DateClass

DoubleClass

public static final Class DoubleClass

FloatClass

public static final Class FloatClass

FunctionClass

public static final Class FunctionClass

IntegerClass

public static final Class IntegerClass

LongClass

public static final Class LongClass

NaN

public static final double NaN

NaNobj

public static final Double NaNobj

NumberClass

public static final Class NumberClass

ObjectClass

public static final Class ObjectClass

ScriptableClass

public static final Class ScriptableClass

ScriptableObjectClass

public static final Class ScriptableObjectClass

ShortClass

public static final Class ShortClass

StringClass

public static final Class StringClass

emptyArgs

public static final Object[] emptyArgs

emptyStrings

public static final String[] emptyStrings

negativeZero

public static final double negativeZero

Constructor Details

ScriptRuntime

protected ScriptRuntime()
No instances should be created.

Method Details

add

public static Object add(Object val1,
                         Object val2,
                         Context cx)

applyOrCall

public static Object applyOrCall(boolean isApply,
                                 Context cx,
                                 Scriptable scope,
                                 Scriptable thisObj,
                                 Object[] args)
Function.prototype.apply and Function.prototype.call See Ecma 15.3.4.[34]

bind

public static Scriptable bind(Context cx,
                              Scriptable scope,
                              String id)
Returns the object in the scope chain that has a given property. The order of evaluation of an assignment expression involves evaluating the lhs to a reference, evaluating the rhs, and then modifying the reference with the rhs value. This method is used to 'bind' the given name to an object containing that property so that the side effects of evaluating the rhs do not affect which property is modified. Typically used in conjunction with setName. See ECMA 10.1.4

call

public static Object call(Context cx,
                          Object fun,
                          Object thisArg,
                          Object[] args,
                          Scriptable scope)

Deprecated. The method is only present for compatibility.


callRef

public static Ref callRef(Callable function,
                          Scriptable thisObj,
                          Object[] args,
                          Context cx)
Perform function call in reference context. Should always return value that can be passed to refGet(Ref,Context) or refSet(Ref,Object,Context) arbitrary number of times. The args array reference should not be stored in any object that is can be GC-reachable after this method returns. If this is necessary, store args.clone(), not args array itself.

callSpecial

public static Object callSpecial(Context cx,
                                 Callable fun,
                                 Scriptable thisObj,
                                 Object[] args,
                                 Scriptable scope,
                                 Scriptable callerThis,
                                 int callType,
                                 String filename,
                                 int lineNumber)

checkRegExpProxy

public static RegExpProxy checkRegExpProxy(Context cx)

cmp_LE

public static boolean cmp_LE(Object val1,
                             Object val2)

cmp_LT

public static boolean cmp_LT(Object val1,
                             Object val2)

constructError

public static EcmaError constructError(String error,
                                       String message)

constructError

public static EcmaError constructError(String error,
                                       String message,
                                       String sourceName,
                                       int lineNumber,
                                       String lineSource,
                                       int columnNumber)

createFunctionActivation

public static Scriptable createFunctionActivation(NativeFunction funObj,
                                                  Scriptable scope,
                                                  Object[] args)

delete

public static Object delete(Object obj,
                            Object id,
                            Context cx)
The delete operator See ECMA 11.4.1 In ECMA 0.19, the description of the delete operator (11.4.1) assumes that the [[Delete]] method returns a value. However, the definition of the [[Delete]] operator (8.6.2.5) does not define a return value. Here we assume that the [[Delete]] method doesn't return a value.

deleteObjectElem

public static boolean deleteObjectElem(Scriptable target,
                                       Object elem,
                                       Context cx)

doTopCall

public static Object doTopCall(Callable callable,
                               Context cx,
                               Scriptable scope,
                               Scriptable thisObj,
                               Object[] args)

elemIncrDecr

public static Object elemIncrDecr(Object obj,
                                  Object index,
                                  Context cx,
                                  int incrDecrMask)

enterActivationFunction

public static void enterActivationFunction(Context cx,
                                           Scriptable scope)

enterDotQuery

public static Scriptable enterDotQuery(Object value,
                                       Scriptable scope)

enterWith

public static Scriptable enterWith(Object obj,
                                   Context cx,
                                   Scriptable scope)

enumId

public static Object enumId(Object enumObj,
                            Context cx)

enumInit

public static Object enumInit(Object value,
                              Context cx,
                              boolean enumValues)

enumNext

public static Boolean enumNext(Object enumObj)

eq

public static boolean eq(Object x,
                         Object y)
Equality See ECMA 11.9

escapeAttributeValue

public static String escapeAttributeValue(Object value,
                                          Context cx)
Escapes the reserved characters in a value of an attribute
Parameters:
value - Unescaped text
Returns:
The escaped text

escapeString

public static String escapeString(String s)

escapeString

public static String escapeString(String s,
                                  char escapeQuote)
For escaping strings printed by object and array literals; not quite the same as 'escape.'

escapeTextValue

public static String escapeTextValue(Object value,
                                     Context cx)
Escapes the reserved characters in a value of a text node
Parameters:
value - Unescaped text
Returns:
The escaped text

evalSpecial

public static Object evalSpecial(Context cx,
                                 Scriptable scope,
                                 Object thisArg,
                                 Object[] args,
                                 String filename,
                                 int lineNumber)
The eval function property of the global object. See ECMA 15.1.2.1

exitActivationFunction

public static void exitActivationFunction(Context cx)

getArrayElements

public static Object[] getArrayElements(Scriptable object)

getElemFunctionAndThis

public static Callable getElemFunctionAndThis(Object obj,
                                              Object elem,
                                              Context cx)
Prepare for calling obj[id](...): return function corresponding to obj[id] and make obj properly converted to Scriptable available as ScriptRuntime.lastStoredScriptable() for consumption as thisObj. The caller must call ScriptRuntime.lastStoredScriptable() immediately after calling this method.

getGlobal

public static ScriptableObject getGlobal(Context cx)

getLibraryScopeOrNull

public static ScriptableObject getLibraryScopeOrNull(Scriptable scope)

getMessage

public static String getMessage(String messageId,
                                Object[] arguments)

getMessage0

public static String getMessage0(String messageId)

getMessage1

public static String getMessage1(String messageId,
                                 Object arg1)

getMessage2

public static String getMessage2(String messageId,
                                 Object arg1,
                                 Object arg2)

getMessage3

public static String getMessage3(String messageId,
                                 Object arg1,
                                 Object arg2,
                                 Object arg3)

getMessage4

public static String getMessage4(String messageId,
                                 Object arg1,
                                 Object arg2,
                                 Object arg3,
                                 Object arg4)

getNameFunctionAndThis

public static Callable getNameFunctionAndThis(String name,
                                              Context cx,
                                              Scriptable scope)
Prepare for calling name(...): return function corresponding to name and make current top scope available as ScriptRuntime.lastStoredScriptable() for consumption as thisObj. The caller must call ScriptRuntime.lastStoredScriptable() immediately after calling this method.

getObjectElem

public static Object getObjectElem(Object obj,
                                   Object elem,
                                   Context cx)
Call obj.[[Get]](id)

getObjectElem

public static Object getObjectElem(Scriptable obj,
                                   Object elem,
                                   Context cx)

getObjectIndex

public static Object getObjectIndex(Object obj,
                                    double dblIndex,
                                    Context cx)

getObjectIndex

public static Object getObjectIndex(Scriptable obj,
                                    int index,
                                    Context cx)

getObjectProp

public static Object getObjectProp(Object obj,
                                   String property,
                                   Context cx)
Version of getObjectElem when elem is a valid JS identifier name.

getObjectProp

public static Object getObjectProp(Scriptable obj,
                                   String property,
                                   Context cx)

getPropFunctionAndThis

public static Callable getPropFunctionAndThis(Object obj,
                                              String property,
                                              Context cx)
Prepare for calling obj.property(...): return function corresponding to obj.property and make obj properly converted to Scriptable available as ScriptRuntime.lastStoredScriptable() for consumption as thisObj. The caller must call ScriptRuntime.lastStoredScriptable() immediately after calling this method.

getRegExpProxy

public static RegExpProxy getRegExpProxy(Context cx)

getTopCallScope

public static Scriptable getTopCallScope(Context cx)

getTopLevelProp

public static Object getTopLevelProp(Scriptable scope,
                                     String id)

getValueFunctionAndThis

public static Callable getValueFunctionAndThis(Object value,
                                               Context cx)
Prepare for calling (...): return function corresponding to and make parent scope of the function available as ScriptRuntime.lastStoredScriptable() for consumption as thisObj. The caller must call ScriptRuntime.lastStoredScriptable() immediately after calling this method.

hasObjectElem

public static boolean hasObjectElem(Scriptable target,
                                    Object elem,
                                    Context cx)

hasTopCall

public static boolean hasTopCall(Context cx)

in

public static boolean in(Object a,
                         Object b,
                         Context cx)
The in operator. This is a new JS 1.3 language feature. The in operator mirrors the operation of the for .. in construct, and tests whether the rhs has the property given by the lhs. It is different from the for .. in construct in that:
- it doesn't perform ToObject on the right hand side
- it returns true for DontEnum properties.
Parameters:
a - the left hand operand
b - the right hand operand
Returns:
true if property name or element number a is a property of b

initFunction

public static void initFunction(Context cx,
                                Scriptable scope,
                                NativeFunction function,
                                int type,
                                boolean fromEvalCode)

initScript

public static void initScript(NativeFunction funObj,
                              Scriptable thisObj,
                              Context cx,
                              Scriptable scope,
                              boolean evalScript)

initStandardObjects

public static ScriptableObject initStandardObjects(Context cx,
                                                   ScriptableObject scope,
                                                   boolean sealed)

instanceOf

public static boolean instanceOf(Object a,
                                 Object b,
                                 Context cx)
The instanceof operator.
Returns:
a instanceof b

isArrayObject

public static boolean isArrayObject(Object obj)

isJSLineTerminator

public static boolean isJSLineTerminator(int c)

isRhinoRuntimeType

public static boolean isRhinoRuntimeType(Class cl)

jsDelegatesTo

public static boolean jsDelegatesTo(Scriptable lhs,
                                    Scriptable rhs)
Delegates to
Returns:
true iff rhs appears in lhs' proto chain

lastStoredScriptable

public static Scriptable lastStoredScriptable(Context cx)

lastUint32Result

public static long lastUint32Result(Context cx)

leaveDotQuery

public static Scriptable leaveDotQuery(Scriptable scope)

leaveWith

public static Scriptable leaveWith(Scriptable scope)

memberRef

public static Ref memberRef(Object obj,
                            Object namespace,
                            Object elem,
                            Context cx,
                            int memberTypeFlags)

memberRef

public static Ref memberRef(Object obj,
                            Object elem,
                            Context cx,
                            int memberTypeFlags)

name

public static Object name(Context cx,
                          Scriptable scope,
                          String name)
Looks up a name in the scope chain and returns its value.

nameIncrDecr

public static Object nameIncrDecr(Scriptable scopeChain,
                                  String id,
                                  int incrDecrMask)

Deprecated. The method is only present for compatibility.


nameIncrDecr

public static Object nameIncrDecr(Scriptable scopeChain,
                                  String id,
                                  Context cx,
                                  int incrDecrMask)

nameRef

public static Ref nameRef(Object namespace,
                          Object name,
                          Context cx,
                          Scriptable scope,
                          int memberTypeFlags)

nameRef

public static Ref nameRef(Object name,
                          Context cx,
                          Scriptable scope,
                          int memberTypeFlags)

newArrayLiteral

public static Scriptable newArrayLiteral(Object[] objects,
                                         int[] skipIndexces,
                                         Context cx,
                                         Scriptable scope)

newCatchScope

public static Scriptable newCatchScope(Throwable t,
                                       Scriptable lastCatchScope,
                                       String exceptionName,
                                       Context cx,
                                       Scriptable scope)

newObject

public static Scriptable newObject(Object fun,
                                   Context cx,
                                   Scriptable scope,
                                   Object[] args)
Operator new. See ECMA 11.2.2

newObject

public static Scriptable newObject(Context cx,
                                   Scriptable scope,
                                   String constructorName,
                                   Object[] args)

newObjectLiteral

public static Scriptable newObjectLiteral(Object[] propertyIds,
                                          Object[] propertyValues,
                                          int[] getterSetters,
                                          Context cx,
                                          Scriptable scope)

newObjectLiteral

public static Scriptable newObjectLiteral(Object[] propertyIds,
                                          Object[] propertyValues,
                                          Context cx,
                                          Scriptable scope)

Deprecated. This method only present for compatibility.

This method is here for backward compat with existing compiled code. It is called when an object literal is compiled. The next instance will be the version called from new code.

newSpecial

public static Object newSpecial(Context cx,
                                Object fun,
                                Object[] args,
                                Scriptable scope,
                                int callType)

notFoundError

public static RuntimeException notFoundError(Scriptable object,
                                             String property)

notFunctionError

public static RuntimeException notFunctionError(Object value)

notFunctionError

public static RuntimeException notFunctionError(Object value,
                                                Object messageHelper)

numberToString

public static String numberToString(double d,
                                    int base)

padArguments

public static Object[] padArguments(Object[] args,
                                    int count)
Helper function for builtin objects that use the varargs form. ECMA function formal arguments are undefined if not supplied; this function pads the argument array out to the expected length, if necessary.

propIncrDecr

public static Object propIncrDecr(Object obj,
                                  String id,
                                  Context cx,
                                  int incrDecrMask)

refDel

public static Object refDel(Ref ref,
                            Context cx)

refGet

public static Object refGet(Ref ref,
                            Context cx)

refIncrDecr

public static Object refIncrDecr(Ref ref,
                                 Context cx,
                                 int incrDecrMask)

refSet

public static Object refSet(Ref ref,
                            Object value,
                            Context cx)

searchDefaultNamespace

public static Object searchDefaultNamespace(Context cx)

setConst

public static Object setConst(Scriptable bound,
                              Object value,
                              Context cx,
                              String id)

setDefaultNamespace

public static Object setDefaultNamespace(Object namespace,
                                         Context cx)

setFunctionProtoAndParent

public static void setFunctionProtoAndParent(BaseFunction fn,
                                             Scriptable scope)

setName

public static Object setName(Scriptable bound,
                             Object value,
                             Context cx,
                             Scriptable scope,
                             String id)

setObjectElem

public static Object setObjectElem(Object obj,
                                   Object elem,
                                   Object value,
                                   Context cx)

setObjectElem

public static Object setObjectElem(Scriptable obj,
                                   Object elem,
                                   Object value,
                                   Context cx)

setObjectIndex

public static Object setObjectIndex(Object obj,
                                    double dblIndex,
                                    Object value,
                                    Context cx)

setObjectIndex

public static Object setObjectIndex(Scriptable obj,
                                    int index,
                                    Object value,
                                    Context cx)

setObjectProp

public static Object setObjectProp(Object obj,
                                   String property,
                                   Object value,
                                   Context cx)
Version of setObjectElem when elem is a valid JS identifier name.

setObjectProp

public static Object setObjectProp(Scriptable obj,
                                   String property,
                                   Object value,
                                   Context cx)

setObjectProtoAndParent

public static void setObjectProtoAndParent(ScriptableObject object,
                                           Scriptable scope)

setRegExpProxy

public static void setRegExpProxy(Context cx,
                                  RegExpProxy proxy)

shallowEq

public static boolean shallowEq(Object x,
                                Object y)

specialRef

public static Ref specialRef(Object obj,
                             String specialProperty,
                             Context cx)

storeUint32Result

public static void storeUint32Result(Context cx,
                                     long value)

testUint32String

public static long testUint32String(String str)
If str is a decimal presentation of Uint32 value, return it as long. Othewise return -1L;

toBoolean

public static boolean toBoolean(Object val)
Convert the value to a boolean. See ECMA 9.2.

toBoolean

public static boolean toBoolean(Object[] args,
                                int index)

toInt32

public static int toInt32(Object val)
See ECMA 9.5.

toInt32

public static int toInt32(Object[] args,
                          int index)

toInt32

public static int toInt32(double d)

toInteger

public static double toInteger(Object val)
See ECMA 9.4.

toInteger

public static double toInteger(Object[] args,
                               int index)

toInteger

public static double toInteger(double d)

toNumber

public static double toNumber(Object val)
Convert the value to a number. See ECMA 9.3.

toNumber

public static double toNumber(Object[] args,
                              int index)

toNumber

public static double toNumber(String s)
ToNumber applied to the String type See ECMA 9.3.1

toObject

public static Scriptable toObject(Context cx,
                                  Scriptable scope,
                                  Object val)
Convert the value to an object. See ECMA 9.9.

toObject

public static Scriptable toObject(Context cx,
                                  Scriptable scope,
                                  Object val,
                                  Class staticClass)

Deprecated. Use toObject(Context,Scriptable,Object) instead.


toObject

public static Scriptable toObject(Scriptable scope,
                                  Object val)

toObject

public static Scriptable toObject(Scriptable scope,
                                  Object val,
                                  Class staticClass)

Deprecated. Use toObject(Scriptable,Object) instead.


toObjectOrNull

public static Scriptable toObjectOrNull(Context cx,
                                        Object obj)

toString

public static String toString(Object val)
Convert the value to a string. See ECMA 9.8.

toString

public static String toString(Object[] args,
                              int index)

toString

public static String toString(double val)
Optimized version of toString(Object) for numbers.

toUint16

public static char toUint16(Object val)
See ECMA 9.7.

toUint32

public static long toUint32(Object val)

toUint32

public static long toUint32(double d)
See ECMA 9.6.
Returns:
long value representing 32 bits unsigned integer

typeError

public static EcmaError typeError(String message)

typeError0

public static EcmaError typeError0(String messageId)

typeError1

public static EcmaError typeError1(String messageId,
                                   String arg1)

typeError2

public static EcmaError typeError2(String messageId,
                                   String arg1,
                                   String arg2)

typeError3

public static EcmaError typeError3(String messageId,
                                   String arg1,
                                   String arg2,
                                   String arg3)

typeof

public static String typeof(Object value)
The typeof operator

typeofName

public static String typeofName(Scriptable scope,
                                String id)
The typeof operator that correctly handles the undefined case

undefCallError

public static RuntimeException undefCallError(Object object,
                                              Object id)

undefReadError

public static RuntimeException undefReadError(Object object,
                                              Object id)

undefWriteError

public static RuntimeException undefWriteError(Object object,
                                               Object id,
                                               Object value)

updateDotQuery

public static Object updateDotQuery(boolean value,
                                    Scriptable scope)

wrapBoolean

public static Boolean wrapBoolean(boolean b)

wrapInt

public static Integer wrapInt(int i)

wrapNumber

public static Number wrapNumber(double x)