Monday, January 6, 2014

StorageMap.StorageEntryIterator#remove() - Issues with order?

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

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment