W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2009

[whatwg] sessionStorage and the Storage event

From: Jonas Sicking <jonas@sicking.cc>
Date: Mon, 26 Oct 2009 18:17:22 -0700
Message-ID: <63df84f0910261817u7219989eobf4b5b2c154aeabe@mail.gmail.com>
On Mon, Oct 26, 2009 at 4:06 PM, Honza Bambas <honzab at allpeers.com> wrote:
> The spec says:
>
> "When the setItem(), removeItem(), and clear() methods are called on a
> Storage object x that is associated with a session storage area, if the
> methods did something, then in every HTMLDocument object whose Window
> object's sessionStorage attribute's Storage object is associated with the
> same storage area, other than x, a storage event must be fired, as described
> below."
>
> [http://dev.w3.org/html5/webstorage/#dom-sessionstorage]
>
> The same applies to localStorage.
>
> Maybe I read something wrong, but as a sessionStorage object is always
> unique to its document (it is cloned when a new document with the same
> origin is created and then independent from the original document's object)
> it, in my opinion, doesn't make sense to send the event to any other
> document then the one its storage has been changed. On the other hand, it
> makes sense to me to not fire the event in the same document where the
> storage has been changed (as for localStorage), then, I'd say there should
> be no event for sessionStorage at all. I simply don't a case when two or
> more documents would share a single sessionStorage object.

Huh? Does documents from the same session not all share sessionStorage
data? I.e. in the following set of events:

1. User navigates to http://example.com/a.html
2. Page sets sessionStorage.foo = "hi";
3. User navigates, in same window, to http://example.com/b.html
4. Page sets sessionStorage.foo = "saxophone";
5. User clicks back-button, which puts him back at http://example.com/a.html
6. Page does x = sessionStorage.foo;

what is the value of 'x'? I would have expected it to be "saxophone",
is that not the case. This seems to be required in order to do for
example multi-page forms.

/ Jonas
Received on Monday, 26 October 2009 18:17:22 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:18 UTC