Skip to content

Commit

Permalink
[giow] (0) Remove the structed data support from Web Storage.
Browse files Browse the repository at this point in the history
Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=12111

git-svn-id: http://svn.whatwg.org/webapps@6364 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Aug 4, 2011
1 parent 5e8a39c commit 34c4c4f
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 82 deletions.
54 changes: 20 additions & 34 deletions complete.html
Original file line number Diff line number Diff line change
Expand Up @@ -81733,7 +81733,7 @@ <h3 id=introduction-15><span class=secno>12.1 </span>Introduction</h3>
indicate that he wants insurance:</p>

<pre>&lt;label&gt;
&lt;input type="checkbox" onchange="sessionStorage.insurance = checked"&gt;
&lt;input type="checkbox" onchange="sessionStorage.insurance = checked ? 'true' : ''"&gt;
I want insurance on this trip.
&lt;/label&gt;</pre>

Expand All @@ -81755,6 +81755,7 @@ <h3 id=introduction-15><span class=secno>12.1 </span>Introduction</h3>
for (var i in forms[0].elements)
sessionStorage["data_" + i.name] = i.value;

// if we add storage of non-strings
if (!sessionStorage[documents])
sessionStorage[documents] = {};
sessionStorage[documents][filename] = <document/>;
Expand Down Expand Up @@ -81805,8 +81806,8 @@ <h4 id=the-storage-interface><span class=secno>12.2.1 </span>The <code><a href=#
<pre class=idl>interface <dfn id=storage-0>Storage</dfn> {
readonly attribute unsigned long <a href=#dom-storage-length title=dom-Storage-length>length</a>;
DOMString? <a href=#dom-storage-key title=dom-Storage-key>key</a>(in unsigned long index);
getter any <a href=#dom-storage-getitem title=dom-Storage-getItem>getItem</a>(in DOMString key);
setter creator void <a href=#dom-storage-setitem title=dom-Storage-setItem>setItem</a>(in DOMString key, in any value);
getter DOMString <a href=#dom-storage-getitem title=dom-Storage-getItem>getItem</a>(in DOMString key);
setter creator void <a href=#dom-storage-setitem title=dom-Storage-setItem>setItem</a>(in DOMString key, in DOMString value);
deleter void <a href=#dom-storage-removeitem title=dom-Storage-removeItem>removeItem</a>(in DOMString key);
void <a href=#dom-storage-clear title=dom-Storage-clear>clear</a>();
};</pre>
Expand All @@ -81817,14 +81818,14 @@ <h4 id=the-storage-interface><span class=secno>12.2.1 </span>The <code><a href=#
- when the key was last modified
- which page was the last to modify the key
[-Mihai Sucan]

support non-string values
-->

<p>Each <code><a href=#storage-0>Storage</a></code> object provides access to a list of
key/value pairs, which are sometimes called items. Keys are
strings. Any string (including the empty string) is a valid
key. Values can be any data type supported by the <a href=#structured-clone>structured
clone</a> algorithm.
</p>
key. Values are similarly strings.</p>

<p>Each <code><a href=#storage-0>Storage</a></code> object is associated with a list of
key/value pairs when it is created, as defined in the sections on
Expand Down Expand Up @@ -81853,37 +81854,23 @@ <h4 id=the-storage-interface><span class=secno>12.2.1 </span>The <code><a href=#
<code><a href=#storage-0>Storage</a></code> object are the keys of each key/value pair
currently present in the list associated with the object.</p>

<p>The <dfn id=dom-storage-getitem title=dom-Storage-getItem><code>getItem(<var title="">key</var>)</code></dfn> method must return a
<a href=#structured-clone>structured clone</a> of the current value associated with
<p>The <dfn id=dom-storage-getitem title=dom-Storage-getItem><code>getItem(<var title="">key</var>)</code></dfn> method must return
the current value associated with
the given <var title="">key</var>. If the given <var title="">key</var> does not exist in the list associated with the
object then this method must return null.
</p>

