Class Storage

java.lang.Object
org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.javascript.HtmlUnitScriptable
org.htmlunit.javascript.host.Storage
All Implemented Interfaces:
Serializable, 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:
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject

    org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final HashSet<String>
     
    private final Map<String,String>
     
    private static final long
     
    private long
     

    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
    Public default constructor only for the prototype.
    Storage(Window window, Map<String,String> store)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clears all items.
    get(String name, org.htmlunit.corejs.javascript.Scriptable start)
    Gets a named property from the object.
    Returns the value of the specified key.
    int
    Returns the length property.
    void
    JavaScript constructor.
    key(int index)
    Returns the key of the specified index.
    void
    put(String name, org.htmlunit.corejs.javascript.Scriptable start, Object value)
    void
    Removes the specified key.
    void
    setItem(String key, String data)
    Sets the item value.

    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

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • RESERVED_NAMES_

      private static final HashSet<String> RESERVED_NAMES_
    • STORE_SIZE_KIMIT

      private static final long STORE_SIZE_KIMIT
      See Also:
    • store_

      private final Map<String,String> store_
    • storeSize_

      private long storeSize_
  • Constructor Details

    • Storage

      public Storage()
      Public default constructor only for the prototype.
    • Storage

      public Storage(Window window, Map<String,String> store)
      Constructor.
      Parameters:
      window - the parent scope
      store - the storage itself
  • Method Details

    • jsConstructor

      public void jsConstructor()
      JavaScript constructor.
    • put

      public void put(String name, org.htmlunit.corejs.javascript.Scriptable start, Object value)
      Specified by:
      put in interface org.htmlunit.corejs.javascript.Scriptable
      Overrides:
      put in class HtmlUnitScriptable
    • get

      public Object get(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 utility HtmlUnitScriptable.getWithPreemption(String).
      Specified by:
      get in interface org.htmlunit.corejs.javascript.Scriptable
      Overrides:
      get in class HtmlUnitScriptable
    • getLength

      public int getLength()
      Returns the length property.
      Returns:
      the length property
    • removeItem

      public void removeItem(String key)
      Removes the specified key.
      Parameters:
      key - the item key
    • key

      public String key(int index)
      Returns the key of the specified index.
      Parameters:
      index - the index
      Returns:
      the key
    • getItem

      public Object getItem(String key)
      Returns the value of the specified key.
      Parameters:
      key - the item key
      Returns:
      the value
    • setItem

      public void setItem(String key, String data)
      Sets the item value.
      Parameters:
      key - the item key
      data - the value
    • clear

      public void clear()
      Clears all items.