Class ScriptRuntime
- java.lang.Object
-
- org.htmlunit.corejs.javascript.ScriptRuntime
-
- Direct Known Subclasses:
OptRuntime
public class ScriptRuntime extends java.lang.Object
This is the class that implements the runtime.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
ScriptRuntime.DefaultMessageProvider
private static class
ScriptRuntime.IdEnumeration
This is the enumeration needed by the for..in statement.static interface
ScriptRuntime.MessageProvider
This is an interface defining a message provider.(package private) static class
ScriptRuntime.NoSuchMethodShim
static class
ScriptRuntime.StringIdOrIndex
Helper to return a string or an integer.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.Class<?>
BigIntegerClass
static java.lang.Class<?>
BooleanClass
static java.lang.Class<?>
ByteClass
static java.lang.Class<?>
CharacterClass
static java.lang.Class<?>
ClassClass
static java.lang.Class<?>
ContextClass
static java.lang.Class<?>
ContextFactoryClass
static java.lang.Class<?>
DateClass
private static java.lang.String
DEFAULT_NS_TAG
static java.lang.Class<?>
DoubleClass
static java.lang.Object[]
emptyArgs
static java.lang.String[]
emptyStrings
static int
ENUMERATE_ARRAY
static int
ENUMERATE_ARRAY_NO_ITERATOR
static int
ENUMERATE_KEYS
static int
ENUMERATE_KEYS_NO_ITERATOR
static int
ENUMERATE_VALUES
static int
ENUMERATE_VALUES_IN_ORDER
static int
ENUMERATE_VALUES_NO_ITERATOR
static java.lang.Class<?>
FloatClass
static java.lang.Class<?>
FunctionClass
static java.lang.Class<?>
IntegerClass
private static boolean
lastEvalTopCalled_
This indicates whether last call of "eval" was at the top scope (i.e.private static java.lang.Object
LIBRARY_SCOPE_KEY
static java.lang.Class<?>
LongClass
static ScriptRuntime.MessageProvider
messageProvider
static double
NaN
static java.lang.Double
NaNobj
static double
negativeZero
static java.lang.Double
negativeZeroObj
static java.lang.Class<?>
NumberClass
static java.lang.Class<?>
ObjectClass
static java.lang.Class<Scriptable>
ScriptableClass
static java.lang.Class<?>
ScriptableObjectClass
static java.lang.Class<?>
ShortClass
static java.lang.Class<?>
StringClass
static java.lang.Double
zeroObj
-
Constructor Summary
Constructors Modifier Constructor Description protected
ScriptRuntime()
No instances should be created.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static java.lang.CharSequence
add(java.lang.CharSequence val1, java.lang.Object val2)
Deprecated.Useadd(Object, Object, Context)
insteadstatic java.lang.CharSequence
add(java.lang.Object val1, java.lang.CharSequence val2)
Deprecated.Useadd(Object, Object, Context)
insteadstatic java.lang.Object
add(java.lang.Object val1, java.lang.Object val2, Context cx)
static void
addInstructionCount(Context cx, int instructionsToAdd)
static java.lang.Object
applyOrCall(boolean isApply, Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
Function.prototype.apply and Function.prototype.callstatic java.lang.String
bigIntToString(java.math.BigInteger n, int base)
static Scriptable
bind(Context cx, Scriptable scope, java.lang.String id)
Returns the object in the scope chain that has a given property.static java.lang.Number
bitwiseAND(java.lang.Number val1, java.lang.Number val2)
static java.lang.Number
bitwiseNOT(java.lang.Number val)
static java.lang.Number
bitwiseOR(java.lang.Number val1, java.lang.Number val2)
static java.lang.Number
bitwiseXOR(java.lang.Number val1, java.lang.Number val2)
static java.lang.Object
call(Context cx, java.lang.Object fun, java.lang.Object thisArg, java.lang.Object[] args, Scriptable scope)
Deprecated.The method is only present for compatibility.static java.lang.Object
callIterator(java.lang.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, java.lang.Object[] args, Context cx)
Perform function call in reference context.static java.lang.Object
callSpecial(Context cx, Callable fun, Scriptable thisObj, java.lang.Object[] args, Scriptable scope, Scriptable callerThis, int callType, java.lang.String filename, int lineNumber)
static java.util.Optional<java.lang.Double>
canonicalNumericIndexString(java.lang.String arg)
If "arg" is a "canonical numeric index," which means any number constructed from a string that doesn't have extra whitespace or non-standard formatting, return it -- otherwise return an empty option.(package private) static void
checkDeprecated(Context cx, java.lang.String name)
(package private) static Scriptable
checkDynamicScope(Scriptable possibleDynamicScope, Scriptable staticTopScope)
ReturnpossibleDynamicScope
ifstaticTopScope
is present on its prototype chain and returnstaticTopScope
otherwise.static RegExpProxy
checkRegExpProxy(Context cx)
static boolean
compare(java.lang.Number val1, java.lang.Number val2, int op)
static boolean
compare(java.lang.Object val1, java.lang.Object val2, int op)
private static <T> boolean
compareTo(double d1, double d2, int op)
private static <T> boolean
compareTo(java.lang.Comparable<T> val1, T val2, int op)
static EcmaError
constructError(java.lang.String error, java.lang.String message)
static EcmaError
constructError(java.lang.String error, java.lang.String message, int lineNumberDelta)
static EcmaError
constructError(java.lang.String error, java.lang.String message, java.lang.String sourceName, int lineNumber, java.lang.String lineSource, int columnNumber)
static Scriptable
createArrowFunctionActivation(NativeFunction funObj, Context cx, Scriptable scope, java.lang.Object[] args, boolean isStrict, boolean argsHasRest)
static Scriptable
createArrowFunctionActivation(NativeFunction funObj, Scriptable scope, java.lang.Object[] args, boolean isStrict)
Deprecated.static Scriptable
createFunctionActivation(NativeFunction funObj, Context cx, Scriptable scope, java.lang.Object[] args, boolean isStrict, boolean argsHasRest)
static Scriptable
createFunctionActivation(NativeFunction funObj, Scriptable scope, java.lang.Object[] args)
Deprecated.static Scriptable
createFunctionActivation(NativeFunction funObj, Scriptable scope, java.lang.Object[] args, boolean isStrict)
Deprecated.private static XMLLib
currentXMLLib(Context cx)
(package private) static java.lang.String
defaultObjectToSource(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
(package private) static java.lang.String
defaultObjectToString(Scriptable obj)
static java.lang.Object
delete(java.lang.Object obj, java.lang.Object id, Context cx)
Deprecated.static java.lang.Object
delete(java.lang.Object obj, java.lang.Object id, Context cx, boolean isName)
Deprecated.static java.lang.Object
delete(java.lang.Object obj, java.lang.Object id, Context cx, Scriptable scope, boolean isName)
The delete operatorstatic boolean
deleteObjectElem(Scriptable target, java.lang.Object elem, Context cx)
static java.lang.Number
divide(java.lang.Number val1, java.lang.Number val2)
private static java.lang.Object
doScriptableIncrDecr(Scriptable target, java.lang.String id, Scriptable protoChainStart, java.lang.Object value, int incrDecrMask)
static java.lang.Object
doTopCall(Callable callable, Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
Deprecated.static java.lang.Object
doTopCall(Callable callable, Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args, boolean isTopLevelStrict)
static java.lang.Object
elemIncrDecr(java.lang.Object obj, java.lang.Object index, Context cx, int incrDecrMask)
Deprecated.static java.lang.Object
elemIncrDecr(java.lang.Object obj, java.lang.Object index, Context cx, Scriptable scope, int incrDecrMask)
static void
enterActivationFunction(Context cx, Scriptable scope)
static Scriptable
enterDotQuery(java.lang.Object value, Scriptable scope)
static Scriptable
enterWith(java.lang.Object obj, Context cx, Scriptable scope)
private static void
enumChangeObject(ScriptRuntime.IdEnumeration x)
static java.lang.Object
enumId(java.lang.Object enumObj, Context cx)
static java.lang.Object
enumInit(java.lang.Object value, Context cx, boolean enumValues)
Deprecated.UseenumInit(Object, Context, Scriptable, int)
insteadstatic java.lang.Object
enumInit(java.lang.Object value, Context cx, int enumType)
Deprecated.UseenumInit(Object, Context, Scriptable, int)
insteadstatic java.lang.Object
enumInit(java.lang.Object value, Context cx, Scriptable scope, int enumType)
private static java.lang.Object
enumInitInOrder(Context cx, ScriptRuntime.IdEnumeration x)
static java.lang.Boolean
enumNext(java.lang.Object enumObj)
Deprecated.since 1.7.15.static java.lang.Boolean
enumNext(java.lang.Object enumObj, Context cx)
private static java.lang.Boolean
enumNextInOrder(ScriptRuntime.IdEnumeration enumObj, Context cx)
static java.lang.Object
enumValue(java.lang.Object enumObj, Context cx)
static boolean
eq(java.lang.Object x, java.lang.Object y)
Equalityprivate static boolean
eqBigInt(java.math.BigInteger x, double y)
(package private) static boolean
eqBigInt(java.math.BigInteger x, java.lang.Object y)
(package private) static boolean
eqNumber(double x, java.lang.Object y)
private static boolean
eqString(java.lang.CharSequence x, java.lang.Object y)
private static java.lang.RuntimeException
errorWithClassName(java.lang.String msg, java.lang.Object val)
static java.lang.String
escapeAttributeValue(java.lang.Object value, Context cx)
Escapes the reserved characters in a value of an attributestatic java.lang.String
escapeString(java.lang.String s)
static java.lang.String
escapeString(java.lang.String s, char escapeQuote)
For escaping strings printed by object and array literals; not quite the same as 'escape.'static java.lang.String
escapeTextValue(java.lang.Object value, Context cx)
Escapes the reserved characters in a value of a text nodestatic java.lang.Object
evalSpecial(Context cx, Scriptable scope, java.lang.Object thisArg, java.lang.Object[] args, java.lang.String filename, int lineNumber)
The eval function property of the global object.static void
exitActivationFunction(Context cx)
static java.lang.Number
exponentiate(java.lang.Number val1, java.lang.Number val2)
(package private) static NativeCall
findFunctionActivation(Context cx, Function f)
(package private) static java.lang.Object[]
getApplyArguments(Context cx, java.lang.Object arg1)
static java.lang.Object[]
getArrayElements(Scriptable object)
(package private) static Callable
getCallable(Scriptable thisObj)
static Callable
getElemFunctionAndThis(java.lang.Object obj, java.lang.Object elem, Context cx)
Deprecated.static Callable
getElemFunctionAndThis(java.lang.Object obj, java.lang.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, java.lang.String constructorName)
static ScriptableObject
getGlobal(Context cx)
(package private) static java.lang.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 java.lang.Object
getIndexObject(java.lang.String s)
If s represents index, then return index value wrapped as Integer and othewise return s.static ScriptableObject
getLibraryScopeOrNull(Scriptable scope)
static java.lang.String
getMessage(java.lang.String messageId, java.lang.Object[] arguments)
Deprecated.UsegetMessageById(String messageId, Object... args)
insteadstatic java.lang.String
getMessage0(java.lang.String messageId)
Deprecated.UsegetMessageById(String messageId, Object... args)
insteadstatic java.lang.String
getMessage1(java.lang.String messageId, java.lang.Object arg1)
Deprecated.UsegetMessageById(String messageId, Object... args)
insteadstatic java.lang.String
getMessage2(java.lang.String messageId, java.lang.Object arg1, java.lang.Object arg2)
Deprecated.UsegetMessageById(String messageId, Object... args)
insteadstatic java.lang.String
getMessage3(java.lang.String messageId, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
Deprecated.UsegetMessageById(String messageId, Object... args)
insteadstatic java.lang.String
getMessage4(java.lang.String messageId, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4)
Deprecated.UsegetMessageById(String messageId, Object... args)
insteadstatic java.lang.String
getMessageById(java.lang.String messageId, java.lang.Object... args)
static Callable
getNameFunctionAndThis(java.lang.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 java.lang.Object
getObjectElem(java.lang.Object obj, java.lang.Object elem, Context cx)
Deprecated.static java.lang.Object
getObjectElem(java.lang.Object obj, java.lang.Object elem, Context cx, Scriptable scope)
Call obj.[[Get]](id)static java.lang.Object
getObjectElem(Scriptable obj, java.lang.Object elem, Context cx)
static java.lang.Object
getObjectIndex(java.lang.Object obj, double dblIndex, Context cx)
Deprecated.static java.lang.Object
getObjectIndex(java.lang.Object obj, double dblIndex, Context cx, Scriptable scope)
A cheaper and less general version of the above for well-known argument types.static java.lang.Object
getObjectIndex(Scriptable obj, int index, Context cx)
static java.lang.Object
getObjectProp(java.lang.Object obj, java.lang.String property, Context cx)
Deprecated.static java.lang.Object
getObjectProp(java.lang.Object obj, java.lang.String property, Context cx, Scriptable scope)
Version of getObjectElem when elem is a valid JS identifier name.static java.lang.Object
getObjectProp(Scriptable obj, java.lang.String property, Context cx)
static java.lang.Object
getObjectPropNoWarn(java.lang.Object obj, java.lang.String property, Context cx)
Deprecated.static java.lang.Object
getObjectPropNoWarn(java.lang.Object obj, java.lang.String property, Context cx, Scriptable scope)
static Callable
getPropFunctionAndThis(java.lang.Object obj, java.lang.String property, Context cx)
Deprecated.static Callable
getPropFunctionAndThis(java.lang.Object obj, java.lang.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(java.lang.Object obj, java.lang.String property, Context cx, Scriptable thisObj)
static RegExpProxy
getRegExpProxy(Context cx)
static Scriptable
getTemplateLiteralCallSite(Context cx, Scriptable scope, java.lang.Object[] strings, int index)
static Scriptable
getTopCallScope(Context cx)
static java.lang.Object
getTopLevelProp(Scriptable scope, java.lang.String id)
(package private) static java.lang.String[]
getTopPackageNames()
static Callable
getValueFunctionAndThis(java.lang.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, java.lang.Object elem, Context cx)
static boolean
hasTopCall(Context cx)
static boolean
in(java.lang.Object a, java.lang.Object b, Context cx)
The in operator.static long
indexFromString(java.lang.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(java.lang.Object a, java.lang.Object b, Context cx)
The instanceof operator.static boolean
isArrayLike(Scriptable obj)
static boolean
isArrayObject(java.lang.Object obj)
(package private) static boolean
isGeneratedScript(java.lang.String sourceUrl)
static boolean
isIteratorDone(Context cx, java.lang.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
isJSWhitespaceOrLineTerminator(int c)
static boolean
isNaN(java.lang.Object n)
static boolean
isObject(java.lang.Object value)
static boolean
isPrimitive(java.lang.Object obj)
static boolean
isRhinoRuntimeType(java.lang.Class<?> cl)
(package private) static boolean
isSpecialProperty(java.lang.String s)
(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
isSymbol(java.lang.Object obj)
Not all "NativeSymbol" instances are actually symbols.(package private) static boolean
isValidIdentifierName(java.lang.String s, Context cx, boolean isStrict)
private static boolean
isVisible(Context cx, java.lang.Object obj)
static boolean
jsDelegatesTo(Scriptable lhs, Scriptable rhs)
Delegates tostatic Scriptable
lastStoredScriptable(Context cx)
static long
lastUint32Result(Context cx)
static Scriptable
leaveDotQuery(Scriptable scope)
static Scriptable
leaveWith(Scriptable scope)
static java.lang.Number
leftShift(java.lang.Number val1, java.lang.Number val2)
static boolean
loadFromIterable(Context cx, Scriptable scope, java.lang.Object arg1, java.util.function.BiConsumer<java.lang.Object,java.lang.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 java.lang.String
makeUrlForGeneratedScript(boolean isEval, java.lang.String masterScriptUrl, int masterScriptLine)
static Ref
memberRef(java.lang.Object obj, java.lang.Object namespace, java.lang.Object elem, Context cx, int memberTypeFlags)
static Ref
memberRef(java.lang.Object obj, java.lang.Object elem, Context cx, int memberTypeFlags)
static java.lang.Number
multiply(java.lang.Number val1, java.lang.Number val2)
static java.lang.Object
name(Context cx, Scriptable scope, java.lang.String name)
Looks up a name in the scope chain and returns its value.static java.lang.Object
nameIncrDecr(Scriptable scopeChain, java.lang.String id, int incrDecrMask)
Deprecated.UsenameIncrDecr(Scriptable, String, Context, int)
insteadstatic java.lang.Object
nameIncrDecr(Scriptable scopeChain, java.lang.String id, Context cx, int incrDecrMask)
private static java.lang.Object
nameOrFunction(Context cx, Scriptable scope, Scriptable parentScope, java.lang.String name, boolean asFunctionCall)
static Ref
nameRef(java.lang.Object namespace, java.lang.Object name, Context cx, Scriptable scope, int memberTypeFlags)
static Ref
nameRef(java.lang.Object name, Context cx, Scriptable scope, int memberTypeFlags)
static java.lang.Number
negate(java.lang.Number val)
static Scriptable
newArrayLiteral(java.lang.Object[] objects, int[] skipIndices, Context cx, Scriptable scope)
static Scriptable
newBuiltinObject(Context cx, Scriptable scope, TopLevel.Builtins type, java.lang.Object[] args)
static Scriptable
newCatchScope(java.lang.Throwable t, Scriptable lastCatchScope, java.lang.String exceptionName, Context cx, Scriptable scope)
(package private) static Scriptable
newNativeError(Context cx, Scriptable scope, TopLevel.NativeErrors type, java.lang.Object[] args)
static Scriptable
newObject(java.lang.Object fun, Context cx, Scriptable scope, java.lang.Object[] args)
Operator new.static Scriptable
newObject(Context cx, Scriptable scope, java.lang.String constructorName, java.lang.Object[] args)
static Scriptable
newObjectLiteral(java.lang.Object[] propertyIds, java.lang.Object[] propertyValues, int[] getterSetters, Context cx, Scriptable scope)
static Scriptable
newObjectLiteral(java.lang.Object[] propertyIds, java.lang.Object[] propertyValues, Context cx, Scriptable scope)
Deprecated.static java.lang.Object
newSpecial(Context cx, java.lang.Object fun, java.lang.Object[] args, Scriptable scope, int callType)
static java.lang.RuntimeException
notFoundError(Scriptable object, java.lang.String property)
static java.lang.RuntimeException
notFunctionError(java.lang.Object value)
static java.lang.RuntimeException
notFunctionError(java.lang.Object value, java.lang.Object messageHelper)
static java.lang.RuntimeException
notFunctionError(java.lang.Object obj, java.lang.Object value, java.lang.String propertyName)
private static java.lang.RuntimeException
notXmlError(java.lang.Object value)
static java.lang.String
numberToString(double d, int base)
static java.lang.Object[]
padAndRestArguments(Context cx, Scriptable scope, java.lang.Object[] args, int argCount)
Helper function for builtin objects that use the varargs form.static java.lang.Object[]
padArguments(java.lang.Object[] args, int count)
Helper function for builtin objects that use the varargs form.static java.lang.Object
propIncrDecr(java.lang.Object obj, java.lang.String id, Context cx, int incrDecrMask)
Deprecated.static java.lang.Object
propIncrDecr(java.lang.Object obj, java.lang.String id, Context cx, Scriptable scope, int incrDecrMask)
static EcmaError
rangeError(java.lang.String message)
static EcmaError
rangeErrorById(java.lang.String messageId, java.lang.Object... args)
static java.lang.Object
refDel(Ref ref, Context cx)
static java.lang.Object
refGet(Ref ref, Context cx)
static java.lang.Object
refIncrDecr(Ref ref, Context cx, int incrDecrMask)
Deprecated.UserefIncrDecr(Ref, Context, Scriptable, int)
insteadstatic java.lang.Object
refIncrDecr(Ref ref, Context cx, Scriptable scope, int incrDecrMask)
static java.lang.Object
refSet(Ref ref, java.lang.Object value, Context cx)
Deprecated.UserefSet(Ref, Object, Context, Scriptable)
insteadstatic java.lang.Object
refSet(Ref ref, java.lang.Object value, Context cx, Scriptable scope)
static java.lang.Number
remainder(java.lang.Number val1, java.lang.Number val2)
static boolean
same(java.lang.Object x, java.lang.Object y)
static boolean
sameZero(java.lang.Object x, java.lang.Object y)
Implement "SameValueZero" from ECMA 7.2.9static java.lang.Object
searchDefaultNamespace(Context cx)
static void
setBuiltinProtoAndParent(ScriptableObject object, Scriptable scope, TopLevel.Builtins type)
static java.lang.Object
setConst(Scriptable bound, java.lang.Object value, Context cx, java.lang.String id)
static java.lang.Object
setDefaultNamespace(java.lang.Object namespace, Context cx)
static void
setEnumNumbers(java.lang.Object enumObj, boolean enumNumbers)
static void
setFunctionProtoAndParent(BaseFunction fn, Context cx, Scriptable scope)
static void
setFunctionProtoAndParent(BaseFunction fn, Context cx, Scriptable scope, boolean es6GeneratorFunction)
static void
setFunctionProtoAndParent(BaseFunction fn, Scriptable scope)
Deprecated.static void
setFunctionProtoAndParent(BaseFunction fn, Scriptable scope, boolean es6GeneratorFunction)
Deprecated.static java.lang.Object
setName(Scriptable bound, java.lang.Object value, Context cx, Scriptable scope, java.lang.String id)
static java.lang.Object
setObjectElem(java.lang.Object obj, java.lang.Object elem, java.lang.Object value, Context cx)
Deprecated.static java.lang.Object
setObjectElem(java.lang.Object obj, java.lang.Object elem, java.lang.Object value, Context cx, Scriptable scope)
Call obj.[[Put]](id, value)static java.lang.Object
setObjectElem(Scriptable obj, java.lang.Object elem, java.lang.Object value, Context cx)
static java.lang.Object
setObjectIndex(java.lang.Object obj, double dblIndex, java.lang.Object value, Context cx)
Deprecated.static java.lang.Object
setObjectIndex(java.lang.Object obj, double dblIndex, java.lang.Object value, Context cx, Scriptable scope)
A cheaper and less general version of the above for well-known argument types.static java.lang.Object
setObjectIndex(Scriptable obj, int index, java.lang.Object value, Context cx)
static java.lang.Object
setObjectProp(java.lang.Object obj, java.lang.String property, java.lang.Object value, Context cx)
Deprecated.static java.lang.Object
setObjectProp(java.lang.Object obj, java.lang.String property, java.lang.Object value, Context cx, Scriptable scope)
Version of setObjectElem when elem is a valid JS identifier name.static java.lang.Object
setObjectProp(Scriptable obj, java.lang.String property, java.lang.Object value, Context cx)
static void
setObjectProtoAndParent(ScriptableObject object, Scriptable scope)
static void
setRegExpProxy(Context cx, RegExpProxy proxy)
static boolean
shallowEq(java.lang.Object x, java.lang.Object y)
static java.lang.Number
signedRightShift(java.lang.Number val1, java.lang.Number val2)
static Ref
specialRef(java.lang.Object obj, java.lang.String specialProperty, Context cx)
Deprecated.UsespecialRef(Object, String, Context, Scriptable)
insteadstatic Ref
specialRef(java.lang.Object obj, java.lang.String specialProperty, Context cx, Scriptable scope)
private static void
storeScriptable(Context cx, Scriptable value)
static void
storeUint32Result(Context cx, long value)
static java.lang.Object
strictSetName(Scriptable bound, java.lang.Object value, Context cx, Scriptable scope, java.lang.String id)
(package private) static double
stringPrefixToNumber(java.lang.String s, int start, int radix)
(package private) static double
stringToNumber(java.lang.String s, int start, int end, int radix)
private static double
stringToNumber(java.lang.String source, int sourceStart, int sourceEnd, int radix, boolean isPrefix)
static java.lang.Number
subtract(java.lang.Number val1, java.lang.Number val2)
static EcmaError
syntaxError(java.lang.String message)
static EcmaError
syntaxErrorById(java.lang.String messageId, java.lang.Object... args)
static long
testUint32String(java.lang.String str)
If str is a decimal presentation of Uint32 value, return it as long.static JavaScriptException
throwCustomError(Context cx, Scriptable scope, java.lang.String constructorName, java.lang.String message)
Equivalent to executing "new $constructorName(message, sourceFileName, sourceLineNo)" from JavaScript.static JavaScriptException
throwError(Context cx, Scriptable scope, java.lang.String message)
Equivalent to executing "new Error(message, sourceFileName, sourceLineNo)" from JavaScript.static java.math.BigInteger
toBigInt(java.lang.Object val)
Convert the value to a BigInt.static java.math.BigInteger
toBigInt(java.lang.String s)
ToBigInt applied to the String typestatic boolean
toBoolean(java.lang.Object val)
Convert the value to a boolean.static java.lang.CharSequence
toCharSequence(java.lang.Object val)
static int
toIndex(java.lang.Object val)
static int
toInt32(double d)
static int
toInt32(java.lang.Object val)
See ECMA 9.5.static int
toInt32(java.lang.Object[] args, int index)
static double
toInteger(double d)
static double
toInteger(java.lang.Object val)
See ECMA 9.4.static double
toInteger(java.lang.Object[] args, int index)
static Scriptable
toIterator(Context cx, Scriptable scope, Scriptable obj, boolean keyOnly)
static long
toLength(java.lang.Object[] args, int index)
static double
toNumber(java.lang.Object val)
Convert the value to a number.static double
toNumber(java.lang.Object[] args, int index)
static double
toNumber(java.lang.String s)
ToNumber applied to the String typestatic java.lang.Number
toNumeric(java.lang.Object val)
Convert the value to a Numeric (Number or BigInt).static Scriptable
toObject(Context cx, Scriptable scope, java.lang.Object val)
Convert the value to an object.static Scriptable
toObject(Context cx, Scriptable scope, java.lang.Object val, java.lang.Class<?> staticClass)
Deprecated.UsetoObject(Context, Scriptable, Object)
instead.static Scriptable
toObject(Scriptable scope, java.lang.Object val)
static Scriptable
toObject(Scriptable scope, java.lang.Object val, java.lang.Class<?> staticClass)
Deprecated.UsetoObject(Scriptable, Object)
instead.static Scriptable
toObjectOrNull(Context cx, java.lang.Object obj)
Deprecated.UsetoObjectOrNull(Context, Object, Scriptable)
insteadstatic Scriptable
toObjectOrNull(Context cx, java.lang.Object obj, Scriptable scope)
static java.lang.Object
toPrimitive(java.lang.Object val)
static java.lang.Object
toPrimitive(java.lang.Object val, java.lang.Class<?> typeHint)
private static java.lang.Object
topScopeName(Context cx, Scriptable scope, java.lang.String name)
static java.lang.String
toString(double val)
Optimized version of toString(Object) for numbers.static java.lang.String
toString(java.lang.Object val)
Convert the value to a string.static java.lang.String
toString(java.lang.Object[] args, int index)
static ScriptRuntime.StringIdOrIndex
toStringIdOrIndex(java.lang.Object id)
If id is a number or a string presentation of an int32 value, then id the returning StringIdOrIndex has the index set, otherwise the stringId is set.static char
toUint16(java.lang.Object val)
See ECMA 9.7.static long
toUint32(double d)
See ECMA 9.6.static long
toUint32(java.lang.Object val)
static EcmaError
typeError(java.lang.String message)
static EcmaError
typeError0(java.lang.String messageId)
Deprecated.UsetypeErrorById(String messageId, Object... args)
insteadstatic EcmaError
typeError1(java.lang.String messageId, java.lang.Object arg1)
Deprecated.UsetypeErrorById(String messageId, Object... args)
insteadstatic EcmaError
typeError2(java.lang.String messageId, java.lang.Object arg1, java.lang.Object arg2)
Deprecated.UsetypeErrorById(String messageId, Object... args)
insteadstatic EcmaError
typeError3(java.lang.String messageId, java.lang.String arg1, java.lang.String arg2, java.lang.String arg3)
Deprecated.UsetypeErrorById(String messageId, Object... args)
insteadstatic EcmaError
typeErrorById(java.lang.String messageId, java.lang.Object... args)
static BaseFunction
typeErrorThrower()
Deprecated.static BaseFunction
typeErrorThrower(Context cx)
Returns representation of the [[ThrowTypeError]] object.static java.lang.String
typeof(java.lang.Object value)
The typeof operatorstatic java.lang.String
typeofName(Scriptable scope, java.lang.String id)
The typeof operator that correctly handles the undefined casestatic java.lang.RuntimeException
undefCallError(java.lang.Object object, java.lang.Object id)
private static java.lang.RuntimeException
undefDeleteError(java.lang.Object object, java.lang.Object id)
static java.lang.RuntimeException
undefReadError(java.lang.Object object, java.lang.Object id)
static java.lang.RuntimeException
undefWriteError(java.lang.Object object, java.lang.Object id, java.lang.Object value)
(package private) static java.lang.String
uneval(Context cx, Scriptable scope, java.lang.Object value)
static java.lang.Object
updateDotQuery(boolean value, Scriptable scope)
private static void
warnAboutNonJSObject(java.lang.Object nonJSObject)
static java.lang.Boolean
wrapBoolean(boolean b)
static Scriptable
wrapException(java.lang.Throwable t, Scriptable scope, Context cx)
static java.lang.Integer
wrapInt(int i)
static java.lang.Number
wrapNumber(double x)
static Scriptable
wrapRegExp(Context cx, Scriptable scope, java.lang.Object compiled)
-
-
-
Field Detail
-
BooleanClass
public static final java.lang.Class<?> BooleanClass
-
ByteClass
public static final java.lang.Class<?> ByteClass
-
CharacterClass
public static final java.lang.Class<?> CharacterClass
-
ClassClass
public static final java.lang.Class<?> ClassClass
-
DoubleClass
public static final java.lang.Class<?> DoubleClass
-
FloatClass
public static final java.lang.Class<?> FloatClass
-
IntegerClass
public static final java.lang.Class<?> IntegerClass
-
LongClass
public static final java.lang.Class<?> LongClass
-
NumberClass
public static final java.lang.Class<?> NumberClass
-
ObjectClass
public static final java.lang.Class<?> ObjectClass
-
ShortClass
public static final java.lang.Class<?> ShortClass
-
StringClass
public static final java.lang.Class<?> StringClass
-
DateClass
public static final java.lang.Class<?> DateClass
-
BigIntegerClass
public static final java.lang.Class<?> BigIntegerClass
-
ContextClass
public static final java.lang.Class<?> ContextClass
-
ContextFactoryClass
public static final java.lang.Class<?> ContextFactoryClass
-
FunctionClass
public static final java.lang.Class<?> FunctionClass
-
ScriptableObjectClass
public static final java.lang.Class<?> ScriptableObjectClass
-
ScriptableClass
public static final java.lang.Class<Scriptable> ScriptableClass
-
LIBRARY_SCOPE_KEY
private static final java.lang.Object LIBRARY_SCOPE_KEY
-
NaN
public static final double NaN
- See Also:
- Constant Field Values
-
NaNobj
public static final java.lang.Double NaNobj
-
negativeZero
public static final double negativeZero
-
zeroObj
public static final java.lang.Double zeroObj
-
negativeZeroObj
public static final java.lang.Double negativeZeroObj
-
DEFAULT_NS_TAG
private static final java.lang.String DEFAULT_NS_TAG
- See Also:
- Constant Field Values
-
ENUMERATE_KEYS
public static final int ENUMERATE_KEYS
- See Also:
- Constant Field Values
-
ENUMERATE_VALUES
public static final int ENUMERATE_VALUES
- See Also:
- Constant Field Values
-
ENUMERATE_ARRAY
public static final int ENUMERATE_ARRAY
- See Also:
- Constant Field Values
-
ENUMERATE_KEYS_NO_ITERATOR
public static final int ENUMERATE_KEYS_NO_ITERATOR
- See Also:
- Constant Field Values
-
ENUMERATE_VALUES_NO_ITERATOR
public static final int ENUMERATE_VALUES_NO_ITERATOR
- See Also:
- Constant Field Values
-
ENUMERATE_ARRAY_NO_ITERATOR
public static final int ENUMERATE_ARRAY_NO_ITERATOR
- See Also:
- Constant Field Values
-
ENUMERATE_VALUES_IN_ORDER
public static final int ENUMERATE_VALUES_IN_ORDER
- See Also:
- Constant Field Values
-
lastEvalTopCalled_
private static boolean lastEvalTopCalled_
This indicates whether last call of "eval" was at the top scope (i.e. "eval()") or not (i.e. "scope.eval()"), as each one has different behavior.Ideally, we should have "eval" at top scope and we use Context.FEATURE_DYNAMIC_SCOPE, but it will complex the code.
The current implementation sets this value to true when "eval" is called, and false on "something.eval()"
-
messageProvider
public static final ScriptRuntime.MessageProvider messageProvider
-
emptyArgs
public static final java.lang.Object[] emptyArgs
-
emptyStrings
public static final java.lang.String[] emptyStrings
-
-
Method Detail
-
typeErrorThrower
@Deprecated public static BaseFunction typeErrorThrower()
Deprecated.Returns representation of the [[ThrowTypeError]] object. See ECMA 5 spec, 13.2.3
-
typeErrorThrower
public static BaseFunction typeErrorThrower(Context cx)
Returns representation of the [[ThrowTypeError]] object. See ECMA 5 spec, 13.2.3
-
isRhinoRuntimeType
public static boolean isRhinoRuntimeType(java.lang.Class<?> cl)
-
initSafeStandardObjects
public static ScriptableObject initSafeStandardObjects(Context cx, ScriptableObject scope, boolean sealed)
-
initStandardObjects
public static ScriptableObject initStandardObjects(Context cx, ScriptableObject scope, boolean sealed)
-
getTopPackageNames
static java.lang.String[] getTopPackageNames()
-
getLibraryScopeOrNull
public static ScriptableObject getLibraryScopeOrNull(Scriptable scope)
-
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
public static java.lang.Boolean wrapBoolean(boolean b)
-
wrapInt
public static java.lang.Integer wrapInt(int i)
-
wrapNumber
public static java.lang.Number wrapNumber(double x)
-
toBoolean
public static boolean toBoolean(java.lang.Object val)
Convert the value to a boolean.See ECMA 9.2.
-
toNumber
public static double toNumber(java.lang.Object val)
Convert the value to a number.See ECMA 9.3.
-
toNumber
public static double toNumber(java.lang.Object[] args, int index)
-
stringPrefixToNumber
static double stringPrefixToNumber(java.lang.String s, int start, int radix)
-
stringToNumber
static double stringToNumber(java.lang.String s, int start, int end, int radix)
-
stringToNumber
private static double stringToNumber(java.lang.String source, int sourceStart, int sourceEnd, int radix, boolean isPrefix)
-
toNumber
public static double toNumber(java.lang.String s)
ToNumber applied to the String typeSee the #sec-tonumber-applied-to-the-string-type section of ECMA
-
toBigInt
public static java.math.BigInteger toBigInt(java.lang.Object val)
Convert the value to a BigInt.
-
toBigInt
public static java.math.BigInteger toBigInt(java.lang.String s)
ToBigInt applied to the String type
-
toNumeric
public static java.lang.Number toNumeric(java.lang.Object val)
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
public static int toIndex(java.lang.Object val)
-
padArguments
public static java.lang.Object[] padArguments(java.lang.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.
-
padAndRestArguments
public static java.lang.Object[] padAndRestArguments(Context cx, Scriptable scope, java.lang.Object[] args, int argCount)
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. Also the rest parameter array construction is done here.
-
escapeString
public static java.lang.String escapeString(java.lang.String s)
-
escapeString
public static java.lang.String escapeString(java.lang.String s, char escapeQuote)
For escaping strings printed by object and array literals; not quite the same as 'escape.'
-
isValidIdentifierName
static boolean isValidIdentifierName(java.lang.String s, Context cx, boolean isStrict)
-
toCharSequence
public static java.lang.CharSequence toCharSequence(java.lang.Object val)
-
toString
public static java.lang.String toString(java.lang.Object val)
Convert the value to a string.See ECMA 9.8.
-
defaultObjectToString
static java.lang.String defaultObjectToString(Scriptable obj)
-
toString
public static java.lang.String toString(java.lang.Object[] args, int index)
-
toString
public static java.lang.String toString(double val)
Optimized version of toString(Object) for numbers.
-
numberToString
public static java.lang.String numberToString(double d, int base)
-
bigIntToString
public static java.lang.String bigIntToString(java.math.BigInteger n, int base)
-
uneval
static java.lang.String uneval(Context cx, Scriptable scope, java.lang.Object value)
-
defaultObjectToSource
static java.lang.String defaultObjectToSource(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
-
toObject
public static Scriptable toObject(Scriptable scope, java.lang.Object val)
-
toObjectOrNull
@Deprecated public static Scriptable toObjectOrNull(Context cx, java.lang.Object obj)
Deprecated.UsetoObjectOrNull(Context, Object, Scriptable)
insteadWarning: This doesn't allow to resolve primitive prototype properly when many top scopes are involved
-
toObjectOrNull
public static Scriptable toObjectOrNull(Context cx, java.lang.Object obj, Scriptable scope)
- Parameters:
scope
- the scope that should be used to resolve primitive prototype
-
toObject
@Deprecated public static Scriptable toObject(Scriptable scope, java.lang.Object val, java.lang.Class<?> staticClass)
Deprecated.UsetoObject(Scriptable, Object)
instead.
-
toObject
public static Scriptable toObject(Context cx, Scriptable scope, java.lang.Object val)
Convert the value to an object.See ECMA 9.9.
-
toObject
@Deprecated public static Scriptable toObject(Context cx, Scriptable scope, java.lang.Object val, java.lang.Class<?> staticClass)
Deprecated.UsetoObject(Context, Scriptable, Object)
instead.
-
call
@Deprecated public static java.lang.Object call(Context cx, java.lang.Object fun, java.lang.Object thisArg, java.lang.Object[] args, Scriptable scope)
Deprecated.The method is only present for compatibility.
-
newObject
public static Scriptable newObject(Context cx, Scriptable scope, java.lang.String constructorName, java.lang.Object[] args)
-
newBuiltinObject
public static Scriptable newBuiltinObject(Context cx, Scriptable scope, TopLevel.Builtins type, java.lang.Object[] args)
-
newNativeError
static Scriptable newNativeError(Context cx, Scriptable scope, TopLevel.NativeErrors type, java.lang.Object[] args)
-
toInteger
public static double toInteger(java.lang.Object val)
See ECMA 9.4.
-
toInteger
public static double toInteger(double d)
-
toInteger
public static double toInteger(java.lang.Object[] args, int index)
-
toLength
public static long toLength(java.lang.Object[] args, int index)
-
toInt32
public static int toInt32(java.lang.Object val)
See ECMA 9.5.
-
toInt32
public static int toInt32(java.lang.Object[] args, int index)
-
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
public static long toUint32(java.lang.Object val)
-
toUint16
public static char toUint16(java.lang.Object val)
See ECMA 9.7.
-
canonicalNumericIndexString
public static java.util.Optional<java.lang.Double> canonicalNumericIndexString(java.lang.String arg)
If "arg" is a "canonical numeric index," which means any number constructed from a string that doesn't have extra whitespace or non-standard formatting, return it -- otherwise return an empty option. Defined in ECMA 7.1.21.
-
setDefaultNamespace
public static java.lang.Object setDefaultNamespace(java.lang.Object namespace, Context cx)
-
searchDefaultNamespace
public static java.lang.Object searchDefaultNamespace(Context cx)
-
getTopLevelProp
public static java.lang.Object getTopLevelProp(Scriptable scope, java.lang.String id)
-
getExistingCtor
static Function getExistingCtor(Context cx, Scriptable scope, java.lang.String constructorName)
-
indexFromString
public static long indexFromString(java.lang.String str)
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.Note that this method on its own does not actually produce an index that is useful for an actual Object or Array, because it may be larger than Integer.MAX_VALUE. Most callers should instead call toStringOrIndex, which calls this under the covers.
-
testUint32String
public static long testUint32String(java.lang.String str)
If str is a decimal presentation of Uint32 value, return it as long. Othewise return -1L;
-
getIndexObject
static java.lang.Object getIndexObject(java.lang.String s)
If s represents index, then return index value wrapped as Integer and othewise return s.
-
getIndexObject
static java.lang.Object getIndexObject(double d)
If d is exact int value, return its value wrapped as Integer and othewise return d converted to String.
-
toStringIdOrIndex
public static ScriptRuntime.StringIdOrIndex toStringIdOrIndex(java.lang.Object id)
If id is a number or a string presentation of an int32 value, then id the returning StringIdOrIndex has the index set, otherwise the stringId is set.
-
getObjectElem
@Deprecated public static java.lang.Object getObjectElem(java.lang.Object obj, java.lang.Object elem, Context cx)
Deprecated.Call obj.[[Get]](id)
-
getObjectElem
public static java.lang.Object getObjectElem(java.lang.Object obj, java.lang.Object elem, Context cx, Scriptable scope)
Call obj.[[Get]](id)
-
getObjectElem
public static java.lang.Object getObjectElem(Scriptable obj, java.lang.Object elem, Context cx)
-
getObjectProp
@Deprecated public static java.lang.Object getObjectProp(java.lang.Object obj, java.lang.String property, Context cx)
Deprecated.Version of getObjectElem when elem is a valid JS identifier name.
-
getObjectProp
public static java.lang.Object getObjectProp(java.lang.Object obj, java.lang.String property, Context cx, Scriptable scope)
Version of getObjectElem when elem is a valid JS identifier name.- Parameters:
scope
- the scope that should be used to resolve primitive prototype
-
getObjectProp
public static java.lang.Object getObjectProp(Scriptable obj, java.lang.String property, Context cx)
-
getObjectPropNoWarn
@Deprecated public static java.lang.Object getObjectPropNoWarn(java.lang.Object obj, java.lang.String property, Context cx)
Deprecated.
-
getObjectPropNoWarn
public static java.lang.Object getObjectPropNoWarn(java.lang.Object obj, java.lang.String property, Context cx, Scriptable scope)
-
getObjectIndex
@Deprecated public static java.lang.Object getObjectIndex(java.lang.Object obj, double dblIndex, Context cx)
Deprecated.A cheaper and less general version of the above for well-known argument types.
-
getObjectIndex
public static java.lang.Object getObjectIndex(java.lang.Object obj, double dblIndex, Context cx, Scriptable scope)
A cheaper and less general version of the above for well-known argument types.
-
getObjectIndex
public static java.lang.Object getObjectIndex(Scriptable obj, int index, Context cx)
-
setObjectElem
@Deprecated public static java.lang.Object setObjectElem(java.lang.Object obj, java.lang.Object elem, java.lang.Object value, Context cx)
Deprecated.Call obj.[[Put]](id, value)
-
setObjectElem
public static java.lang.Object setObjectElem(java.lang.Object obj, java.lang.Object elem, java.lang.Object value, Context cx, Scriptable scope)
Call obj.[[Put]](id, value)
-
setObjectElem
public static java.lang.Object setObjectElem(Scriptable obj, java.lang.Object elem, java.lang.Object value, Context cx)
-
setObjectProp
@Deprecated public static java.lang.Object setObjectProp(java.lang.Object obj, java.lang.String property, java.lang.Object value, Context cx)
Deprecated.Version of setObjectElem when elem is a valid JS identifier name.
-
setObjectProp
public static java.lang.Object setObjectProp(java.lang.Object obj, java.lang.String property, java.lang.Object value, Context cx, Scriptable scope)
Version of setObjectElem when elem is a valid JS identifier name.
-
setObjectProp
public static java.lang.Object setObjectProp(Scriptable obj, java.lang.String property, java.lang.Object value, Context cx)
-
setObjectIndex
@Deprecated public static java.lang.Object setObjectIndex(java.lang.Object obj, double dblIndex, java.lang.Object value, Context cx)
Deprecated.A cheaper and less general version of the above for well-known argument types.
-
setObjectIndex
public static java.lang.Object setObjectIndex(java.lang.Object obj, double dblIndex, java.lang.Object value, Context cx, Scriptable scope)
A cheaper and less general version of the above for well-known argument types.
-
setObjectIndex
public static java.lang.Object setObjectIndex(Scriptable obj, int index, java.lang.Object value, Context cx)
-
deleteObjectElem
public static boolean deleteObjectElem(Scriptable target, java.lang.Object elem, Context cx)
-
hasObjectElem
public static boolean hasObjectElem(Scriptable target, java.lang.Object elem, Context cx)
-
refSet
@Deprecated public static java.lang.Object refSet(Ref ref, java.lang.Object value, Context cx)
Deprecated.UserefSet(Ref, Object, Context, Scriptable)
instead
-
refSet
public static java.lang.Object refSet(Ref ref, java.lang.Object value, Context cx, Scriptable scope)
-
isSpecialProperty
static boolean isSpecialProperty(java.lang.String s)
-
specialRef
@Deprecated public static Ref specialRef(java.lang.Object obj, java.lang.String specialProperty, Context cx)
Deprecated.UsespecialRef(Object, String, Context, Scriptable)
instead
-
specialRef
public static Ref specialRef(java.lang.Object obj, java.lang.String specialProperty, Context cx, Scriptable scope)
-
delete
@Deprecated public static java.lang.Object delete(java.lang.Object obj, java.lang.Object id, Context cx)
Deprecated.
-
delete
@Deprecated public static java.lang.Object delete(java.lang.Object obj, java.lang.Object id, Context cx, boolean isName)
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
public static java.lang.Object delete(java.lang.Object obj, java.lang.Object id, Context cx, Scriptable scope, boolean isName)
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
public static java.lang.Object name(Context cx, Scriptable scope, java.lang.String name)
Looks up a name in the scope chain and returns its value.
-
nameOrFunction
private static java.lang.Object nameOrFunction(Context cx, Scriptable scope, Scriptable parentScope, java.lang.String name, boolean asFunctionCall)
-
topScopeName
private static java.lang.Object topScopeName(Context cx, Scriptable scope, java.lang.String name)
-
bind
public static Scriptable bind(Context cx, Scriptable scope, java.lang.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
-
setName
public static java.lang.Object setName(Scriptable bound, java.lang.Object value, Context cx, Scriptable scope, java.lang.String id)
-
strictSetName
public static java.lang.Object strictSetName(Scriptable bound, java.lang.Object value, Context cx, Scriptable scope, java.lang.String id)
-
setConst
public static java.lang.Object setConst(Scriptable bound, java.lang.Object value, Context cx, java.lang.String id)
-
toIterator
public static Scriptable toIterator(Context cx, Scriptable scope, Scriptable obj, boolean keyOnly)
-
enumInit
@Deprecated public static java.lang.Object enumInit(java.lang.Object value, Context cx, boolean enumValues)
Deprecated.UseenumInit(Object, Context, Scriptable, int)
insteadFor backwards compatibility with generated class files
-
enumInit
@Deprecated public static java.lang.Object enumInit(java.lang.Object value, Context cx, int enumType)
Deprecated.UseenumInit(Object, Context, Scriptable, int)
instead
-
enumInit
public static java.lang.Object enumInit(java.lang.Object value, Context cx, Scriptable scope, int enumType)
-
enumInitInOrder
private static java.lang.Object enumInitInOrder(Context cx, ScriptRuntime.IdEnumeration x)
-
setEnumNumbers
public static void setEnumNumbers(java.lang.Object enumObj, boolean enumNumbers)
-
enumNext
@Deprecated public static java.lang.Boolean enumNext(java.lang.Object enumObj)
Deprecated.since 1.7.15. Use#enumNext(Context, Object)
instead
-
enumNext
public static java.lang.Boolean enumNext(java.lang.Object enumObj, Context cx)
-
enumNextInOrder
private static java.lang.Boolean enumNextInOrder(ScriptRuntime.IdEnumeration enumObj, Context cx)
-
enumId
public static java.lang.Object enumId(java.lang.Object enumObj, Context cx)
-
enumValue
public static java.lang.Object enumValue(java.lang.Object enumObj, Context cx)
-
enumChangeObject
private static void enumChangeObject(ScriptRuntime.IdEnumeration x)
-
loadFromIterable
public static boolean loadFromIterable(Context cx, Scriptable scope, java.lang.Object arg1, java.util.function.BiConsumer<java.lang.Object,java.lang.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
public static Callable getNameFunctionAndThis(java.lang.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.
-
getElemFunctionAndThis
@Deprecated public static Callable getElemFunctionAndThis(java.lang.Object obj, java.lang.Object elem, Context cx)
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(java.lang.Object obj, java.lang.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 public static Callable getPropFunctionAndThis(java.lang.Object obj, java.lang.String property, Context cx)
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(java.lang.Object obj, java.lang.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(java.lang.Object obj, java.lang.String property, Context cx, Scriptable thisObj)
-
getValueFunctionAndThis
public static Callable getValueFunctionAndThis(java.lang.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. The caller must call ScriptRuntime.lastStoredScriptable() immediately after calling this method.
-
callIterator
public static java.lang.Object callIterator(java.lang.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.
-
isIteratorDone
public static boolean isIteratorDone(Context cx, java.lang.Object result)
Given an iterator result, return true if and only if there is a "done" property that's true.
-
callRef
public static Ref callRef(Callable function, Scriptable thisObj, java.lang.Object[] args, Context cx)
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
public static Scriptable newObject(java.lang.Object fun, Context cx, Scriptable scope, java.lang.Object[] args)
Operator new.See ECMA 11.2.2
-
callSpecial
public static java.lang.Object callSpecial(Context cx, Callable fun, Scriptable thisObj, java.lang.Object[] args, Scriptable scope, Scriptable callerThis, int callType, java.lang.String filename, int lineNumber)
-
newSpecial
public static java.lang.Object newSpecial(Context cx, java.lang.Object fun, java.lang.Object[] args, Scriptable scope, int callType)
-
applyOrCall
public static java.lang.Object applyOrCall(boolean isApply, Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
Function.prototype.apply and Function.prototype.callSee Ecma 15.3.4.[34]
-
isArrayLike
public static boolean isArrayLike(Scriptable obj)
- Returns:
- true if the passed in Scriptable looks like an array
-
getApplyArguments
static java.lang.Object[] getApplyArguments(Context cx, java.lang.Object arg1)
-
getCallable
static Callable getCallable(Scriptable thisObj)
-
evalSpecial
public static java.lang.Object evalSpecial(Context cx, Scriptable scope, java.lang.Object thisArg, java.lang.Object[] args, java.lang.String filename, int lineNumber)
The eval function property of the global object.See ECMA 15.1.2.1
-
typeof
public static java.lang.String typeof(java.lang.Object value)
The typeof operator
-
typeofName
public static java.lang.String typeofName(Scriptable scope, java.lang.String id)
The typeof operator that correctly handles the undefined case
-
isObject
public static boolean isObject(java.lang.Object value)
-
add
public static java.lang.Object add(java.lang.Object val1, java.lang.Object val2, Context cx)
-
add
@Deprecated public static java.lang.CharSequence add(java.lang.CharSequence val1, java.lang.Object val2)
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 public static java.lang.CharSequence add(java.lang.Object val1, java.lang.CharSequence val2)
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
public static java.lang.Number subtract(java.lang.Number val1, java.lang.Number val2)
-
multiply
public static java.lang.Number multiply(java.lang.Number val1, java.lang.Number val2)
-
divide
public static java.lang.Number divide(java.lang.Number val1, java.lang.Number val2)
-
remainder
public static java.lang.Number remainder(java.lang.Number val1, java.lang.Number val2)
-
exponentiate
public static java.lang.Number exponentiate(java.lang.Number val1, java.lang.Number val2)
-
bitwiseAND
public static java.lang.Number bitwiseAND(java.lang.Number val1, java.lang.Number val2)
-
bitwiseOR
public static java.lang.Number bitwiseOR(java.lang.Number val1, java.lang.Number val2)
-
bitwiseXOR
public static java.lang.Number bitwiseXOR(java.lang.Number val1, java.lang.Number val2)
-
leftShift
public static java.lang.Number leftShift(java.lang.Number val1, java.lang.Number val2)
-
signedRightShift
public static java.lang.Number signedRightShift(java.lang.Number val1, java.lang.Number val2)
-
bitwiseNOT
public static java.lang.Number bitwiseNOT(java.lang.Number val)
-
nameIncrDecr
@Deprecated public static java.lang.Object nameIncrDecr(Scriptable scopeChain, java.lang.String id, int incrDecrMask)
Deprecated.UsenameIncrDecr(Scriptable, String, Context, int)
insteadThe method is only present for compatibility.
-
nameIncrDecr
public static java.lang.Object nameIncrDecr(Scriptable scopeChain, java.lang.String id, Context cx, int incrDecrMask)
-
propIncrDecr
@Deprecated public static java.lang.Object propIncrDecr(java.lang.Object obj, java.lang.String id, Context cx, int incrDecrMask)
Deprecated.
-
propIncrDecr
public static java.lang.Object propIncrDecr(java.lang.Object obj, java.lang.String id, Context cx, Scriptable scope, int incrDecrMask)
-
doScriptableIncrDecr
private static java.lang.Object doScriptableIncrDecr(Scriptable target, java.lang.String id, Scriptable protoChainStart, java.lang.Object value, int incrDecrMask)
-
elemIncrDecr
@Deprecated public static java.lang.Object elemIncrDecr(java.lang.Object obj, java.lang.Object index, Context cx, int incrDecrMask)
Deprecated.
-
elemIncrDecr
public static java.lang.Object elemIncrDecr(java.lang.Object obj, java.lang.Object index, Context cx, Scriptable scope, int incrDecrMask)
-
refIncrDecr
@Deprecated public static java.lang.Object refIncrDecr(Ref ref, Context cx, int incrDecrMask)
Deprecated.UserefIncrDecr(Ref, Context, Scriptable, int)
instead
-
refIncrDecr
public static java.lang.Object refIncrDecr(Ref ref, Context cx, Scriptable scope, int incrDecrMask)
-
negate
public static java.lang.Number negate(java.lang.Number val)
-
toPrimitive
public static java.lang.Object toPrimitive(java.lang.Object val)
-
toPrimitive
public static java.lang.Object toPrimitive(java.lang.Object val, java.lang.Class<?> typeHint)
-
eq
public static boolean eq(java.lang.Object x, java.lang.Object y)
EqualitySee ECMA 11.9
-
same
public static boolean same(java.lang.Object x, java.lang.Object y)
-
sameZero
public static boolean sameZero(java.lang.Object x, java.lang.Object y)
Implement "SameValueZero" from ECMA 7.2.9
-
isNaN
public static boolean isNaN(java.lang.Object n)
-
isPrimitive
public static boolean isPrimitive(java.lang.Object obj)
-
eqNumber
static boolean eqNumber(double x, java.lang.Object y)
-
eqBigInt
static boolean eqBigInt(java.math.BigInteger x, java.lang.Object y)
-
eqBigInt
private static boolean eqBigInt(java.math.BigInteger x, double y)
-
eqString
private static boolean eqString(java.lang.CharSequence x, java.lang.Object y)
-
shallowEq
public static boolean shallowEq(java.lang.Object x, java.lang.Object y)
-
instanceOf
public static boolean instanceOf(java.lang.Object a, java.lang.Object b, Context cx)
The instanceof operator.- Returns:
- a instanceof b
-
jsDelegatesTo
public static boolean jsDelegatesTo(Scriptable lhs, Scriptable rhs)
Delegates to- Returns:
- true iff rhs appears in lhs' proto chain
-
in
public static boolean in(java.lang.Object a, java.lang.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 operandb
- the right hand operand- Returns:
- true if property name or element number a is a property of b
-
compare
public static boolean compare(java.lang.Object val1, java.lang.Object val2, int op)
-
compare
public static boolean compare(java.lang.Number val1, java.lang.Number val2, int op)
-
compareTo
private static <T> boolean compareTo(java.lang.Comparable<T> val1, T val2, int op)
-
compareTo
private static <T> boolean compareTo(double d1, double d2, int op)
-
getGlobal
public static ScriptableObject getGlobal(Context cx)
-
hasTopCall
public static boolean hasTopCall(Context cx)
-
getTopCallScope
public static Scriptable getTopCallScope(Context cx)
-
doTopCall
@Deprecated public static java.lang.Object doTopCall(Callable callable, Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
Deprecated.
-
doTopCall
public static java.lang.Object doTopCall(Callable callable, Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args, boolean isTopLevelStrict)
-
checkDynamicScope
static Scriptable checkDynamicScope(Scriptable possibleDynamicScope, Scriptable staticTopScope)
ReturnpossibleDynamicScope
ifstaticTopScope
is present on its prototype chain and returnstaticTopScope
otherwise. Should only be called whenstaticTopScope
is top scope.
-
addInstructionCount
public static void addInstructionCount(Context cx, int instructionsToAdd)
-
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, java.lang.Object[] args)
Deprecated.
-
createFunctionActivation
@Deprecated public static Scriptable createFunctionActivation(NativeFunction funObj, Scriptable scope, java.lang.Object[] args, boolean isStrict)
Deprecated.
-
createFunctionActivation
public static Scriptable createFunctionActivation(NativeFunction funObj, Context cx, Scriptable scope, java.lang.Object[] args, boolean isStrict, boolean argsHasRest)
-
createArrowFunctionActivation
@Deprecated public static Scriptable createArrowFunctionActivation(NativeFunction funObj, Scriptable scope, java.lang.Object[] args, boolean isStrict)
Deprecated.
-
createArrowFunctionActivation
public static Scriptable createArrowFunctionActivation(NativeFunction funObj, Context cx, Scriptable scope, java.lang.Object[] args, boolean isStrict, boolean argsHasRest)
-
enterActivationFunction
public static void enterActivationFunction(Context cx, Scriptable scope)
-
exitActivationFunction
public static void exitActivationFunction(Context cx)
-
findFunctionActivation
static NativeCall findFunctionActivation(Context cx, Function f)
-
newCatchScope
public static Scriptable newCatchScope(java.lang.Throwable t, Scriptable lastCatchScope, java.lang.String exceptionName, Context cx, Scriptable scope)
-
wrapException
public static Scriptable wrapException(java.lang.Throwable t, Scriptable scope, Context cx)
-
isVisible
private static boolean isVisible(Context cx, java.lang.Object obj)
-
enterWith
public static Scriptable enterWith(java.lang.Object obj, Context cx, Scriptable scope)
-
leaveWith
public static Scriptable leaveWith(Scriptable scope)
-
enterDotQuery
public static Scriptable enterDotQuery(java.lang.Object value, Scriptable scope)
-
updateDotQuery
public static java.lang.Object updateDotQuery(boolean value, Scriptable scope)
-
leaveDotQuery
public static Scriptable leaveDotQuery(Scriptable scope)
-
setFunctionProtoAndParent
@Deprecated public static void setFunctionProtoAndParent(BaseFunction fn, Scriptable scope)
Deprecated.
-
setFunctionProtoAndParent
public static void setFunctionProtoAndParent(BaseFunction fn, Context cx, Scriptable scope)
-
setFunctionProtoAndParent
@Deprecated public static void setFunctionProtoAndParent(BaseFunction fn, Scriptable scope, boolean es6GeneratorFunction)
Deprecated.
-
setFunctionProtoAndParent
public static void setFunctionProtoAndParent(BaseFunction fn, Context cx, Scriptable scope, boolean es6GeneratorFunction)
-
setObjectProtoAndParent
public static void setObjectProtoAndParent(ScriptableObject object, Scriptable scope)
-
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(java.lang.Object[] objects, int[] skipIndices, Context cx, Scriptable scope)
-
newObjectLiteral
@Deprecated public static Scriptable newObjectLiteral(java.lang.Object[] propertyIds, java.lang.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(java.lang.Object[] propertyIds, java.lang.Object[] propertyValues, int[] getterSetters, Context cx, Scriptable scope)
-
isArrayObject
public static boolean isArrayObject(java.lang.Object obj)
-
getArrayElements
public static java.lang.Object[] getArrayElements(Scriptable object)
-
checkDeprecated
static void checkDeprecated(Context cx, java.lang.String name)
-
getMessage0
@Deprecated public static java.lang.String getMessage0(java.lang.String messageId)
Deprecated.UsegetMessageById(String messageId, Object... args)
instead
-
getMessage1
@Deprecated public static java.lang.String getMessage1(java.lang.String messageId, java.lang.Object arg1)
Deprecated.UsegetMessageById(String messageId, Object... args)
instead
-
getMessage2
@Deprecated public static java.lang.String getMessage2(java.lang.String messageId, java.lang.Object arg1, java.lang.Object arg2)
Deprecated.UsegetMessageById(String messageId, Object... args)
instead
-
getMessage3
@Deprecated public static java.lang.String getMessage3(java.lang.String messageId, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
Deprecated.UsegetMessageById(String messageId, Object... args)
instead
-
getMessage4
@Deprecated public static java.lang.String getMessage4(java.lang.String messageId, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4)
Deprecated.UsegetMessageById(String messageId, Object... args)
instead
-
getMessage
@Deprecated public static java.lang.String getMessage(java.lang.String messageId, java.lang.Object[] arguments)
Deprecated.UsegetMessageById(String messageId, Object... args)
instead
-
getMessageById
public static java.lang.String getMessageById(java.lang.String messageId, java.lang.Object... args)
-
constructError
public static EcmaError constructError(java.lang.String error, java.lang.String message)
-
constructError
public static EcmaError constructError(java.lang.String error, java.lang.String message, int lineNumberDelta)
-
constructError
public static EcmaError constructError(java.lang.String error, java.lang.String message, java.lang.String sourceName, int lineNumber, java.lang.String lineSource, int columnNumber)
-
rangeError
public static EcmaError rangeError(java.lang.String message)
-
rangeErrorById
public static EcmaError rangeErrorById(java.lang.String messageId, java.lang.Object... args)
-
typeError
public static EcmaError typeError(java.lang.String message)
-
typeErrorById
public static EcmaError typeErrorById(java.lang.String messageId, java.lang.Object... args)
-
typeError0
@Deprecated public static EcmaError typeError0(java.lang.String messageId)
Deprecated.UsetypeErrorById(String messageId, Object... args)
instead
-
typeError1
@Deprecated public static EcmaError typeError1(java.lang.String messageId, java.lang.Object arg1)
Deprecated.UsetypeErrorById(String messageId, Object... args)
instead
-
typeError2
@Deprecated public static EcmaError typeError2(java.lang.String messageId, java.lang.Object arg1, java.lang.Object arg2)
Deprecated.UsetypeErrorById(String messageId, Object... args)
instead
-
typeError3
@Deprecated public static EcmaError typeError3(java.lang.String messageId, java.lang.String arg1, java.lang.String arg2, java.lang.String arg3)
Deprecated.UsetypeErrorById(String messageId, Object... args)
instead
-
undefReadError
public static java.lang.RuntimeException undefReadError(java.lang.Object object, java.lang.Object id)
-
undefCallError
public static java.lang.RuntimeException undefCallError(java.lang.Object object, java.lang.Object id)
-
undefWriteError
public static java.lang.RuntimeException undefWriteError(java.lang.Object object, java.lang.Object id, java.lang.Object value)
-
undefDeleteError
private static java.lang.RuntimeException undefDeleteError(java.lang.Object object, java.lang.Object id)
-
notFoundError
public static java.lang.RuntimeException notFoundError(Scriptable object, java.lang.String property)
-
notFunctionError
public static java.lang.RuntimeException notFunctionError(java.lang.Object value)
-
notFunctionError
public static java.lang.RuntimeException notFunctionError(java.lang.Object value, java.lang.Object messageHelper)
-
notFunctionError
public static java.lang.RuntimeException notFunctionError(java.lang.Object obj, java.lang.Object value, java.lang.String propertyName)
-
notXmlError
private static java.lang.RuntimeException notXmlError(java.lang.Object value)
-
syntaxError
public static EcmaError syntaxError(java.lang.String message)
-
syntaxErrorById
public static EcmaError syntaxErrorById(java.lang.String messageId, java.lang.Object... args)
-
warnAboutNonJSObject
private static void warnAboutNonJSObject(java.lang.Object nonJSObject)
-
getRegExpProxy
public static RegExpProxy getRegExpProxy(Context cx)
-
setRegExpProxy
public static void setRegExpProxy(Context cx, RegExpProxy proxy)
-
checkRegExpProxy
public static RegExpProxy checkRegExpProxy(Context cx)
-
wrapRegExp
public static Scriptable wrapRegExp(Context cx, Scriptable scope, java.lang.Object compiled)
-
getTemplateLiteralCallSite
public static Scriptable getTemplateLiteralCallSite(Context cx, Scriptable scope, java.lang.Object[] strings, int index)
-
escapeAttributeValue
public static java.lang.String escapeAttributeValue(java.lang.Object value, Context cx)
Escapes the reserved characters in a value of an attribute- Parameters:
value
- Unescaped text- Returns:
- The escaped text
-
escapeTextValue
public static java.lang.String escapeTextValue(java.lang.Object value, Context cx)
Escapes the reserved characters in a value of a text node- Parameters:
value
- Unescaped text- Returns:
- The escaped text
-
memberRef
public static Ref memberRef(java.lang.Object obj, java.lang.Object elem, Context cx, int memberTypeFlags)
-
memberRef
public static Ref memberRef(java.lang.Object obj, java.lang.Object namespace, java.lang.Object elem, Context cx, int memberTypeFlags)
-
nameRef
public static Ref nameRef(java.lang.Object name, Context cx, Scriptable scope, int memberTypeFlags)
-
nameRef
public static Ref nameRef(java.lang.Object namespace, java.lang.Object name, Context cx, Scriptable scope, int memberTypeFlags)
-
storeUint32Result
public static void storeUint32Result(Context cx, long value)
-
lastUint32Result
public static long lastUint32Result(Context cx)
-
storeScriptable
private static void storeScriptable(Context cx, Scriptable value)
-
lastStoredScriptable
public static Scriptable lastStoredScriptable(Context cx)
-
makeUrlForGeneratedScript
static java.lang.String makeUrlForGeneratedScript(boolean isEval, java.lang.String masterScriptUrl, int masterScriptLine)
-
isGeneratedScript
static boolean isGeneratedScript(java.lang.String sourceUrl)
-
isSymbol
static boolean isSymbol(java.lang.Object obj)
Not all "NativeSymbol" instances are actually symbols. So account for that here rather than just by using an "instanceof" check.
-
errorWithClassName
private static java.lang.RuntimeException errorWithClassName(java.lang.String msg, java.lang.Object val)
-
throwError
public static JavaScriptException throwError(Context cx, Scriptable scope, java.lang.String message)
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, java.lang.String constructorName, java.lang.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
-
-