[whatwg] sessionStorage and the Storage event

Jonas Sicking wrote:
> 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
>
>   
Jonas, please read "unique to its document" as "unique to its browsing 
context". I was wrong. In step 6 you'll get saxophone ;)

-hb-

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20091027/8d4b5fff/attachment.htm>

Received on Tuesday, 27 October 2009 09:48:57 UTC