Package org.htmlunit.javascript.host
Class Storage
- java.lang.Object
-
- org.htmlunit.corejs.javascript.ScriptableObject
-
- org.htmlunit.javascript.HtmlUnitScriptable
-
- org.htmlunit.javascript.host.Storage
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,org.htmlunit.corejs.javascript.ConstProperties,org.htmlunit.corejs.javascript.debug.DebuggableObject,org.htmlunit.corejs.javascript.Scriptable,org.htmlunit.corejs.javascript.SymbolScriptable
public class Storage extends HtmlUnitScriptable
The JavaScript object that represents a Storage.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.HashSet<java.lang.String>RESERVED_NAMES_private java.util.Map<java.lang.String,java.lang.String>store_private static longSTORE_SIZE_KIMITprivate longstoreSize_
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears all items.java.lang.Objectget(java.lang.String name, org.htmlunit.corejs.javascript.Scriptable start)Gets a named property from the object.java.lang.ObjectgetItem(java.lang.String key)Returns the value of the specified key.intgetLength()Returns the length property.voidjsConstructor()JavaScript constructor.java.lang.Stringkey(int index)Returns the key of the specified index.voidput(java.lang.String name, org.htmlunit.corejs.javascript.Scriptable start, java.lang.Object value)voidremoveItem(java.lang.String key)Removes the specified key.voidsetItem(java.lang.String key, java.lang.String data)Sets the item value.-
Methods inherited from class org.htmlunit.javascript.HtmlUnitScriptable
clone, equivalentValues, getBrowserVersion, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getStartingScope, getWindow, getWindow, getWithPreemption, has, hasInstance, initParentScope, makeScriptableFor, setClassName, setDomNode, setDomNode, setParentScope, setupPromise, setupRejectedPromise
-
Methods inherited from class org.htmlunit.corejs.javascript.ScriptableObject
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, get, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setPrototype, size
-
-
-
-
Field Detail
-
RESERVED_NAMES_
private static final java.util.HashSet<java.lang.String> RESERVED_NAMES_
-
STORE_SIZE_KIMIT
private static final long STORE_SIZE_KIMIT
- See Also:
- Constant Field Values
-
store_
private final java.util.Map<java.lang.String,java.lang.String> store_
-
storeSize_
private long storeSize_
-
-
Constructor Detail
-
Storage
public Storage()
Public default constructor only for the prototype.
-
Storage
public Storage(Window window, java.util.Map<java.lang.String,java.lang.String> store)
Constructor.- Parameters:
window- the parent scopestore- the storage itself
-
-
Method Detail
-
jsConstructor
public void jsConstructor()
JavaScript constructor.
-
put
public void put(java.lang.String name, org.htmlunit.corejs.javascript.Scriptable start, java.lang.Object value)- Specified by:
putin interfaceorg.htmlunit.corejs.javascript.Scriptable- Overrides:
putin classHtmlUnitScriptable
-
get
public java.lang.Object get(java.lang.String name, org.htmlunit.corejs.javascript.Scriptable start)Gets a named property from the object. Normally HtmlUnit objects don't need to overwrite this method as properties are defined on the prototypes from the XML configuration. In some cases where "content" of object has priority compared to the properties consider using utilityHtmlUnitScriptable.getWithPreemption(String).- Specified by:
getin interfaceorg.htmlunit.corejs.javascript.Scriptable- Overrides:
getin classHtmlUnitScriptable
-
getLength
public int getLength()
Returns the length property.- Returns:
- the length property
-
removeItem
public void removeItem(java.lang.String key)
Removes the specified key.- Parameters:
key- the item key
-
key
public java.lang.String key(int index)
Returns the key of the specified index.- Parameters:
index- the index- Returns:
- the key
-
getItem
public java.lang.Object getItem(java.lang.String key)
Returns the value of the specified key.- Parameters:
key- the item key- Returns:
- the value
-
setItem
public void setItem(java.lang.String key, java.lang.String data)Sets the item value.- Parameters:
key- the item keydata- the value
-
clear
public void clear()
Clears all items.
-
-