Hi,
while reading through the GWT StorageMap class to learn more about using HTML 5 local storage I noticed that the StorageEntryIterator#remove() method seems to assume a stable order of the keys in the local storage, i.e. that removing a key via the iterator does not change the order of the iteration, and the next unvisited key has simply the same index as the now-removed key.
According to
http://dev.w3.org/html5/webstorage/#dom-storage-key this doesn't seem to be a good assumption: the order is explicitly allowed to change when the number of keys change,
> The
key(n)
method must
return the name of the
nth key in the list. The order of keys is user-agent
defined, but must be consistent within an object so long as the number of keys doesn't change.
(Thus,
adding or
removing a key may change the order of the keys, but merely
changing the value of an existing key must not.) If
n is
greater than or equal to the number of key/value pairs
in the object, then this method must return null.
Has this behavior ever been observed in the wild, or am I missing something here?
--
Andreas