W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2008

[whatwg] StorageEvent deficiency

From: Brady Eidson <beidson@apple.com>
Date: Tue, 20 May 2008 11:38:58 -0700
Message-ID: <3B500A0C-812C-40C6-B46B-08AEBF690CC1@apple.com>
The StorageEvent has almost all the information in it that a script  
would need, except one.

Imagine a multi-frame page where each document is from the same  
security origin.  In this case, if one document on the page changes  
either a SessionStorage item or a LocalStorage item, the other  
documents on the page have no way of knowing if the StorageEvent  
generated is from changing SessionStorage or LocalStorage.

One might argue they could compare the changed key/value in the event  
to their SessionStorage and LocalStorage and infer which one generated  
the event, but this is not fool proof.  There are a number of  
situations that could arise where a script couldn't infer which  
Storage object had changed.

I propose adding an additional property to the StorageEvent interface:

interface StorageEvent : Event {
	...
	readonly attribute Storage storageArea;
	...
}

The name of the attribute is up in the air, but the point is that the  
object would be either the SessionStorage object or the LocalStorage  
object.

Thanks,
~Brady
Received on Tuesday, 20 May 2008 11:38:58 UTC

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