| java.lang.Object org.mozilla.javascript.ScriptRuntime
All known Subclasses: org.mozilla.javascript.optimizer.OptRuntime,
ScriptRuntime | public class ScriptRuntime (Code) | | This is the class that implements the runtime.
author: Norris Boyd |
Constructor Summary | |
protected | ScriptRuntime() No instances should be created. |
Method Summary | |
public static Object | add(Object val1, Object val2, Context cx) | public static String | add(String val1, Object val2) | public static String | add(Object val1, String val2) | public static void | addInstructionCount(Context cx, int instructionsToAdd) | public static Object | applyOrCall(boolean isApply, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) | 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. | public static Object | call(Context cx, Object fun, Object thisArg, Object[] args, Scriptable scope) | public static Ref | callRef(Callable function, Scriptable thisObj, Object[] args, Context cx) Perform function call in reference context. | public static Object | callSpecial(Context cx, Callable fun, Scriptable thisObj, Object[] args, Scriptable scope, Scriptable callerThis, int callType, String filename, int lineNumber) | static void | checkDeprecated(Context cx, String name) | static Scriptable | checkDynamicScope(Scriptable possibleDynamicScope, Scriptable staticTopScope) Return possibleDynamicScope if staticTopScope
is present on its prototype chain and return staticTopScope
otherwise. | public static RegExpProxy | checkRegExpProxy(Context cx) | public static boolean | cmp_LE(Object val1, Object val2) | public static boolean | cmp_LT(Object val1, Object val2) | public static EcmaError | constructError(String error, String message) | public static EcmaError | constructError(String error, String message, int lineNumberDelta) | public static EcmaError | constructError(String error, String message, String sourceName, int lineNumber, String lineSource, int columnNumber) | public static Scriptable | createFunctionActivation(NativeFunction funObj, Scriptable scope, Object[] args) | static String | defaultObjectToSource(Context cx, Scriptable scope, Scriptable thisObj, Object[] args) | static String | defaultObjectToString(Scriptable obj) | 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. | public static boolean | deleteObjectElem(Scriptable target, Object elem, Context cx) | public static Object | doTopCall(Callable callable, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) | public static Object | elemIncrDecr(Object obj, Object index, Context cx, int incrDecrMask) | public static void | enterActivationFunction(Context cx, Scriptable scope) | public static Scriptable | enterDotQuery(Object value, Scriptable scope) | public static Scriptable | enterWith(Object obj, Context cx, Scriptable scope) | public static Object | enumId(Object enumObj, Context cx) | public static Object | enumInit(Object value, Context cx, boolean enumValues) | public static Object | enumInit(Object value, Context cx, int enumType) | public static Boolean | enumNext(Object enumObj) | public static Object | enumValue(Object enumObj, Context cx) | public static boolean | eq(Object x, Object y) | static boolean | eqNumber(double x, Object y) | public static String | escapeAttributeValue(Object value, Context cx) | public static String | escapeString(String s) | public static String | escapeString(String s, char escapeQuote) | public static String | escapeTextValue(Object value, Context cx) | public static Object | evalSpecial(Context cx, Scriptable scope, Object thisArg, Object[] args, String filename, int lineNumber) The eval function property of the global object. | public static void | exitActivationFunction(Context cx) | static NativeCall | findFunctionActivation(Context cx, Function f) | static Object[] | getApplyArguments(Context cx, Object arg1) | public static Object[] | getArrayElements(Scriptable object) | static Callable | getCallable(Scriptable thisObj) | 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. | static Function | getExistingCtor(Context cx, Scriptable scope, String constructorName) | public static ScriptableObject | getGlobal(Context cx) | static Object | getIndexObject(String s) If s represents index, then return index value wrapped as Integer
and othewise return s. | static Object | getIndexObject(double d) If d is exact int value, return its value wrapped as Integer
and othewise return d converted to String. | public static ScriptableObject | getLibraryScopeOrNull(Scriptable scope) | public static String | getMessage(String messageId, Object[] arguments) | public static String | getMessage0(String messageId) | public static String | getMessage1(String messageId, Object arg1) | public static String | getMessage2(String messageId, Object arg1, Object arg2) | public static String | getMessage3(String messageId, Object arg1, Object arg2, Object arg3) | public static String | getMessage4(String messageId, Object arg1, Object arg2, Object arg3, Object arg4) | 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. | public static Object | getObjectElem(Object obj, Object elem, Context cx) | public static Object | getObjectElem(Scriptable obj, Object elem, Context cx) | public static Object | getObjectIndex(Object obj, double dblIndex, Context cx) | public static Object | getObjectIndex(Scriptable obj, int index, Context cx) | public static Object | getObjectProp(Object obj, String property, Context cx) Version of getObjectElem when elem is a valid JS identifier name. | public static Object | getObjectProp(Scriptable obj, String property, Context cx) | public static Object | getObjectPropNoWarn(Object obj, String property, Context cx) | 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. | public static RegExpProxy | getRegExpProxy(Context cx) | public static Scriptable | getTopCallScope(Context cx) | public static Object | getTopLevelProp(Scriptable scope, String id) | 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. | public static boolean | hasObjectElem(Scriptable target, Object elem, Context cx) | public static boolean | hasTopCall(Context cx) | public static boolean | in(Object a, Object b, Context cx) The in operator.
This is a new JS 1.3 language feature. | public static void | initFunction(Context cx, Scriptable scope, NativeFunction function, int type, boolean fromEvalCode) | public static void | initScript(NativeFunction funObj, Scriptable thisObj, Context cx, Scriptable scope, boolean evalScript) | public static ScriptableObject | initStandardObjects(Context cx, ScriptableObject scope, boolean sealed) | public static boolean | instanceOf(Object a, Object b, Context cx) The instanceof operator. | public static boolean | isArrayObject(Object obj) | static boolean | isGeneratedScript(String sourceUrl) | public static boolean | isJSLineTerminator(int c) | public static boolean | isRhinoRuntimeType(Class cl) | static boolean | isSpecialProperty(String s) | static boolean | isValidIdentifierName(String s) | public static boolean | jsDelegatesTo(Scriptable lhs, Scriptable rhs) | static int | lastIndexResult(Context cx) | public static Scriptable | lastStoredScriptable(Context cx) | public static long | lastUint32Result(Context cx) | public static Scriptable | leaveDotQuery(Scriptable scope) | public static Scriptable | leaveWith(Scriptable scope) | static String | makeUrlForGeneratedScript(boolean isEval, String masterScriptUrl, int masterScriptLine) | public static Ref | memberRef(Object obj, Object elem, Context cx, int memberTypeFlags) | public static Ref | memberRef(Object obj, Object namespace, Object elem, Context cx, int memberTypeFlags) | public static Object | name(Context cx, Scriptable scope, String name) Looks up a name in the scope chain and returns its value. | public static Object | nameIncrDecr(Scriptable scopeChain, String id, int incrDecrMask) | public static Object | nameIncrDecr(Scriptable scopeChain, String id, Context cx, int incrDecrMask) | public static Ref | nameRef(Object name, Context cx, Scriptable scope, int memberTypeFlags) | public static Ref | nameRef(Object namespace, Object name, Context cx, Scriptable scope, int memberTypeFlags) | public static Scriptable | newArrayLiteral(Object[] objects, int[] skipIndices, Context cx, Scriptable scope) | public static Scriptable | newCatchScope(Throwable t, Scriptable lastCatchScope, String exceptionName, Context cx, Scriptable scope) | public static Scriptable | newObject(Context cx, Scriptable scope, String constructorName, Object[] args) | public static Scriptable | newObject(Object fun, Context cx, Scriptable scope, Object[] args) Operator new. | public static Scriptable | newObjectLiteral(Object[] propertyIds, Object[] propertyValues, Context cx, Scriptable scope) This method is here for backward compat with existing compiled code. | public static Scriptable | newObjectLiteral(Object[] propertyIds, Object[] propertyValues, int[] getterSetters, Context cx, Scriptable scope) | public static Object | newSpecial(Context cx, Object fun, Object[] args, Scriptable scope, int callType) | public static RuntimeException | notFoundError(Scriptable object, String property) | public static RuntimeException | notFunctionError(Object value) | public static RuntimeException | notFunctionError(Object value, Object messageHelper) | public static RuntimeException | notFunctionError(Object obj, Object value, String propertyName) | public static String | numberToString(double d, int base) | public static Object[] | padArguments(Object[] args, int count) Helper function for builtin objects that use the varargs form. | public static Object | propIncrDecr(Object obj, String id, Context cx, int incrDecrMask) | public static Object | refDel(Ref ref, Context cx) | public static Object | refGet(Ref ref, Context cx) | public static Object | refIncrDecr(Ref ref, Context cx, int incrDecrMask) | public static Object | refSet(Ref ref, Object value, Context cx) | public static Object | searchDefaultNamespace(Context cx) | public static Object | setConst(Scriptable bound, Object value, Context cx, String id) | public static Object | setDefaultNamespace(Object namespace, Context cx) | public static void | setEnumNumbers(Object enumObj, boolean enumNumbers) | public static void | setFunctionProtoAndParent(BaseFunction fn, Scriptable scope) | public static Object | setName(Scriptable bound, Object value, Context cx, Scriptable scope, String id) | public static Object | setObjectElem(Object obj, Object elem, Object value, Context cx) | public static Object | setObjectElem(Scriptable obj, Object elem, Object value, Context cx) | public static Object | setObjectIndex(Object obj, double dblIndex, Object value, Context cx) | public static Object | setObjectIndex(Scriptable obj, int index, Object value, Context cx) | public static Object | setObjectProp(Object obj, String property, Object value, Context cx) Version of setObjectElem when elem is a valid JS identifier name. | public static Object | setObjectProp(Scriptable obj, String property, Object value, Context cx) | public static void | setObjectProtoAndParent(ScriptableObject object, Scriptable scope) | public static void | setRegExpProxy(Context cx, RegExpProxy proxy) | public static boolean | shallowEq(Object x, Object y) | public static Ref | specialRef(Object obj, String specialProperty, Context cx) | public static void | storeUint32Result(Context cx, long value) | static double | stringToNumber(String s, int start, int radix) | public static long | testUint32String(String str) If str is a decimal presentation of Uint32 value, return it as long. | public static boolean | toBoolean(Object val) Convert the value to a boolean. | public static int | toInt32(Object val) See ECMA 9.5. | public static int | toInt32(Object[] args, int index) | public static int | toInt32(double d) | public static double | toInteger(Object val) See ECMA 9.4. | public static double | toInteger(double d) | public static double | toInteger(Object[] args, int index) | public static Scriptable | toIterator(Context cx, Scriptable scope, Scriptable obj, boolean keyOnly) | public static double | toNumber(Object val) Convert the value to a number. | public static double | toNumber(Object[] args, int index) | public static double | toNumber(String s) | public static Scriptable | toObject(Scriptable scope, Object val) | public static Scriptable | toObject(Scriptable scope, Object val, Class staticClass) | public static Scriptable | toObject(Context cx, Scriptable scope, Object val) Convert the value to an object. | public static Scriptable | toObject(Context cx, Scriptable scope, Object val, Class staticClass) | public static Scriptable | toObjectOrNull(Context cx, Object obj) | public static String | toString(Object val) Convert the value to a string. | public static String | toString(Object[] args, int index) | public static String | toString(double val) Optimized version of toString(Object) for numbers. | static String | toStringIdOrIndex(Context cx, Object id) If toString(id) is a decimal presentation of int32 value, then id
is index. | public static char | toUint16(Object val) See ECMA 9.7. | public static long | toUint32(double d) See ECMA 9.6. | public static long | toUint32(Object val) | public static EcmaError | typeError(String message) | public static EcmaError | typeError0(String messageId) | public static EcmaError | typeError1(String messageId, String arg1) | public static EcmaError | typeError2(String messageId, String arg1, String arg2) | public static EcmaError | typeError3(String messageId, String arg1, String arg2, String arg3) | public static String | typeof(Object value) | public static String | typeofName(Scriptable scope, String id) | public static RuntimeException | undefCallError(Object object, Object id) | public static RuntimeException | undefReadError(Object object, Object id) | public static RuntimeException | undefWriteError(Object object, Object id, Object value) | static String | uneval(Context cx, Scriptable scope, Object value) | public static Object | updateDotQuery(boolean value, Scriptable scope) | public static Boolean | wrapBoolean(boolean b) | public static Integer | wrapInt(int i) | public static Number | wrapNumber(double x) |
BooleanClassByteClassCharacterClassClassClassDoubleClassFloatClassIntegerClassLongClassNumberClassObjectClassShortClassStringClassDateClass | final public static Class BooleanClassByteClassCharacterClassClassClassDoubleClassFloatClassIntegerClassLongClassNumberClassObjectClassShortClassStringClassDateClass(Code) | | |
ContextClassContextFactoryClassFunctionClassScriptableClassScriptableObjectClass | final public static Class ContextClassContextFactoryClassFunctionClassScriptableClassScriptableObjectClass(Code) | | |
ENUMERATE_ARRAY | final public static int ENUMERATE_ARRAY(Code) | | |
ENUMERATE_ARRAY_NO_ITERATOR | final public static int ENUMERATE_ARRAY_NO_ITERATOR(Code) | | |
ENUMERATE_KEYS | final public static int ENUMERATE_KEYS(Code) | | |
ENUMERATE_KEYS_NO_ITERATOR | final public static int ENUMERATE_KEYS_NO_ITERATOR(Code) | | |
ENUMERATE_VALUES | final public static int ENUMERATE_VALUES(Code) | | |
ENUMERATE_VALUES_NO_ITERATOR | final public static int ENUMERATE_VALUES_NO_ITERATOR(Code) | | |
NaN | final public static double NaN(Code) | | |
negativeZero | final public static double negativeZero(Code) | | |
ScriptRuntime | protected ScriptRuntime()(Code) | | No instances should be created.
|
addInstructionCount | public static void addInstructionCount(Context cx, int instructionsToAdd)(Code) | | |
bind | public static Scriptable bind(Context cx, Scriptable scope, String id)(Code) | | 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
|
checkDynamicScope | static Scriptable checkDynamicScope(Scriptable possibleDynamicScope, Scriptable staticTopScope)(Code) | | Return possibleDynamicScope if staticTopScope
is present on its prototype chain and return staticTopScope
otherwise.
Should only be called when staticTopScope is top scope.
|
delete | public static Object delete(Object obj, Object id, Context cx)(Code) | | 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.
|
escapeAttributeValue | public static String escapeAttributeValue(Object value, Context cx)(Code) | | Escapes the reserved characters in a value of an attribute
Parameters: value - Unescaped text The escaped text |
escapeString | public static String escapeString(String s, char escapeQuote)(Code) | | For escaping strings printed by object and array literals; not quite
the same as 'escape.'
|
escapeTextValue | public static String escapeTextValue(Object value, Context cx)(Code) | | Escapes the reserved characters in a value of a text node
Parameters: value - Unescaped text The escaped text |
exitActivationFunction | public static void exitActivationFunction(Context cx)(Code) | | |
getElemFunctionAndThis | public static Callable getElemFunctionAndThis(Object obj, Object elem, Context cx)(Code) | | 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.
|
getIndexObject | static Object getIndexObject(String s)(Code) | | If s represents index, then return index value wrapped as Integer
and othewise return s.
|
getIndexObject | static Object getIndexObject(double d)(Code) | | If d is exact int value, return its value wrapped as Integer
and othewise return d converted to String.
|
getNameFunctionAndThis | public static Callable getNameFunctionAndThis(String name, Context cx, Scriptable scope)(Code) | | 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.
|
getObjectProp | public static Object getObjectProp(Object obj, String property, Context cx)(Code) | | Version of getObjectElem when elem is a valid JS identifier name.
|
getPropFunctionAndThis | public static Callable getPropFunctionAndThis(Object obj, String property, Context cx)(Code) | | 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.
|
getValueFunctionAndThis | public static Callable getValueFunctionAndThis(Object value, Context cx)(Code) | | 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.
|
in | public static boolean in(Object a, Object b, Context cx)(Code) | | 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 Parameters: b - the right hand operand true if property name or element number a is a property of b |
isArrayObject | public static boolean isArrayObject(Object obj)(Code) | | |
isGeneratedScript | static boolean isGeneratedScript(String sourceUrl)(Code) | | |
isJSLineTerminator | public static boolean isJSLineTerminator(int c)(Code) | | |
isRhinoRuntimeType | public static boolean isRhinoRuntimeType(Class cl)(Code) | | |
isSpecialProperty | static boolean isSpecialProperty(String s)(Code) | | |
isValidIdentifierName | static boolean isValidIdentifierName(String s)(Code) | | |
jsDelegatesTo | public static boolean jsDelegatesTo(Scriptable lhs, Scriptable rhs)(Code) | | Delegates to
true iff rhs appears in lhs' proto chain |
lastUint32Result | public static long lastUint32Result(Context cx)(Code) | | |
makeUrlForGeneratedScript | static String makeUrlForGeneratedScript(boolean isEval, String masterScriptUrl, int masterScriptLine)(Code) | | |
newObjectLiteral | public static Scriptable newObjectLiteral(Object[] propertyIds, Object[] propertyValues, Context cx, Scriptable scope)(Code) | | 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.
|
numberToString | public static String numberToString(double d, int base)(Code) | | |
padArguments | public static Object[] padArguments(Object[] args, int count)(Code) | | 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.
|
setEnumNumbers | public static void setEnumNumbers(Object enumObj, boolean enumNumbers)(Code) | | |
storeUint32Result | public static void storeUint32Result(Context cx, long value)(Code) | | |
stringToNumber | static double stringToNumber(String s, int start, int radix)(Code) | | |
testUint32String | public static long testUint32String(String str)(Code) | | If str is a decimal presentation of Uint32 value, return it as long.
Othewise return -1L;
|
toBoolean | public static boolean toBoolean(Object val)(Code) | | Convert the value to a boolean.
See ECMA 9.2.
|
toInt32 | public static int toInt32(Object val)(Code) | | See ECMA 9.5.
|
toInt32 | public static int toInt32(Object[] args, int index)(Code) | | |
toInt32 | public static int toInt32(double d)(Code) | | |
toInteger | public static double toInteger(Object val)(Code) | | See ECMA 9.4.
|
toInteger | public static double toInteger(double d)(Code) | | |
toInteger | public static double toInteger(Object[] args, int index)(Code) | | |
toNumber | public static double toNumber(Object val)(Code) | | Convert the value to a number.
See ECMA 9.3.
|
toNumber | public static double toNumber(Object[] args, int index)(Code) | | |
toNumber | public static double toNumber(String s)(Code) | | ToNumber applied to the String type
See ECMA 9.3.1
|
toString | public static String toString(Object val)(Code) | | Convert the value to a string.
See ECMA 9.8.
|
toString | public static String toString(double val)(Code) | | Optimized version of toString(Object) for numbers.
|
toStringIdOrIndex | static String toStringIdOrIndex(Context cx, Object id)(Code) | | If toString(id) is a decimal presentation of int32 value, then id
is index. In this case return null and make the index available
as ScriptRuntime.lastIndexResult(cx). Otherwise return toString(id).
|
toUint16 | public static char toUint16(Object val)(Code) | | See ECMA 9.7.
|
toUint32 | public static long toUint32(double d)(Code) | | See ECMA 9.6.
long value representing 32 bits unsigned integer |
|
|