[whatwg] Firing WebStorage storage event

Janusz Majnert jmajnert at gmail.com
Wed Oct 3 07:58:25 PDT 2012


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


More information about the whatwg mailing list