<p>The <dfn id=dom-storage-setitem title=dom-Storage-setItem><code>setItem(<var title="">key</var>, <var title="">value</var>)</code></dfn> method
must first create a <a href=#structured-clone>structured clone</a> of the given <var title="">value</var>. If this raises an exception, then the
exception must be thrown and the list associated with the object is
left unchanged. If constructing the stuctured clone would involve
constructing a new <code><a href=#imagedata>ImageData</a></code> object, then throw a
<code><a href=#not_supported_err>NOT_SUPPORTED_ERR</a></code> exception instead.
</p>

<!-- ImageData isn't supported because reading such objects is
synchronous, and getData() is synchronous, and therefore if the
stored data is in deep storage, it would be very painful to have a
script grab the value and immediately try to read the image
data. -->

<p>Otherwise, the user agent must then check if a key/value pair
must first check if a key/value pair
with the given <var title="">key</var> already exists in the list
associated with the object.</p>

<p>If it does not, then a new key/value pair must be added to the
list, with the given <var title="">key</var> and with its value set
to the newly obtained clone of <var title="">value</var>.</p>
to <var title="">value</var>.</p>

<p>If the given <var title="">key</var> <em>does</em> exist in the
list, then it must have its value updated to the newly obtained
clone of <var title="">value</var>.</p>
list, then it must have its value updated to <var title="">value</var>.</p>

<p>If it couldn't set the new value, the method must raise an
<code><a href=#quota_exceeded_err>QUOTA_EXCEEDED_ERR</a></code> exception. (Setting could fail if,
Expand Down Expand Up @@ -82099,12 +82086,11 @@ <h4 id=the-storage-event><span class=secno>12.2.4 </span>The <code title=event-s

<p>If the event is being fired due to an invocation of the <code title=dom-Storage-setItem><a href=#dom-storage-setitem>setItem()</a></code> or <code title=dom-Storage-removeItem><a href=#dom-storage-removeitem>removeItem()</a></code> methods, the
event must have its <code title=dom-StorageEvent-key><a href=#dom-storageevent-key>key</a></code>
attribute set to the name of the key in question, its <code title=dom-StorageEvent-oldValue><a href=#dom-storageevent-oldvalue>oldValue</a></code> attribute set to a
<a href=#structured-clone>structured clone</a> of the old value of the key in
question, or null if the key is newly added, and its <code title=dom-StorageEvent-newValue><a href=#dom-storageevent-newvalue>newValue</a></code> attribute set to a
<a href=#structured-clone>structured clone</a> of the new value of the key in
question, or null if the key was removed.
</p>
attribute set to the name of the key in question, its <code title=dom-StorageEvent-oldValue><a href=#dom-storageevent-oldvalue>oldValue</a></code> attribute set to
the old value of the key in question, or null if the key is newly
added, and its <code title=dom-StorageEvent-newValue><a href=#dom-storageevent-newvalue>newValue</a></code> attribute set to
the new value of the key in question, or null if the key was
removed.</p>

<p>Otherwise, if the event is being fired due to an invocation of
the <code title=dom-Storage-clear><a href=#dom-storage-clear>clear()</a></code> method, the event
Expand All @@ -82123,11 +82109,11 @@ <h5 id=event-definition-0><span class=secno>12.2.4.1 </span>Event definition</h5

<pre class=idl>interface <dfn id=storageevent>StorageEvent</dfn> : <a href=#event>Event</a> {
readonly attribute DOMString <a href=#dom-storageevent-key title=dom-StorageEvent-key>key</a>;
readonly attribute any <a href=#dom-storageevent-oldvalue title=dom-StorageEvent-oldValue>oldValue</a>;
readonly attribute any <a href=#dom-storageevent-newvalue title=dom-StorageEvent-newValue>newValue</a>;
readonly attribute DOMString? <a href=#dom-storageevent-oldvalue title=dom-StorageEvent-oldValue>oldValue</a>;
readonly attribute DOMString? <a href=#dom-storageevent-newvalue title=dom-StorageEvent-newValue>newValue</a>;
readonly attribute DOMString <a href=#dom-storageevent-url title=dom-StorageEvent-url>url</a>;
readonly attribute <a href=#storage-0>Storage</a>? <a href=#dom-storageevent-storagearea title=dom-StorageEvent-storageArea>storageArea</a>;
void <a href=#dom-storageevent-initstorageevent title=dom-StorageEvent-initStorageEvent>initStorageEvent</a>(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString keyArg, in any oldValueArg, in any newValueArg, in DOMString urlArg, in <a href=#storage-0>Storage</a>? storageAreaArg);
void <a href=#dom-storageevent-initstorageevent title=dom-StorageEvent-initStorageEvent>initStorageEvent</a>(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString keyArg, in DOMString? oldValueArg, in DOMString? newValueArg, in DOMString urlArg, in <a href=#storage-0>Storage</a>? storageAreaArg);
};</pre>

