W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2009

[WebStorage] structured clones serialization

From: Marcos Caceres <marcosc@opera.com>
Date: Mon, 14 Sep 2009 20:04:08 +0200
Message-ID: <b21a10670909141104r737518d7ibd06ba089358ef4f@mail.gmail.com>
To: Ian Hickson <ian@hixie.ch>, public-webapps <public-webapps@w3.org>
Hi Ian,
With the recent move to structured clones in Web Storage, I'm
wondering if a serialization for those clones needs to be specified?

A use case for widgets is widget preferences, where the preference's
in a widget's configuration document are used to populate a storage
object. At the moment, we only support strings:

<widget ...>
  <preference name="foo" value="bar"/>
</widget>

Becomes:

window.widget.preferences.foo;

However, enabling some kind of text-based serialization for
structured-clones would allow authors to serialize more complex data.

Some other comments for the current editor's draft:

I wonder if, where there is overlap, the following two assertions
could be merged into a general assertion applied to the an object that
implements Storage (as it would be useful for widgets.preferences).

[[
4.2 The sessionStorage attribute
User agents should expire data from the local storage areas only for
security reasons or when requested to do so by the user. User agents
should always avoid deleting data while a script that could access
that data is running.

4.3 The localStorage attribute
User agents should not expire data from a browsing context's session
storage areas, but may do so when the user requests that such data be
deleted, or when the UA detects that it has limited storage space, or
for security reasons. User agents should always avoid deleting data
while a script that could access that data is running. When a
top-level browsing context is destroyed (and therefore permanently
inaccessible to the user) the data stored in its session storage areas
can be discarded with it, as the API described in this specification
provides no way for that data to ever be subsequently retrieved.
]]


In the spec it sez:
  "The use of parseInt() is needed when dealing with numbers (integers
in this case) because the storage APIs are all string-based."

Is the above still true with the introduction of structured clones?

In the spec it sez:
  "Storage areas (both session storage and local storage) store
strings. To store structured data in a storage area, you must first
convert it to a string."

As above. I'm all for casual language in a spec (makes it fun to
read!), but "you" should really make it clear that it's the author and
not the UA that needs to do the conversion.

-- 
Marcos Caceres
http://datadriven.com.au
Received on Monday, 14 September 2009 18:05:08 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:33 GMT