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

[whatwg] Firing WebStorage storage event

From: Janusz Majnert <jmajnert@gmail.com>
Date: Wed, 3 Oct 2012 16:58:25 +0200
Message-ID: <CAOeF0ey0cOP_c2A8VhEkDJpO8aZPpUDWN7iwv+H+w8STQoU0TA@mail.gmail.com>
To: WHATWG <whatwg@whatwg.org>
Hi all,
I would like to ask for your help. I'm having hard time understanding
the rules for firing WebStorage's storage event.

In section 11.2.3
(http://www.whatwg.org/specs/web-apps/current-work/multipage/webstorage.html#the-localstorage-attribute)
we have this sentence [1]:
"
When the setItem(), removeItem(), and clear() methods are called on a
Storage object x that is associated with a local storage area, if the
methods did something, then in every Document object whose Window
object's localStorage attribute's Storage object is associated with
the same storage area, other than x, a storage event must be fired, as
described below.
"


"as described below" points to section 11.2.4, which reads [2]:
"
The storage event is fired when a storage area changes, as described
in the previous two sections (for session storage, for local storage).
When this happens, the user agent must queue a task to fire an event
with the name storage, which does not bubble and is not cancelable,
and which uses the StorageEvent interface, at each Window object whose
Document object has a Storage object that is affected.
"

What I understood:
Sentence [1] says that storage events should be fired on affected
Document objects, except the one that originated the change.
Sentences in [2]  say that when a storage event is fired as described
in [1], a task must be queued to fire storage events on all affected
Window objects. It also says that Document objects have Storage
objects, which I don't think is true.

Is my understanding correct? What am I missing?

Thanks in advance for your help.

Best regards,
Janusz Majnert
Received on Wednesday, 3 October 2012 15:03:22 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:10 GMT