<p>The <dfn id=dom-storageevent-initstorageevent title=dom-StorageEvent-initStorageEvent><code>initStorageEvent()</code></dfn>
Expand Down
69 changes: 21 additions & 48 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -92608,7 +92608,7 @@ interface <dfn>MessageChannel</dfn> {
indicate that he wants insurance:</p>

<pre>&lt;label>
&lt;input type="checkbox" onchange="sessionStorage.insurance = checked">
&lt;input type="checkbox" onchange="sessionStorage.insurance = checked ? 'true' : ''">
I want insurance on this trip.
&lt;/label></pre>

Expand All @@ -92630,6 +92630,7 @@ interface <dfn>MessageChannel</dfn> {
for (var i in forms[0].elements)
sessionStorage["data_" + i.name] = i.value;

// if we add storage of non-strings
if (!sessionStorage[documents])
sessionStorage[documents] = {};
sessionStorage[documents][filename] = <document/>;
Expand Down Expand Up @@ -92684,8 +92685,8 @@ interface <dfn>MessageChannel</dfn> {
<pre class="idl">interface <dfn>Storage</dfn> {
readonly attribute unsigned long <span title="dom-Storage-length">length</span>;
DOMString? <span title="dom-Storage-key">key</span>(in unsigned long index);
getter any <span title="dom-Storage-getItem">getItem</span>(in DOMString key);
setter creator void <span title="dom-Storage-setItem">setItem</span>(in DOMString key, in any value);
getter DOMString <span title="dom-Storage-getItem">getItem</span>(in DOMString key);
setter creator void <span title="dom-Storage-setItem">setItem</span>(in DOMString key, in DOMString value);
deleter void <span title="dom-Storage-removeItem">removeItem</span>(in DOMString key);
void <span title="dom-Storage-clear">clear</span>();
};</pre>
Expand All @@ -92696,17 +92697,14 @@ interface <dfn>MessageChannel</dfn> {
- when the key was last modified
- which page was the last to modify the key
[-Mihai Sucan]

support non-string values
-->

<p>Each <code>Storage</code> object provides access to a list of
key/value pairs, which are sometimes called items. Keys are
strings. Any string (including the empty string) is a valid
key. Values can be any data type supported by the <span>structured
clone</span> algorithm.
<!--END complete--><!--END epub-->
<a href="#refsHTML">[HTML]</a>
<!--START complete--><!--START epub-->
</p>
key. Values are similarly strings.</p>

<p>Each <code>Storage</code> object is associated with a list of
key/value pairs when it is created, as defined in the sections on
Expand Down Expand Up @@ -92740,46 +92738,25 @@ interface <dfn>MessageChannel</dfn> {
currently present in the list associated with the object.</p>

<p>The <dfn title="dom-Storage-getItem"><code>getItem(<var
title="">key</var>)</code></dfn> method must return a
<span>structured clone</span> of the current value associated with
title="">key</var>)</code></dfn> method must return
the current value associated with
the given <var title="">key</var>. If the given <var
title="">key</var> does not exist in the list associated with the
object then this method must return null.
<!--END complete--><!--END epub-->
<a href="#refsHTML">[HTML]</a>
<!--START complete--><!--START epub-->
</p>

<p>The <dfn title="dom-Storage-setItem"><code>setItem(<var
title="">key</var>, <var title="">value</var>)</code></dfn> method
must first create a <span>structured clone</span> of the given <var
title="">value</var>. If this raises an exception, then the
exception must be thrown and the list associated with the object is
left unchanged. If constructing the stuctured clone would involve
constructing a new <code>ImageData</code> object, then throw a
<code>NOT_SUPPORTED_ERR</code> exception instead.
<!--END complete--><!--END epub-->
<a href="#refsHTML">[HTML]</a>
<!--START complete--><!--START epub-->
</p>

<!-- ImageData isn't supported because reading such objects is
synchronous, and getData() is synchronous, and therefore if the
stored data is in deep storage, it would be very painful to have a
script grab the value and immediately try to read the image
data. -->

<p>Otherwise, the user agent must then check if a key/value pair
must first check if a key/value pair
with the given <var title="">key</var> already exists in the list
associated with the object.</p>

<p>If it does not, then a new key/value pair must be added to the
list, with the given <var title="">key</var> and with its value set
to the newly obtained clone of <var title="">value</var>.</p>
to <var title="">value</var>.</p>

<p>If the given <var title="">key</var> <em>does</em> exist in the
list, then it must have its value updated to the newly obtained
clone of <var title="">value</var>.</p>
list, then it must have its value updated to <var title="">value</var>.</p>

<p>If it couldn't set the new value, the method must raise an
<code>QUOTA_EXCEEDED_ERR</code> exception. (Setting could fail if,
Expand Down Expand Up @@ -93023,16 +93000,12 @@ interface <dfn>WindowLocalStorage</dfn> {
title="dom-Storage-removeItem">removeItem()</code> methods, the
event must have its <code title="dom-StorageEvent-key">key</code>
attribute set to the name of the key in question, its <code
title="dom-StorageEvent-oldValue">oldValue</code> attribute set to a
<span>structured clone</span> of the old value of the key in
question, or null if the key is newly added, and its <code
title="dom-StorageEvent-newValue">newValue</code> attribute set to a
<span>structured clone</span> of the new value of the key in
question, or null if the key was removed.
<!--END complete--><!--END epub-->
<a href="#refsHTML">[HTML]</a>
<!--START complete--><!--START epub-->
</p>
title="dom-StorageEvent-oldValue">oldValue</code> attribute set to
the old value of the key in question, or null if the key is newly
added, and its <code
title="dom-StorageEvent-newValue">newValue</code> attribute set to
the new value of the key in question, or null if the key was
removed.</p>

<p>Otherwise, if the event is being fired due to an invocation of
the <code title="dom-Storage-clear">clear()</code> method, the event
Expand All @@ -93056,11 +93029,11 @@ interface <dfn>WindowLocalStorage</dfn> {

<pre class="idl">interface <dfn>StorageEvent</dfn> : <span>Event</span> {
readonly attribute DOMString <span title="dom-StorageEvent-key">key</span>;
readonly attribute any <span title="dom-StorageEvent-oldValue">oldValue</span>;
readonly attribute any <span title="dom-StorageEvent-newValue">newValue</span>;
readonly attribute DOMString? <span title="dom-StorageEvent-oldValue">oldValue</span>;
readonly attribute DOMString? <span title="dom-StorageEvent-newValue">newValue</span>;
readonly attribute DOMString <span title="dom-StorageEvent-url">url</span>;
readonly attribute <span>Storage</span>? <span title="dom-StorageEvent-storageArea">storageArea</span>;
void <span title="dom-StorageEvent-initStorageEvent">initStorageEvent</span>(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString keyArg, in any oldValueArg, in any newValueArg, in DOMString urlArg, in <span>Storage</span>? storageAreaArg);
void <span title="dom-StorageEvent-initStorageEvent">initStorageEvent</span>(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString keyArg, in DOMString? oldValueArg, in DOMString? newValueArg, in DOMString urlArg, in <span>Storage</span>? storageAreaArg);
};</pre>

<p>The <dfn
Expand Down

0 comments on commit 34c4c4f

Please sign in to comment.