Class ScriptRuntime
- Direct Known Subclasses:
OptRuntime
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
private static class
This is the enumeration needed by the for..in statement.static interface
This is an interface defining a message provider.(package private) static class
(package private) static final class
Helper to return a string or an integer. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Class<?>
static final Class<?>
static final Class<?>
static final Class<?>
static final Class<?>
static final Class<?>
static final Class<?>
static final Class<?>
private static final String
static final Class<?>
static final Object[]
static final String[]
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final Class<?>
static final Class<?>
static final Class<?>
private static final Object
static final Class<?>
static final ScriptRuntime.MessageProvider
static final double
static final Double
static final double
static final Double
static final Class<?>
static final Class<?>
static final Class<Scriptable>
static final Class<?>
static final Class<?>
static final Class<?>
static final Double
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CharSequence
add
(CharSequence val1, Object val2) Deprecated.static CharSequence
add
(Object val1, CharSequence val2) Deprecated.Useadd(Object, Object, Context)
insteadstatic Object
static void
addInstructionCount
(Context cx, int instructionsToAdd) static Object
applyOrCall
(boolean isApply, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) Function.prototype.apply and Function.prototype.callstatic String
bigIntToString
(BigInteger n, int base) static Scriptable
bind
(Context cx, Scriptable scope, String id) Returns the object in the scope chain that has a given property.static Number
bitwiseAND
(Number val1, Number val2) static Number
bitwiseNOT
(Number val) static Number
static Number
bitwiseXOR
(Number val1, Number val2) static Object
Deprecated.The method is only present for compatibility.static Object
callIterator
(Object obj, Context cx, Scriptable scope) Given an object, get the "Symbol.iterator" element, throw a TypeError if it is not present, then call the result, (throwing a TypeError if the result is not a function), and return that result, whatever it is.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) (package private) static void
checkDeprecated
(Context cx, String name) (package private) static Scriptable
checkDynamicScope
(Scriptable possibleDynamicScope, Scriptable staticTopScope) ReturnpossibleDynamicScope
ifstaticTopScope
is present on its prototype chain and returnstaticTopScope
otherwise.static RegExpProxy
static boolean
static boolean
private static <T> boolean
compareTo
(double d1, double d2, int op) private static <T> boolean
compareTo
(Comparable<T> val1, T val2, int op) static EcmaError
constructError
(String error, String message) static EcmaError
constructError
(String error, String message, int lineNumberDelta) static EcmaError
constructError
(String error, String message, String sourceName, int lineNumber, String lineSource, int columnNumber) static Scriptable
createArrowFunctionActivation
(NativeFunction funObj, Scriptable scope, Object[] args, boolean isStrict) static Scriptable
createFunctionActivation
(NativeFunction funObj, Scriptable scope, Object[] args) Deprecated.static Scriptable
createFunctionActivation
(NativeFunction funObj, Scriptable scope, Object[] args, boolean isStrict) private static XMLLib
currentXMLLib
(Context cx) (package private) static String
defaultObjectToSource
(Context cx, Scriptable scope, Scriptable thisObj, Object[] args) (package private) static String
static Object
Deprecated.static Object
Deprecated.static Object
delete
(Object obj, Object id, Context cx, Scriptable scope, boolean isName) The delete operatorstatic boolean
deleteObjectElem
(Scriptable target, Object elem, Context cx) static Number
private static Object
doScriptableIncrDecr
(Scriptable target, String id, Scriptable protoChainStart, Object value, int incrDecrMask) static Object
doTopCall
(Callable callable, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) Deprecated.static Object
doTopCall
(Callable callable, Context cx, Scriptable scope, Scriptable thisObj, Object[] args, boolean isTopLevelStrict) static Object
elemIncrDecr
(Object obj, Object index, Context cx, int incrDecrMask) Deprecated.static Object
elemIncrDecr
(Object obj, Object index, Context cx, Scriptable scope, 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) private static void
static Object
static Object
Deprecated.UseenumInit(Object, Context, Scriptable, int)
insteadstatic Object
Deprecated.UseenumInit(Object, Context, Scriptable, int)
insteadstatic Object
enumInit
(Object value, Context cx, Scriptable scope, int enumType) private static Object
static Boolean
private static Boolean
static Object
static boolean
Equalityprivate static boolean
eqBigInt
(BigInteger x, double y) (package private) static boolean
eqBigInt
(BigInteger x, Object y) (package private) static boolean
private static boolean
eqString
(CharSequence x, Object y) private static RuntimeException
errorWithClassName
(String msg, Object val) static String
escapeAttributeValue
(Object value, Context cx) Escapes the reserved characters in a value of an attributestatic String
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 nodestatic Object
evalSpecial
(Context cx, Scriptable scope, Object thisArg, Object[] args, String filename, int lineNumber) The eval function property of the global object.static void
static Number
exponentiate
(Number val1, Number val2) (package private) static NativeCall
(package private) static Object[]
getApplyArguments
(Context cx, Object arg1) static Object[]
getArrayElements
(Scriptable object) (package private) static Callable
getCallable
(Scriptable thisObj) static Callable
getElemFunctionAndThis
(Object obj, Object elem, Context cx) Deprecated.static Callable
getElemFunctionAndThis
(Object obj, Object elem, Context cx, Scriptable scope) 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.(package private) static Function
getExistingCtor
(Context cx, Scriptable scope, String constructorName) static ScriptableObject
(package private) static Object
getIndexObject
(double d) If d is exact int value, return its value wrapped as Integer and othewise return d converted to String.(package private) static Object
If s represents index, then return index value wrapped as Integer and othewise return s.static ScriptableObject
getLibraryScopeOrNull
(Scriptable scope) static String
getMessage
(String messageId, Object[] arguments) Deprecated.UsegetMessageById(String messageId, Object...args)
insteadstatic String
getMessage0
(String messageId) Deprecated.UsegetMessageById(String messageId, Object...args)
insteadstatic String
getMessage1
(String messageId, Object arg1) Deprecated.UsegetMessageById(String messageId, Object...args)
insteadstatic String
getMessage2
(String messageId, Object arg1, Object arg2) Deprecated.UsegetMessageById(String messageId, Object...args)
insteadstatic String
getMessage3
(String messageId, Object arg1, Object arg2, Object arg3) Deprecated.UsegetMessageById(String messageId, Object...args)
insteadstatic String
Deprecated.UsegetMessageById(String messageId, Object...args)
insteadstatic String
getMessageById
(String messageId, Object... args) 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) Deprecated.static Object
getObjectElem
(Object obj, Object elem, Context cx, Scriptable scope) Call obj.[[Get]](id)static Object
getObjectElem
(Scriptable obj, Object elem, Context cx) static Object
getObjectIndex
(Object obj, double dblIndex, Context cx) Deprecated.static Object
getObjectIndex
(Object obj, double dblIndex, Context cx, Scriptable scope) A cheaper and less general version of the above for well-known argument types.static Object
getObjectIndex
(Scriptable obj, int index, Context cx) static Object
getObjectProp
(Object obj, String property, Context cx) Deprecated.static Object
getObjectProp
(Object obj, String property, Context cx, Scriptable scope) Version of getObjectElem when elem is a valid JS identifier name.static Object
getObjectProp
(Scriptable obj, String property, Context cx) static Object
getObjectPropNoWarn
(Object obj, String property, Context cx) Deprecated.static Object
getObjectPropNoWarn
(Object obj, String property, Context cx, Scriptable scope) static Callable
getPropFunctionAndThis
(Object obj, String property, Context cx) Deprecated.static Callable
getPropFunctionAndThis
(Object obj, String property, Context cx, Scriptable scope) 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.private static Callable
getPropFunctionAndThisHelper
(Object obj, String property, Context cx, Scriptable thisObj) static RegExpProxy
static Scriptable
getTemplateLiteralCallSite
(Context cx, Scriptable scope, Object[] strings, int index) static Scriptable
static Object
getTopLevelProp
(Scriptable scope, String id) (package private) static String[]
static Callable
getValueFunctionAndThis
(Object value, Context cx) Prepare for calling <expression>(...): return function corresponding to <expression> 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
The in operator.static long
indexFromString
(String str) Return -1L if str is not an index, or the index value as lower 32 bits of the result.static void
initFunction
(Context cx, Scriptable scope, NativeFunction function, int type, boolean fromEvalCode) static ScriptableObject
initSafeStandardObjects
(Context cx, ScriptableObject scope, boolean sealed) 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.private static boolean
isArrayLike
(Scriptable obj) static boolean
isArrayObject
(Object obj) (package private) static boolean
isGeneratedScript
(String sourceUrl) static boolean
isIteratorDone
(Context cx, Object result) Given an iterator result, return true if and only if there is a "done" property that's true.static boolean
isJSLineTerminator
(int c) static boolean
static boolean
static boolean
static boolean
isPrimitive
(Object obj) static boolean
isRhinoRuntimeType
(Class<?> cl) (package private) static boolean
(package private) static boolean
isStrWhiteSpaceChar
(int c) Indicates if the character is a Str whitespace char according to ECMA spec: StrWhiteSpaceChar :::(package private) static boolean
Not all "NativeSymbol" instances are actually symbols.(package private) static boolean
isValidIdentifierName
(String s, Context cx, boolean isStrict) private static boolean
static boolean
jsDelegatesTo
(Scriptable lhs, Scriptable rhs) Delegates tostatic Scriptable
static long
static Scriptable
leaveDotQuery
(Scriptable scope) static Scriptable
leaveWith
(Scriptable scope) static Number
static boolean
loadFromIterable
(Context cx, Scriptable scope, Object arg1, BiConsumer<Object, Object> setter) This is used to handle all the special cases that are required when invoking Object.fromEntries or constructing a NativeMap or NativeWeakMap from an iterable.(package private) static String
makeUrlForGeneratedScript
(boolean isEval, String masterScriptUrl, int masterScriptLine) static Ref
static Ref
static Number
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.UsenameIncrDecr(Scriptable, String, Context, int)
insteadstatic Object
nameIncrDecr
(Scriptable scopeChain, String id, Context cx, int incrDecrMask) private static Object
nameOrFunction
(Context cx, Scriptable scope, Scriptable parentScope, String name, boolean asFunctionCall) 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 Number
static Scriptable
newArrayLiteral
(Object[] objects, int[] skipIndices, Context cx, Scriptable scope) static Scriptable
newBuiltinObject
(Context cx, Scriptable scope, TopLevel.Builtins type, Object[] args) static Scriptable
newCatchScope
(Throwable t, Scriptable lastCatchScope, String exceptionName, Context cx, Scriptable scope) (package private) static Scriptable
newNativeError
(Context cx, Scriptable scope, TopLevel.NativeErrors type, Object[] args) 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.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 RuntimeException
notFunctionError
(Object obj, Object value, String propertyName) private static RuntimeException
notXmlError
(Object value) 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) Deprecated.static Object
propIncrDecr
(Object obj, String id, Context cx, Scriptable scope, int incrDecrMask) static EcmaError
rangeError
(String message) static EcmaError
rangeErrorById
(String messageId, Object... args) static Object
static Object
static Object
refIncrDecr
(Ref ref, Context cx, int incrDecrMask) Deprecated.UserefIncrDecr(Ref, Context, Scriptable, int)
insteadstatic Object
refIncrDecr
(Ref ref, Context cx, Scriptable scope, int incrDecrMask) static Object
Deprecated.UserefSet(Ref, Object, Context, Scriptable)
insteadstatic Object
refSet
(Ref ref, Object value, Context cx, Scriptable scope) static Number
static boolean
static boolean
Implement "SameValueZero" from ECMA 7.2.9static Object
static void
setBuiltinProtoAndParent
(ScriptableObject object, Scriptable scope, TopLevel.Builtins type) static Object
setConst
(Scriptable bound, Object value, Context cx, String id) static Object
setDefaultNamespace
(Object namespace, Context cx) static void
setEnumNumbers
(Object enumObj, boolean enumNumbers) static void
setFunctionProtoAndParent
(BaseFunction fn, Scriptable scope) static void
setFunctionProtoAndParent
(BaseFunction fn, Scriptable scope, boolean es6GeneratorFunction) static Object
setName
(Scriptable bound, Object value, Context cx, Scriptable scope, String id) static Object
setObjectElem
(Object obj, Object elem, Object value, Context cx) Deprecated.static Object
setObjectElem
(Object obj, Object elem, Object value, Context cx, Scriptable scope) Call obj.[[Put]](id, value)static Object
setObjectElem
(Scriptable obj, Object elem, Object value, Context cx) static Object
setObjectIndex
(Object obj, double dblIndex, Object value, Context cx) Deprecated.static Object
setObjectIndex
(Object obj, double dblIndex, Object value, Context cx, Scriptable scope) A cheaper and less general version of the above for well-known argument types.static Object
setObjectIndex
(Scriptable obj, int index, Object value, Context cx) static Object
setObjectProp
(Object obj, String property, Object value, Context cx) Deprecated.static Object
setObjectProp
(Object obj, String property, Object value, Context cx, Scriptable scope) 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
static Number
signedRightShift
(Number val1, Number val2) static Ref
specialRef
(Object obj, String specialProperty, Context cx) Deprecated.UsespecialRef(Object, String, Context, Scriptable)
insteadstatic Ref
specialRef
(Object obj, String specialProperty, Context cx, Scriptable scope) private static void
storeScriptable
(Context cx, Scriptable value) static void
storeUint32Result
(Context cx, long value) static Object
strictSetName
(Scriptable bound, Object value, Context cx, Scriptable scope, String id) (package private) static double
stringPrefixToNumber
(String s, int start, int radix) (package private) static double
stringToNumber
(String s, int start, int end, int radix) private static double
stringToNumber
(String source, int sourceStart, int sourceEnd, int radix, boolean isPrefix) static Number
static EcmaError
syntaxError
(String message) static EcmaError
syntaxErrorById
(String messageId, Object... args) static long
testUint32String
(String str) If str is a decimal presentation of Uint32 value, return it as long.static JavaScriptException
throwCustomError
(Context cx, Scriptable scope, String constructorName, String message) Equivalent to executing "new $constructorName(message, sourceFileName, sourceLineNo)" from JavaScript.static JavaScriptException
throwError
(Context cx, Scriptable scope, String message) Equivalent to executing "new Error(message, sourceFileName, sourceLineNo)" from JavaScript.static BigInteger
Convert the value to a BigInt.static BigInteger
ToBigInt applied to the String typestatic boolean
Convert the value to a boolean.static CharSequence
toCharSequence
(Object val) static int
static int
toInt32
(double d) static int
See ECMA 9.5.static int
static double
toInteger
(double d) static double
See ECMA 9.4.static double
static Scriptable
toIterator
(Context cx, Scriptable scope, Scriptable obj, boolean keyOnly) static long
static double
Convert the value to a number.static double
static double
ToNumber applied to the String typestatic Number
Convert the value to a Numeric (Number or BigInt).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.UsetoObject(Context, Scriptable, Object)
instead.static Scriptable
toObject
(Scriptable scope, Object val) static Scriptable
toObject
(Scriptable scope, Object val, Class<?> staticClass) Deprecated.UsetoObject(Scriptable, Object)
instead.static Scriptable
toObjectOrNull
(Context cx, Object obj) Deprecated.UsetoObjectOrNull(Context, Object, Scriptable)
insteadstatic Scriptable
toObjectOrNull
(Context cx, Object obj, Scriptable scope) static Object
toPrimitive
(Object val) static Object
toPrimitive
(Object val, Class<?> typeHint) private static Object
topScopeName
(Context cx, Scriptable scope, String name) static String
toString
(double val) Optimized version of toString(Object) for numbers.static String
Convert the value to a string.static String
(package private) static ScriptRuntime.StringIdOrIndex
toStringIdOrIndex
(Context cx, Object id) If toString(id) is a decimal presentation of int32 value, then id is index.static char
See ECMA 9.7.static long
toUint32
(double d) See ECMA 9.6.static long
static EcmaError
static EcmaError
typeError0
(String messageId) Deprecated.UsetypeErrorById(String messageId, Object...args)
insteadstatic EcmaError
typeError1
(String messageId, Object arg1) Deprecated.UsetypeErrorById(String messageId, Object...args)
insteadstatic EcmaError
typeError2
(String messageId, Object arg1, Object arg2) Deprecated.UsetypeErrorById(String messageId, Object...args)
insteadstatic EcmaError
typeError3
(String messageId, String arg1, String arg2, String arg3) Deprecated.UsetypeErrorById(String messageId, Object...args)
insteadstatic EcmaError
typeErrorById
(String messageId, Object... args) static BaseFunction
Deprecated.static BaseFunction
Returns representation of the [[ThrowTypeError]] object.static String
The typeof operatorstatic String
typeofName
(Scriptable scope, String id) The typeof operator that correctly handles the undefined casestatic RuntimeException
undefCallError
(Object object, Object id) private static RuntimeException
undefDeleteError
(Object object, Object id) static RuntimeException
undefReadError
(Object object, Object id) static RuntimeException
undefWriteError
(Object object, Object id, Object value) (package private) static String
uneval
(Context cx, Scriptable scope, Object value) static Object
updateDotQuery
(boolean value, Scriptable scope) private static void
warnAboutNonJSObject
(Object nonJSObject) static Boolean
wrapBoolean
(boolean b) static Scriptable
wrapException
(Throwable t, Scriptable scope, Context cx) static Integer
wrapInt
(int i) static Number
wrapNumber
(double x) static Scriptable
wrapRegExp
(Context cx, Scriptable scope, Object compiled)
-
Field Details
-
BooleanClass
-
ByteClass
-
CharacterClass
-
ClassClass
-
DoubleClass
-
FloatClass
-
IntegerClass
-
LongClass
-
NumberClass
-
ObjectClass
-
ShortClass
-
StringClass
-
DateClass
-
BigIntegerClass
-
ContextClass
-
ContextFactoryClass
-
FunctionClass
-
ScriptableObjectClass
-
ScriptableClass
-
LIBRARY_SCOPE_KEY
-
NaN
public static final double NaN- See Also:
-
NaNobj
-
negativeZero
public static final double negativeZero -
zeroObj
-
negativeZeroObj
-
DEFAULT_NS_TAG
- See Also:
-
ENUMERATE_KEYS
public static final int ENUMERATE_KEYS- See Also:
-
ENUMERATE_VALUES
public static final int ENUMERATE_VALUES- See Also:
-
ENUMERATE_ARRAY
public static final int ENUMERATE_ARRAY- See Also:
-
ENUMERATE_KEYS_NO_ITERATOR
public static final int ENUMERATE_KEYS_NO_ITERATOR- See Also:
-
ENUMERATE_VALUES_NO_ITERATOR
public static final int ENUMERATE_VALUES_NO_ITERATOR- See Also:
-
ENUMERATE_ARRAY_NO_ITERATOR
public static final int ENUMERATE_ARRAY_NO_ITERATOR- See Also:
-
ENUMERATE_VALUES_IN_ORDER
public static final int ENUMERATE_VALUES_IN_ORDER- See Also:
-
messageProvider
-
emptyArgs
-
emptyStrings
-
-
Constructor Details
-
ScriptRuntime
protected ScriptRuntime()No instances should be created.
-
-
Method Details
-
typeErrorThrower
Deprecated.Returns representation of the [[ThrowTypeError]] object. See ECMA 5 spec, 13.2.3 -
typeErrorThrower
Returns representation of the [[ThrowTypeError]] object. See ECMA 5 spec, 13.2.3 -
isRhinoRuntimeType
-
initSafeStandardObjects
public static ScriptableObject initSafeStandardObjects(Context cx, ScriptableObject scope, boolean sealed) -
initStandardObjects
public static ScriptableObject initStandardObjects(Context cx, ScriptableObject scope, boolean sealed) -
getTopPackageNames
-
getLibraryScopeOrNull
-
isJSLineTerminator
public static boolean isJSLineTerminator(int c) -
isJSWhitespaceOrLineTerminator
public static boolean isJSWhitespaceOrLineTerminator(int c) -
isStrWhiteSpaceChar
static boolean isStrWhiteSpaceChar(int c) Indicates if the character is a Str whitespace char according to ECMA spec: StrWhiteSpaceChar ::: -
wrapBoolean
-
wrapInt
-
wrapNumber
-
toBoolean
Convert the value to a boolean.See ECMA 9.2.
-
toNumber
Convert the value to a number.See ECMA 9.3.
-
toNumber
-
stringPrefixToNumber
-
stringToNumber
-
stringToNumber
private static double stringToNumber(String source, int sourceStart, int sourceEnd, int radix, boolean isPrefix) -
toNumber
ToNumber applied to the String typeSee the #sec-tonumber-applied-to-the-string-type section of ECMA
-
toBigInt
Convert the value to a BigInt. -
toBigInt
ToBigInt applied to the String type -
toNumeric
Convert the value to a Numeric (Number or BigInt).toNumber does not allow java.math.BigInteger. toNumeric allows java.math.BigInteger.
See ECMA 7.1.3 (v11.0).
-
toIndex
-
padArguments
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. -
escapeString
-
escapeString
For escaping strings printed by object and array literals; not quite the same as 'escape.' -
isValidIdentifierName
-
toCharSequence
-
toString
Convert the value to a string.See ECMA 9.8.
-
defaultObjectToString
-
toString
-
toString
Optimized version of toString(Object) for numbers. -
numberToString
-
bigIntToString
-
uneval
-
defaultObjectToSource
static String defaultObjectToSource(Context cx, Scriptable scope, Scriptable thisObj, Object[] args) -
toObject
-
toObjectOrNull
Deprecated.UsetoObjectOrNull(Context, Object, Scriptable)
insteadWarning: This doesn't allow to resolve primitive prototype properly when many top scopes are involved -
toObjectOrNull
- Parameters:
scope
- the scope that should be used to resolve primitive prototype
-
toObject
Deprecated.UsetoObject(Scriptable, Object)
instead. -
toObject
Convert the value to an object.See ECMA 9.9.
-
toObject
@Deprecated public static Scriptable toObject(Context cx, Scriptable scope, Object val, Class<?> staticClass) Deprecated.UsetoObject(Context, Scriptable, Object)
instead. -
call
@Deprecated public static Object call(Context cx, Object fun, Object thisArg, Object[] args, Scriptable scope) Deprecated.The method is only present for compatibility. -
newObject
public static Scriptable newObject(Context cx, Scriptable scope, String constructorName, Object[] args) -
newBuiltinObject
public static Scriptable newBuiltinObject(Context cx, Scriptable scope, TopLevel.Builtins type, Object[] args) -
newNativeError
static Scriptable newNativeError(Context cx, Scriptable scope, TopLevel.NativeErrors type, Object[] args) -
toInteger
See ECMA 9.4. -
toInteger
public static double toInteger(double d) -
toInteger
-
toLength
-
toInt32
See ECMA 9.5. -
toInt32
-
toInt32
public static int toInt32(double d) -
toUint32
public static long toUint32(double d) See ECMA 9.6.- Returns:
- long value representing 32 bits unsigned integer
-
toUint32
-
toUint16
See ECMA 9.7. -
setDefaultNamespace
-
searchDefaultNamespace
-
getTopLevelProp
-
getExistingCtor
-
indexFromString
Return -1L if str is not an index, or the index value as lower 32 bits of the result. Note that the result needs to be cast to an int in order to produce the actual index, which may be negative. -
testUint32String
If str is a decimal presentation of Uint32 value, return it as long. Othewise return -1L; -
getIndexObject
If s represents index, then return index value wrapped as Integer and othewise return s. -
getIndexObject
If d is exact int value, return its value wrapped as Integer and othewise return d converted to String. -
toStringIdOrIndex
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). -
getObjectElem
Deprecated.Call obj.[[Get]](id) -
getObjectElem
Call obj.[[Get]](id) -
getObjectElem
-
getObjectProp
Deprecated.Version of getObjectElem when elem is a valid JS identifier name. -
getObjectProp
Version of getObjectElem when elem is a valid JS identifier name.- Parameters:
scope
- the scope that should be used to resolve primitive prototype
-
getObjectProp
-
getObjectPropNoWarn
Deprecated. -
getObjectPropNoWarn
-
getObjectIndex
Deprecated.A cheaper and less general version of the above for well-known argument types. -
getObjectIndex
A cheaper and less general version of the above for well-known argument types. -
getObjectIndex
-
setObjectElem
Deprecated.Call obj.[[Put]](id, value) -
setObjectElem
public static Object setObjectElem(Object obj, Object elem, Object value, Context cx, Scriptable scope) Call obj.[[Put]](id, value) -
setObjectElem
-
setObjectProp
@Deprecated public static Object setObjectProp(Object obj, String property, Object value, Context cx) Deprecated.Version of setObjectElem when elem is a valid JS identifier name. -
setObjectProp
public static Object setObjectProp(Object obj, String property, Object value, Context cx, Scriptable scope) Version of setObjectElem when elem is a valid JS identifier name. -
setObjectProp
-
setObjectIndex
@Deprecated public static Object setObjectIndex(Object obj, double dblIndex, Object value, Context cx) Deprecated.A cheaper and less general version of the above for well-known argument types. -
setObjectIndex
public static Object setObjectIndex(Object obj, double dblIndex, Object value, Context cx, Scriptable scope) A cheaper and less general version of the above for well-known argument types. -
setObjectIndex
-
deleteObjectElem
-
hasObjectElem
-
refGet
-
refSet
Deprecated.UserefSet(Ref, Object, Context, Scriptable)
instead -
refSet
-
refDel
-
isSpecialProperty
-
specialRef
Deprecated.UsespecialRef(Object, String, Context, Scriptable)
instead -
specialRef
-
delete
Deprecated. -
delete
Deprecated.The delete operatorSee 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.
-
delete
The delete operatorSee 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.
-
name
Looks up a name in the scope chain and returns its value. -
nameOrFunction
private static Object nameOrFunction(Context cx, Scriptable scope, Scriptable parentScope, String name, boolean asFunctionCall) -
topScopeName
-
bind
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
-
setName
public static Object setName(Scriptable bound, Object value, Context cx, Scriptable scope, String id) -
strictSetName
public static Object strictSetName(Scriptable bound, Object value, Context cx, Scriptable scope, String id) -
setConst
-
toIterator
-
enumInit
Deprecated.UseenumInit(Object, Context, Scriptable, int)
insteadFor backwards compatibility with generated class files -
enumInit
Deprecated.UseenumInit(Object, Context, Scriptable, int)
instead -
enumInit
-
enumInitInOrder
-
setEnumNumbers
-
enumNext
-
enumNextInOrder
-
enumId
-
enumValue
-
enumChangeObject
-
loadFromIterable
public static boolean loadFromIterable(Context cx, Scriptable scope, Object arg1, BiConsumer<Object, Object> setter) This is used to handle all the special cases that are required when invoking Object.fromEntries or constructing a NativeMap or NativeWeakMap from an iterable.- Parameters:
cx
- the current contextscope
- the current scopearg1
- the iterable object.setter
- the setter to set the value- Returns:
- true, if arg1 was iterable.
-
getNameFunctionAndThis
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. -
getElemFunctionAndThis
Deprecated.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. -
getElemFunctionAndThis
public static Callable getElemFunctionAndThis(Object obj, Object elem, Context cx, Scriptable scope) 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. -
getPropFunctionAndThis
Deprecated.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. Warning: this doesn't allow to resolve primitive prototype properly when many top scopes are involved. -
getPropFunctionAndThis
public static Callable getPropFunctionAndThis(Object obj, String property, Context cx, Scriptable scope) 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. -
getPropFunctionAndThisHelper
private static Callable getPropFunctionAndThisHelper(Object obj, String property, Context cx, Scriptable thisObj) -
getValueFunctionAndThis
Prepare for calling <expression>(...): return function corresponding to <expression> 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. -
callIterator
Given an object, get the "Symbol.iterator" element, throw a TypeError if it is not present, then call the result, (throwing a TypeError if the result is not a function), and return that result, whatever it is. -
isIteratorDone
Given an iterator result, return true if and only if there is a "done" property that's true. -
callRef
Perform function call in reference context. Should always return value that can be passed torefGet(Ref, Context)
orrefSet(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. -
newObject
Operator new.See ECMA 11.2.2
-
callSpecial
public static Object callSpecial(Context cx, Callable fun, Scriptable thisObj, Object[] args, Scriptable scope, Scriptable callerThis, int callType, String filename, int lineNumber) -
newSpecial
public static Object newSpecial(Context cx, Object fun, Object[] args, Scriptable scope, int callType) -
applyOrCall
public static Object applyOrCall(boolean isApply, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) Function.prototype.apply and Function.prototype.callSee Ecma 15.3.4.[34]
-
isArrayLike
- Returns:
- true if the passed in Scriptable looks like an array
-
getApplyArguments
-
getCallable
-
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
-
typeof
The typeof operator -
typeofName
The typeof operator that correctly handles the undefined case -
isObject
-
add
-
add
Deprecated.Useadd(Object, Object, Context)
insteadhttps://262.ecma-international.org/11.0/#sec-addition-operator-plus 5. Let lprim be ? ToPrimitive(lval). 7. If Type(lprim) is String or Type(rprim) is String, then a. Let lstr be ? ToString(lprim).Should call toPrimitive before toCharSequence
-
add
Deprecated.Useadd(Object, Object, Context)
insteadhttps://262.ecma-international.org/11.0/#sec-addition-operator-plus 6. Let rprim be ? ToPrimitive(rval). 7. If Type(lprim) is String or Type(rprim) is String, then b. Let rstr be ? ToString(rprim).Should call toPrimitive before toCharSequence
-
subtract
-
multiply
-
divide
-
remainder
-
exponentiate
-
bitwiseAND
-
bitwiseOR
-
bitwiseXOR
-
leftShift
-
signedRightShift
-
bitwiseNOT
-
nameIncrDecr
Deprecated.UsenameIncrDecr(Scriptable, String, Context, int)
insteadThe method is only present for compatibility. -
nameIncrDecr
-
propIncrDecr
Deprecated. -
propIncrDecr
public static Object propIncrDecr(Object obj, String id, Context cx, Scriptable scope, int incrDecrMask) -
doScriptableIncrDecr
private static Object doScriptableIncrDecr(Scriptable target, String id, Scriptable protoChainStart, Object value, int incrDecrMask) -
elemIncrDecr
@Deprecated public static Object elemIncrDecr(Object obj, Object index, Context cx, int incrDecrMask) Deprecated. -
elemIncrDecr
public static Object elemIncrDecr(Object obj, Object index, Context cx, Scriptable scope, int incrDecrMask) -
refIncrDecr
Deprecated.UserefIncrDecr(Ref, Context, Scriptable, int)
instead -
refIncrDecr
-
negate
-
toPrimitive
-
toPrimitive
-
eq
EqualitySee ECMA 11.9
-
same
-
sameZero
Implement "SameValueZero" from ECMA 7.2.9 -
isNaN
-
isPrimitive
-
eqNumber
-
eqBigInt
-
eqBigInt
-
eqString
-
shallowEq
-
instanceOf
The instanceof operator.- Returns:
- a instanceof b
-
jsDelegatesTo
Delegates to- Returns:
- true iff rhs appears in lhs' proto chain
-
in
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 operandb
- the right hand operand- Returns:
- true if property name or element number a is a property of b
-
compare
-
compare
-
compareTo
-
compareTo
private static <T> boolean compareTo(double d1, double d2, int op) -
getGlobal
-
hasTopCall
-
getTopCallScope
-
doTopCall
@Deprecated public static Object doTopCall(Callable callable, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) Deprecated. -
doTopCall
public static Object doTopCall(Callable callable, Context cx, Scriptable scope, Scriptable thisObj, Object[] args, boolean isTopLevelStrict) -
checkDynamicScope
ReturnpossibleDynamicScope
ifstaticTopScope
is present on its prototype chain and returnstaticTopScope
otherwise. Should only be called whenstaticTopScope
is top scope. -
addInstructionCount
-
initScript
public static void initScript(NativeFunction funObj, Scriptable thisObj, Context cx, Scriptable scope, boolean evalScript) -
createFunctionActivation
@Deprecated public static Scriptable createFunctionActivation(NativeFunction funObj, Scriptable scope, Object[] args) Deprecated. -
createFunctionActivation
public static Scriptable createFunctionActivation(NativeFunction funObj, Scriptable scope, Object[] args, boolean isStrict) -
createArrowFunctionActivation
public static Scriptable createArrowFunctionActivation(NativeFunction funObj, Scriptable scope, Object[] args, boolean isStrict) -
enterActivationFunction
-
exitActivationFunction
-
findFunctionActivation
-
newCatchScope
public static Scriptable newCatchScope(Throwable t, Scriptable lastCatchScope, String exceptionName, Context cx, Scriptable scope) -
wrapException
-
isVisible
-
enterWith
-
leaveWith
-
enterDotQuery
-
updateDotQuery
-
leaveDotQuery
-
setFunctionProtoAndParent
-
setFunctionProtoAndParent
public static void setFunctionProtoAndParent(BaseFunction fn, Scriptable scope, boolean es6GeneratorFunction) -
setObjectProtoAndParent
-
setBuiltinProtoAndParent
public static void setBuiltinProtoAndParent(ScriptableObject object, Scriptable scope, TopLevel.Builtins type) -
initFunction
public static void initFunction(Context cx, Scriptable scope, NativeFunction function, int type, boolean fromEvalCode) -
newArrayLiteral
public static Scriptable newArrayLiteral(Object[] objects, int[] skipIndices, Context cx, Scriptable scope) -
newObjectLiteral
@Deprecated public static Scriptable newObjectLiteral(Object[] propertyIds, Object[] propertyValues, Context cx, Scriptable scope) Deprecated.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. This method only present for compatibility. -
newObjectLiteral
public static Scriptable newObjectLiteral(Object[] propertyIds, Object[] propertyValues, int[] getterSetters, Context cx, Scriptable scope) -
isArrayObject
-
getArrayElements
-
checkDeprecated
-
getMessage0
Deprecated.UsegetMessageById(String messageId, Object...args)
instead -
getMessage1
Deprecated.UsegetMessageById(String messageId, Object...args)
instead -
getMessage2
Deprecated.UsegetMessageById(String messageId, Object...args)
instead -
getMessage3
@Deprecated public static String getMessage3(String messageId, Object arg1, Object arg2, Object arg3) Deprecated.UsegetMessageById(String messageId, Object...args)
instead -
getMessage4
@Deprecated public static String getMessage4(String messageId, Object arg1, Object arg2, Object arg3, Object arg4) Deprecated.UsegetMessageById(String messageId, Object...args)
instead -
getMessage
Deprecated.UsegetMessageById(String messageId, Object...args)
instead -
getMessageById
-
constructError
-
constructError
-
constructError
-
rangeError
-
rangeErrorById
-
typeError
-
typeErrorById
-
typeError0
Deprecated.UsetypeErrorById(String messageId, Object...args)
instead -
typeError1
Deprecated.UsetypeErrorById(String messageId, Object...args)
instead -
typeError2
Deprecated.UsetypeErrorById(String messageId, Object...args)
instead -
typeError3
@Deprecated public static EcmaError typeError3(String messageId, String arg1, String arg2, String arg3) Deprecated.UsetypeErrorById(String messageId, Object...args)
instead -
undefReadError
-
undefCallError
-
undefWriteError
-
undefDeleteError
-
notFoundError
-
notFunctionError
-
notFunctionError
-
notFunctionError
-
notXmlError
-
syntaxError
-
syntaxErrorById
-
warnAboutNonJSObject
-
getRegExpProxy
-
setRegExpProxy
-
checkRegExpProxy
-
wrapRegExp
-
getTemplateLiteralCallSite
public static Scriptable getTemplateLiteralCallSite(Context cx, Scriptable scope, Object[] strings, int index) -
currentXMLLib
-
escapeAttributeValue
Escapes the reserved characters in a value of an attribute- Parameters:
value
- Unescaped text- Returns:
- The escaped text
-
escapeTextValue
Escapes the reserved characters in a value of a text node- Parameters:
value
- Unescaped text- Returns:
- The escaped text
-
memberRef
-
memberRef
-
nameRef
-
nameRef
public static Ref nameRef(Object namespace, Object name, Context cx, Scriptable scope, int memberTypeFlags) -
storeUint32Result
-
lastUint32Result
-
storeScriptable
-
lastStoredScriptable
-
makeUrlForGeneratedScript
-
isGeneratedScript
-
isSymbol
Not all "NativeSymbol" instances are actually symbols. So account for that here rather than just by using an "instanceof" check. -
errorWithClassName
-
throwError
Equivalent to executing "new Error(message, sourceFileName, sourceLineNo)" from JavaScript.- Parameters:
cx
- the current contextscope
- the current scopemessage
- the message- Returns:
- a JavaScriptException you should throw
-
throwCustomError
public static JavaScriptException throwCustomError(Context cx, Scriptable scope, String constructorName, String message) Equivalent to executing "new $constructorName(message, sourceFileName, sourceLineNo)" from JavaScript.- Parameters:
cx
- the current contextscope
- the current scopemessage
- the message- Returns:
- a JavaScriptException you should throw
-
add(Object, Object, Context)
instead