org.mozilla.javascript

Class ScriptRuntime

public class ScriptRuntime extends Object

This is the class that implements the runtime.

Author: Norris Boyd

Field Summary
static ClassBooleanClass
static ClassByteClass
static ClassCharacterClass
static ClassClassClass
static ClassContextClass
static ClassContextFactoryClass
static ClassDateClass
static ClassDoubleClass
static Object[]emptyArgs
static String[]emptyStrings
static ClassFloatClass
static ClassFunctionClass
static ClassIntegerClass
static ClassLongClass
static doublenegativeZero
static doubleNaN
static DoubleNaNobj
static ClassNumberClass
static ClassObjectClass
static ClassScriptableClass
static ClassScriptableObjectClass
static ClassShortClass
static ClassStringClass
Constructor Summary
protected ScriptRuntime()
No instances should be created.
Method Summary
static Objectadd(Object val1, Object val2, Context cx)
static ObjectapplyOrCall(boolean isApply, Context cx, Scriptable scope, Scriptable thisObj, Object[] args)
Function.prototype.apply and Function.prototype.call See Ecma 15.3.4.[34]
static Scriptablebind(Context cx, Scriptable scope, String id)
Returns the object in the scope chain that has a given property.
static Objectcall(Context cx, Object fun, Object thisArg, Object[] args, Scriptable scope)
static RefcallRef(Callable function, Scriptable thisObj, Object[] args, Context cx)
Perform function call in reference context.
static ObjectcallSpecial(Context cx, Callable fun, Scriptable thisObj, Object[] args, Scriptable scope, Scriptable callerThis, int callType, String filename, int lineNumber)
static RegExpProxycheckRegExpProxy(Context cx)
static booleancmp_LE(Object val1, Object val2)
static booleancmp_LT(Object val1, Object val2)
static EcmaErrorconstructError(String error, String message)
static EcmaErrorconstructError(String error, String message, String sourceName, int lineNumber, String lineSource, int columnNumber)
static ScriptablecreateFunctionActivation(NativeFunction funObj, Scriptable scope, Object[] args)
static Objectdelete(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 booleandeleteObjectElem(Scriptable target, Object elem, Context cx)
static ObjectdoTopCall(Callable callable, Context cx, Scriptable scope, Scriptable thisObj, Object[] args)
static ObjectelemIncrDecr(Object obj, Object index, Context cx, int incrDecrMask)
static voidenterActivationFunction(Context cx, Scriptable activation)
static ScriptableenterDotQuery(Object value, Scriptable scope)
static ScriptableenterWith(Object obj, Context cx, Scriptable scope)
static ObjectenumId(Object enumObj, Context cx)
static ObjectenumInit(Object value, Context cx, boolean enumValues)
static BooleanenumNext(Object enumObj)
static booleaneq(Object x, Object y)
Equality See ECMA 11.9
static StringescapeAttributeValue(Object value, Context cx)
Escapes the reserved characters in a value of an attribute
static StringescapeString(String s)
static StringescapeString(String s, char escapeQuote)
For escaping strings printed by object and array literals; not quite the same as 'escape.'
static StringescapeTextValue(Object value, Context cx)
Escapes the reserved characters in a value of a text node
static ObjectevalSpecial(Context cx, Scriptable scope, Object thisArg, Object[] args, String filename, int lineNumber)
The eval function property of the global object.
static voidexitActivationFunction(Context cx)
static Object[]getArrayElements(Scriptable object)
static CallablegetElemFunctionAndThis(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 ScriptableObjectgetGlobal(Context cx)
static ScriptableObjectgetLibraryScopeOrNull(Scriptable scope)
static StringgetMessage(String messageId, Object[] arguments)
static StringgetMessage0(String messageId)
static StringgetMessage1(String messageId, Object arg1)
static StringgetMessage2(String messageId, Object arg1, Object arg2)
static StringgetMessage3(String messageId, Object arg1, Object arg2, Object arg3)
static StringgetMessage4(String messageId, Object arg1, Object arg2, Object arg3, Object arg4)
static CallablegetNameFunctionAndThis(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 ObjectgetObjectElem(Object obj, Object elem, Context cx)
Call obj.[[Get]](id)
static ObjectgetObjectElem(Scriptable obj, Object elem, Context cx)
static ObjectgetObjectIndex(Object obj, double dblIndex, Context cx)
static ObjectgetObjectIndex(Scriptable obj, int index, Context cx)
static ObjectgetObjectProp(Object obj, String property, Context cx)
Version of getObjectElem when elem is a valid JS identifier name.
static ObjectgetObjectProp(Scriptable obj, String property, Context cx)
static CallablegetPropFunctionAndThis(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 RegExpProxygetRegExpProxy(Context cx)
static ScriptablegetTopCallScope(Context cx)
static ObjectgetTopLevelProp(Scriptable scope, String id)
static CallablegetValueFunctionAndThis(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 booleanhasObjectElem(Scriptable target, Object elem, Context cx)
static booleanhasTopCall(Context cx)
static booleanin(Object a, Object b, Context cx)
The in operator.
static voidinitFunction(Context cx, Scriptable scope, NativeFunction function, int type, boolean fromEvalCode)
static voidinitScript(NativeFunction funObj, Scriptable thisObj, Context cx, Scriptable scope, boolean evalScript)
static ScriptableObjectinitStandardObjects(Context cx, ScriptableObject scope, boolean sealed)
static booleaninstanceOf(Object a, Object b, Context cx)
The instanceof operator.
static booleanisArrayObject(Object obj)
static booleanisJSLineTerminator(int c)
static booleanisRhinoRuntimeType(Class cl)
protected static booleanjsDelegatesTo(Scriptable lhs, Scriptable rhs)
Delegates to
static ScriptablelastStoredScriptable(Context cx)
static longlastUint32Result(Context cx)
static ScriptableleaveDotQuery(Scriptable scope)
static ScriptableleaveWith(Scriptable scope)
static RefmemberRef(Object obj, Object elem, Context cx, int memberTypeFlags)
static RefmemberRef(Object obj, Object namespace, Object elem, Context cx, int memberTypeFlags)
static Objectname(Context cx, Scriptable scope, String name)
Looks up a name in the scope chain and returns its value.
static ObjectnameIncrDecr(Scriptable scopeChain, String id, int incrDecrMask)
static RefnameRef(Object name, Context cx, Scriptable scope, int memberTypeFlags)
static RefnameRef(Object namespace, Object name, Context cx, Scriptable scope, int memberTypeFlags)
static ScriptablenewArrayLiteral(Object[] objects, int[] skipIndexces, Context cx, Scriptable scope)
static ScriptablenewCatchScope(Throwable t, Scriptable lastCatchScope, String exceptionName, Context cx, Scriptable scope)
static ScriptablenewObject(Context cx, Scriptable scope, String constructorName, Object[] args)
static ScriptablenewObject(Object fun, Context cx, Scriptable scope, Object[] args)
Operator new.
static ScriptablenewObjectLiteral(Object[] propertyIds, Object[] propertyValues, Context cx, Scriptable scope)
static ObjectnewSpecial(Context cx, Object fun, Object[] args, Scriptable scope, int callType)
static RuntimeExceptionnotFoundError(Scriptable object, String property)
static RuntimeExceptionnotFunctionError(Object value)
static RuntimeExceptionnotFunctionError(Object value, Object messageHelper)
static StringnumberToString(double d, int base)
static Object[]padArguments(Object[] args, int count)
Helper function for builtin objects that use the varargs form.
static ObjectpropIncrDecr(Object obj, String id, Context cx, int incrDecrMask)
static ObjectrefDel(Ref ref, Context cx)
static ObjectrefGet(Ref ref, Context cx)
static ObjectrefIncrDecr(Ref ref, Context cx, int incrDecrMask)
static ObjectrefSet(Ref ref, Object value, Context cx)
static ObjectsearchDefaultNamespace(Context cx)
static ObjectsetDefaultNamespace(Object namespace, Context cx)
static voidsetFunctionProtoAndParent(BaseFunction fn, Scriptable scope)
static ObjectsetName(Scriptable bound, Object value, Context cx, Scriptable scope, String id)
static ObjectsetObjectElem(Object obj, Object elem, Object value, Context cx)
static ObjectsetObjectElem(Scriptable obj, Object elem, Object value, Context cx)
static ObjectsetObjectIndex(Object obj, double dblIndex, Object value, Context cx)
static ObjectsetObjectIndex(Scriptable obj, int index, Object value, Context cx)
static ObjectsetObjectProp(Object obj, String property, Object value, Context cx)
Version of setObjectElem when elem is a valid JS identifier name.
static ObjectsetObjectProp(Scriptable obj, String property, Object value, Context cx)
static voidsetObjectProtoAndParent(ScriptableObject object, Scriptable scope)
static voidsetRegExpProxy(Context cx, RegExpProxy proxy)
static booleanshallowEq(Object x, Object y)
static RefspecialRef(Object obj, String specialProperty, Context cx)
static voidstoreUint32Result(Context cx, long value)
static longtestUint32String(String str)
If str is a decimal presentation of Uint32 value, return it as long.
static booleantoBoolean(Object val)
Convert the value to a boolean.
static booleantoBoolean(Object[] args, int index)
static inttoInt32(Object val)
See ECMA 9.5.
static inttoInt32(Object[] args, int index)
static inttoInt32(double d)
static doubletoInteger(Object val)
See ECMA 9.4.
static doubletoInteger(double d)
static doubletoInteger(Object[] args, int index)
static doubletoNumber(Object val)
Convert the value to a number.
static doubletoNumber(Object[] args, int index)
static doubletoNumber(String s)
ToNumber applied to the String type See ECMA 9.3.1
static ScriptabletoObject(Scriptable scope, Object val)
static ScriptabletoObject(Scriptable scope, Object val, Class staticClass)
static ScriptabletoObject(Context cx, Scriptable scope, Object val)
Convert the value to an object.
static ScriptabletoObject(Context cx, Scriptable scope, Object val, Class staticClass)
static ScriptabletoObjectOrNull(Context cx, Object obj)
static StringtoString(Object val)
Convert the value to a string.
static StringtoString(Object[] args, int index)
static StringtoString(double val)
Optimized version of toString(Object) for numbers.
static chartoUint16(Object val)
See ECMA 9.7.
static longtoUint32(double d)
See ECMA 9.6.
static longtoUint32(Object val)
static EcmaErrortypeError(String message)
static EcmaErrortypeError0(String messageId)
static EcmaErrortypeError1(String messageId, String arg1)
static EcmaErrortypeError2(String messageId, String arg1, String arg2)
static EcmaErrortypeError3(String messageId, String arg1, String arg2, String arg3)
static Stringtypeof(Object value)
The typeof operator
static StringtypeofName(Scriptable scope, String id)
The typeof operator that correctly handles the undefined case
static RuntimeExceptionundefCallError(Object object, Object id)
static RuntimeExceptionundefReadError(Object object, Object id)
static RuntimeExceptionundefWriteError(Object object, Object id, Object value)
static ObjectupdateDotQuery(boolean value, Scriptable scope)
static BooleanwrapBoolean(boolean b)
static IntegerwrapInt(int i)
static NumberwrapNumber(double x)

Field Detail

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

emptyArgs

public static final Object[] emptyArgs

emptyStrings

public static final String[] emptyStrings

FloatClass

public static final Class FloatClass

FunctionClass

public static final Class FunctionClass

IntegerClass

public static final Class IntegerClass

LongClass

public static final Class LongClass

negativeZero

public static final double negativeZero

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

Constructor Detail

ScriptRuntime

protected ScriptRuntime()
No instances should be created.

Method Detail

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 {@link #refGet(Object)} or @link #refSet(Object, Object)} 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 activation)

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

protected 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 elem, Context cx, int memberTypeFlags)

memberRef

public static Ref memberRef(Object obj, Object namespace, 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)

nameRef

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

nameRef

public static Ref nameRef(Object namespace, 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(Context cx, Scriptable scope, String constructorName, Object[] args)

newObject

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

newObjectLiteral

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

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)

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(double d)

toInteger

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

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(Scriptable scope, Object val)

toObject

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

Deprecated: Use {@link #toObject(Scriptable, Object)} instead.

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 {@link #toObject(Context, 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(double d)
See ECMA 9.6.

Returns: long value representing 32 bits unsigned integer

toUint32

public static long toUint32(Object val)

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)