Package org.htmlunit.corejs.javascript
Class NativeString
- java.lang.Object
-
- org.htmlunit.corejs.javascript.ScriptableObject
-
- org.htmlunit.corejs.javascript.IdScriptableObject
-
- org.htmlunit.corejs.javascript.NativeString
-
- All Implemented Interfaces:
java.io.Serializable,ConstProperties,DebuggableObject,IdFunctionCall,Scriptable,SymbolScriptable
final class NativeString extends IdScriptableObject
This class implements the String native object.See ECMA 15.5.
String methods for dealing with regular expressions are ported directly from C. Latest port is from version 1.40.12.19 in the JSFUN13_BRANCH.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject
ScriptableObject.KeyComparator
-
-
Field Summary
Fields Modifier and Type Field Description private static intConstructorId_charAtprivate static intConstructorId_charCodeAtprivate static intConstructorId_concatprivate static intConstructorId_equalsIgnoreCaseprivate static intConstructorId_fromCharCodeprivate static intConstructorId_fromCodePointprivate static intConstructorId_indexOfprivate static intConstructorId_lastIndexOfprivate static intConstructorId_localeCompareprivate static intConstructorId_matchprivate static intConstructorId_rawprivate static intConstructorId_replaceprivate static intConstructorId_replaceAllprivate static intConstructorId_searchprivate static intConstructorId_sliceprivate static intConstructorId_splitprivate static intConstructorId_substrprivate static intConstructorId_substringprivate static intConstructorId_toLocaleLowerCaseprivate static intConstructorId_toLowerCaseprivate static intConstructorId_toUpperCaseprivate static intId_anchorprivate static intId_atprivate static intId_bigprivate static intId_blinkprivate static intId_boldprivate static intId_charAtprivate static intId_charCodeAtprivate static intId_codePointAtprivate static intId_concatprivate static intId_constructorprivate static intId_endsWithprivate static intId_equalsprivate static intId_equalsIgnoreCaseprivate static intId_fixedprivate static intId_fontcolorprivate static intId_fontsizeprivate static intId_includesprivate static intId_indexOfprivate static intId_italicsprivate static intId_lastIndexOfprivate static intId_lengthprivate static intId_linkprivate static intId_localeCompareprivate static intId_matchprivate static intId_normalizeprivate static intId_padEndprivate static intId_padStartprivate static intId_repeatprivate static intId_replaceprivate static intId_replaceAllprivate static intId_searchprivate static intId_sliceprivate static intId_smallprivate static intId_splitprivate static intId_startsWithprivate static intId_strikeprivate static intId_subprivate static intId_substrprivate static intId_substringprivate static intId_supprivate static intId_toLocaleLowerCaseprivate static intId_toLocaleUpperCaseprivate static intId_toLowerCaseprivate static intId_toSourceprivate static intId_toStringprivate static intId_toUpperCaseprivate static intId_trimprivate static intId_trimEndprivate static intId_trimLeftprivate static intId_trimRightprivate static intId_trimStartprivate static intId_valueOfprivate static intMAX_INSTANCE_IDprivate static intMAX_PROTOTYPE_IDprivate static longserialVersionUIDprivate java.lang.CharSequencestringprivate static java.lang.ObjectSTRING_TAGprivate static intSymbolId_iterator-
Fields inherited from class org.htmlunit.corejs.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
-
Fields inherited from interface org.htmlunit.corejs.javascript.Scriptable
NOT_FOUND
-
-
Constructor Summary
Constructors Constructor Description NativeString(java.lang.CharSequence s)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private ScriptableObjectdefaultIndexPropertyDescriptor(java.lang.Object value)java.lang.ObjectexecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)'thisObj' will be null if invoked as constructor, in which case * instance of Scriptable should be returned.protected voidfillConstructorProperties(IdFunctionObject ctor)protected intfindInstanceIdInfo(java.lang.String s)Map name to id of instance property.protected intfindPrototypeId(java.lang.String s)protected intfindPrototypeId(Symbol k)java.lang.Objectget(int index, Scriptable start)Returns the value of the indexed property or NOT_FOUND.intgetAttributes(int index)Get the attributes of an indexed property.java.lang.StringgetClassName()Return the name of the class.protected java.lang.Object[]getIds(boolean nonEnumerable, boolean getSymbols)protected java.lang.StringgetInstanceIdName(int id)Map id back to property name it defines.protected java.lang.ObjectgetInstanceIdValue(int id)Get id value.(package private) intgetLength()protected intgetMaxInstanceId()Get maximum id findInstanceIdInfo can generate.protected ScriptableObjectgetOwnPropertyDescriptor(Context cx, java.lang.Object id)booleanhas(int index, Scriptable start)Returns true if the property index is defined.(package private) static voidinit(Scriptable scope, boolean sealed)protected voidinitPrototypeId(int id)private static java.lang.Stringjs_concat(java.lang.String target, java.lang.Object[] args)private static intjs_indexOf(int methodId, java.lang.String target, java.lang.Object[] args)private static intjs_lastIndexOf(java.lang.String target, java.lang.Object[] args)private static java.lang.Stringjs_pad(Context cx, Scriptable thisObj, IdFunctionObject f, java.lang.Object[] args, boolean atStart)private static java.lang.CharSequencejs_raw(Context cx, Scriptable scope, java.lang.Object[] args)String.raw (template, ...substitutions)private static java.lang.Stringjs_repeat(Context cx, Scriptable thisObj, IdFunctionObject f, java.lang.Object[] args)private static java.lang.CharSequencejs_slice(java.lang.CharSequence target, java.lang.Object[] args)private static java.lang.CharSequencejs_substr(java.lang.CharSequence target, java.lang.Object[] args)private static java.lang.CharSequencejs_substring(Context cx, java.lang.CharSequence target, java.lang.Object[] args)voidput(int index, Scriptable start, java.lang.Object value)Sets the value of the indexed property, creating it if need be.private static NativeStringrealThis(Scriptable thisObj, IdFunctionObject f)private static java.lang.Stringtagify(Context cx, Scriptable thisObj, IdFunctionObject f, java.lang.String tag, java.lang.String attribute, java.lang.Object[] args)java.lang.CharSequencetoCharSequence()java.lang.StringtoString()-
Methods inherited from class org.htmlunit.corejs.javascript.IdScriptableObject
activatePrototypeMap, addIdFunctionProperty, defaultGet, defaultHas, defaultPut, defineOwnProperty, delete, delete, ensureType, exportAsJSClass, findInstanceIdInfo, get, get, getAttributes, getAttributes, has, has, hasPrototypeMap, initPrototypeConstructor, initPrototypeMethod, initPrototypeMethod, initPrototypeMethod, initPrototypeValue, initPrototypeValue, instanceIdInfo, put, put, setAttributes, setInstanceIdAttributes, setInstanceIdValue
-
Methods inherited from class org.htmlunit.corejs.javascript.ScriptableObject
addLazilyInitializedValue, applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildClassCtor, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, checkValidAttributes, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, equivalentValues, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getBase, getBase, getClassPrototype, getDefaultValue, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, hasInstance, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, putConst, putConstProperty, putImpl, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
STRING_TAG
private static final java.lang.Object STRING_TAG
-
Id_length
private static final int Id_length
- See Also:
- Constant Field Values
-
MAX_INSTANCE_ID
private static final int MAX_INSTANCE_ID
- See Also:
- Constant Field Values
-
ConstructorId_fromCharCode
private static final int ConstructorId_fromCharCode
- See Also:
- Constant Field Values
-
ConstructorId_fromCodePoint
private static final int ConstructorId_fromCodePoint
- See Also:
- Constant Field Values
-
ConstructorId_raw
private static final int ConstructorId_raw
- See Also:
- Constant Field Values
-
Id_constructor
private static final int Id_constructor
- See Also:
- Constant Field Values
-
Id_toString
private static final int Id_toString
- See Also:
- Constant Field Values
-
Id_toSource
private static final int Id_toSource
- See Also:
- Constant Field Values
-
Id_valueOf
private static final int Id_valueOf
- See Also:
- Constant Field Values
-
Id_charAt
private static final int Id_charAt
- See Also:
- Constant Field Values
-
Id_charCodeAt
private static final int Id_charCodeAt
- See Also:
- Constant Field Values
-
Id_indexOf
private static final int Id_indexOf
- See Also:
- Constant Field Values
-
Id_lastIndexOf
private static final int Id_lastIndexOf
- See Also:
- Constant Field Values
-
Id_split
private static final int Id_split
- See Also:
- Constant Field Values
-
Id_substring
private static final int Id_substring
- See Also:
- Constant Field Values
-
Id_toLowerCase
private static final int Id_toLowerCase
- See Also:
- Constant Field Values
-
Id_toUpperCase
private static final int Id_toUpperCase
- See Also:
- Constant Field Values
-
Id_substr
private static final int Id_substr
- See Also:
- Constant Field Values
-
Id_concat
private static final int Id_concat
- See Also:
- Constant Field Values
-
Id_slice
private static final int Id_slice
- See Also:
- Constant Field Values
-
Id_bold
private static final int Id_bold
- See Also:
- Constant Field Values
-
Id_italics
private static final int Id_italics
- See Also:
- Constant Field Values
-
Id_fixed
private static final int Id_fixed
- See Also:
- Constant Field Values
-
Id_strike
private static final int Id_strike
- See Also:
- Constant Field Values
-
Id_small
private static final int Id_small
- See Also:
- Constant Field Values
-
Id_big
private static final int Id_big
- See Also:
- Constant Field Values
-
Id_blink
private static final int Id_blink
- See Also:
- Constant Field Values
-
Id_sup
private static final int Id_sup
- See Also:
- Constant Field Values
-
Id_sub
private static final int Id_sub
- See Also:
- Constant Field Values
-
Id_fontsize
private static final int Id_fontsize
- See Also:
- Constant Field Values
-
Id_fontcolor
private static final int Id_fontcolor
- See Also:
- Constant Field Values
-
Id_link
private static final int Id_link
- See Also:
- Constant Field Values
-
Id_anchor
private static final int Id_anchor
- See Also:
- Constant Field Values
-
Id_equals
private static final int Id_equals
- See Also:
- Constant Field Values
-
Id_equalsIgnoreCase
private static final int Id_equalsIgnoreCase
- See Also:
- Constant Field Values
-
Id_match
private static final int Id_match
- See Also:
- Constant Field Values
-
Id_search
private static final int Id_search
- See Also:
- Constant Field Values
-
Id_replace
private static final int Id_replace
- See Also:
- Constant Field Values
-
Id_replaceAll
private static final int Id_replaceAll
- See Also:
- Constant Field Values
-
Id_localeCompare
private static final int Id_localeCompare
- See Also:
- Constant Field Values
-
Id_toLocaleLowerCase
private static final int Id_toLocaleLowerCase
- See Also:
- Constant Field Values
-
Id_toLocaleUpperCase
private static final int Id_toLocaleUpperCase
- See Also:
- Constant Field Values
-
Id_trim
private static final int Id_trim
- See Also:
- Constant Field Values
-
Id_trimLeft
private static final int Id_trimLeft
- See Also:
- Constant Field Values
-
Id_trimRight
private static final int Id_trimRight
- See Also:
- Constant Field Values
-
Id_includes
private static final int Id_includes
- See Also:
- Constant Field Values
-
Id_startsWith
private static final int Id_startsWith
- See Also:
- Constant Field Values
-
Id_endsWith
private static final int Id_endsWith
- See Also:
- Constant Field Values
-
Id_normalize
private static final int Id_normalize
- See Also:
- Constant Field Values
-
Id_repeat
private static final int Id_repeat
- See Also:
- Constant Field Values
-
Id_codePointAt
private static final int Id_codePointAt
- See Also:
- Constant Field Values
-
Id_padStart
private static final int Id_padStart
- See Also:
- Constant Field Values
-
Id_padEnd
private static final int Id_padEnd
- See Also:
- Constant Field Values
-
SymbolId_iterator
private static final int SymbolId_iterator
- See Also:
- Constant Field Values
-
Id_trimStart
private static final int Id_trimStart
- See Also:
- Constant Field Values
-
Id_trimEnd
private static final int Id_trimEnd
- See Also:
- Constant Field Values
-
Id_at
private static final int Id_at
- See Also:
- Constant Field Values
-
MAX_PROTOTYPE_ID
private static final int MAX_PROTOTYPE_ID
- See Also:
- Constant Field Values
-
ConstructorId_charAt
private static final int ConstructorId_charAt
- See Also:
- Constant Field Values
-
ConstructorId_charCodeAt
private static final int ConstructorId_charCodeAt
- See Also:
- Constant Field Values
-
ConstructorId_indexOf
private static final int ConstructorId_indexOf
- See Also:
- Constant Field Values
-
ConstructorId_lastIndexOf
private static final int ConstructorId_lastIndexOf
- See Also:
- Constant Field Values
-
ConstructorId_split
private static final int ConstructorId_split
- See Also:
- Constant Field Values
-
ConstructorId_substring
private static final int ConstructorId_substring
- See Also:
- Constant Field Values
-
ConstructorId_toLowerCase
private static final int ConstructorId_toLowerCase
- See Also:
- Constant Field Values
-
ConstructorId_toUpperCase
private static final int ConstructorId_toUpperCase
- See Also:
- Constant Field Values
-
ConstructorId_substr
private static final int ConstructorId_substr
- See Also:
- Constant Field Values
-
ConstructorId_concat
private static final int ConstructorId_concat
- See Also:
- Constant Field Values
-
ConstructorId_slice
private static final int ConstructorId_slice
- See Also:
- Constant Field Values
-
ConstructorId_equalsIgnoreCase
private static final int ConstructorId_equalsIgnoreCase
- See Also:
- Constant Field Values
-
ConstructorId_match
private static final int ConstructorId_match
- See Also:
- Constant Field Values
-
ConstructorId_search
private static final int ConstructorId_search
- See Also:
- Constant Field Values
-
ConstructorId_replace
private static final int ConstructorId_replace
- See Also:
- Constant Field Values
-
ConstructorId_replaceAll
private static final int ConstructorId_replaceAll
- See Also:
- Constant Field Values
-
ConstructorId_localeCompare
private static final int ConstructorId_localeCompare
- See Also:
- Constant Field Values
-
ConstructorId_toLocaleLowerCase
private static final int ConstructorId_toLocaleLowerCase
- See Also:
- Constant Field Values
-
string
private java.lang.CharSequence string
-
-
Method Detail
-
init
static void init(Scriptable scope, boolean sealed)
-
getClassName
public java.lang.String getClassName()
Description copied from class:ScriptableObjectReturn the name of the class.This is typically the same name as the constructor. Classes extending ScriptableObject must implement this abstract method.
- Specified by:
getClassNamein interfaceScriptable- Specified by:
getClassNamein classScriptableObject
-
getMaxInstanceId
protected int getMaxInstanceId()
Description copied from class:IdScriptableObjectGet maximum id findInstanceIdInfo can generate.- Overrides:
getMaxInstanceIdin classIdScriptableObject
-
findInstanceIdInfo
protected int findInstanceIdInfo(java.lang.String s)
Description copied from class:IdScriptableObjectMap name to id of instance property. Should return 0 if not found or the result ofIdScriptableObject.instanceIdInfo(int, int).- Overrides:
findInstanceIdInfoin classIdScriptableObject
-
getInstanceIdName
protected java.lang.String getInstanceIdName(int id)
Description copied from class:IdScriptableObjectMap id back to property name it defines.- Overrides:
getInstanceIdNamein classIdScriptableObject
-
getInstanceIdValue
protected java.lang.Object getInstanceIdValue(int id)
Description copied from class:IdScriptableObjectGet id value. * If id value is constant, descendant can call cacheIdValue to store * value in the permanent cache. * Default implementation creates IdFunctionObject instance for given id * and cache its value- Overrides:
getInstanceIdValuein classIdScriptableObject
-
fillConstructorProperties
protected void fillConstructorProperties(IdFunctionObject ctor)
- Overrides:
fillConstructorPropertiesin classIdScriptableObject
-
initPrototypeId
protected void initPrototypeId(int id)
- Overrides:
initPrototypeIdin classIdScriptableObject
-
execIdCall
public java.lang.Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
Description copied from class:IdScriptableObject'thisObj' will be null if invoked as constructor, in which case * instance of Scriptable should be returned.- Specified by:
execIdCallin interfaceIdFunctionCall- Overrides:
execIdCallin classIdScriptableObject
-
realThis
private static NativeString realThis(Scriptable thisObj, IdFunctionObject f)
-
tagify
private static java.lang.String tagify(Context cx, Scriptable thisObj, IdFunctionObject f, java.lang.String tag, java.lang.String attribute, java.lang.Object[] args)
-
toCharSequence
public java.lang.CharSequence toCharSequence()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
get
public java.lang.Object get(int index, Scriptable start)Description copied from class:ScriptableObjectReturns the value of the indexed property or NOT_FOUND.- Specified by:
getin interfaceScriptable- Overrides:
getin classScriptableObject- Parameters:
index- the numeric index for the propertystart- the object in which the lookup began- Returns:
- the value of the property (may be null), or NOT_FOUND
- See Also:
Scriptable.get(String,Scriptable)
-
put
public void put(int index, Scriptable start, java.lang.Object value)Description copied from class:ScriptableObjectSets the value of the indexed property, creating it if need be.- Specified by:
putin interfaceScriptable- Overrides:
putin classScriptableObject- Parameters:
index- the numeric index for the propertystart- the object whose property is being setvalue- value to set the property to- See Also:
Scriptable.has(int, Scriptable),Scriptable.get(int, Scriptable),ScriptableObject.putProperty(Scriptable, int, Object),Context.toObject(Object, Scriptable)
-
has
public boolean has(int index, Scriptable start)Description copied from class:ScriptableObjectReturns true if the property index is defined.- Specified by:
hasin interfaceScriptable- Overrides:
hasin classScriptableObject- Parameters:
index- the numeric index for the propertystart- the object in which the lookup began- Returns:
- true if and only if the property was found in the object
- See Also:
Scriptable.get(int, Scriptable),ScriptableObject.getProperty(Scriptable, int)
-
getAttributes
public int getAttributes(int index)
Description copied from class:ScriptableObjectGet the attributes of an indexed property.- Overrides:
getAttributesin classScriptableObject- Parameters:
index- the numeric index for the property- Returns:
- the bitset of attributes
- See Also:
ScriptableObject.has(String, Scriptable),ScriptableObject.READONLY,ScriptableObject.DONTENUM,ScriptableObject.PERMANENT,ScriptableObject.EMPTY
-
getIds
protected java.lang.Object[] getIds(boolean nonEnumerable, boolean getSymbols)- Overrides:
getIdsin classIdScriptableObject
-
getOwnPropertyDescriptor
protected ScriptableObject getOwnPropertyDescriptor(Context cx, java.lang.Object id)
- Overrides:
getOwnPropertyDescriptorin classIdScriptableObject
-
defaultIndexPropertyDescriptor
private ScriptableObject defaultIndexPropertyDescriptor(java.lang.Object value)
-
js_indexOf
private static int js_indexOf(int methodId, java.lang.String target, java.lang.Object[] args)
-
js_lastIndexOf
private static int js_lastIndexOf(java.lang.String target, java.lang.Object[] args)
-
js_substring
private static java.lang.CharSequence js_substring(Context cx, java.lang.CharSequence target, java.lang.Object[] args)
-
getLength
int getLength()
-
js_substr
private static java.lang.CharSequence js_substr(java.lang.CharSequence target, java.lang.Object[] args)
-
js_concat
private static java.lang.String js_concat(java.lang.String target, java.lang.Object[] args)
-
js_slice
private static java.lang.CharSequence js_slice(java.lang.CharSequence target, java.lang.Object[] args)
-
js_repeat
private static java.lang.String js_repeat(Context cx, Scriptable thisObj, IdFunctionObject f, java.lang.Object[] args)
-
js_pad
private static java.lang.String js_pad(Context cx, Scriptable thisObj, IdFunctionObject f, java.lang.Object[] args, boolean atStart)
-
findPrototypeId
protected int findPrototypeId(Symbol k)
- Overrides:
findPrototypeIdin classIdScriptableObject
-
js_raw
private static java.lang.CharSequence js_raw(Context cx, Scriptable scope, java.lang.Object[] args)
String.raw (template, ...substitutions)
22.1.2.4 String.raw [Draft ECMA-262 / April 28, 2021]
-
findPrototypeId
protected int findPrototypeId(java.lang.String s)
- Overrides:
findPrototypeIdin classIdScriptableObject
-
-