[html5] r6364 - [giow] (0) Remove the structed data support from Web Storage. Fixing http://www. [...]

whatwg at whatwg.org whatwg at whatwg.org
Wed Aug 3 23:50:49 PDT 2011


Author: ianh
Date: 2011-08-03 23:50:46 -0700 (Wed, 03 Aug 2011)
New Revision: 6364

Modified:
   complete.html
   source
Log:
[giow] (0) Remove the structed data support from Web Storage.
Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=12111

Modified: complete.html
===================================================================
--- complete.html	2011-08-04 06:37:41 UTC (rev 6363)
+++ complete.html	2011-08-04 06:50:46 UTC (rev 6364)
@@ -81733,7 +81733,7 @@
    indicate that he wants insurance:</p>
 
    <pre><label>
- <input type="checkbox" onchange="sessionStorage.insurance = checked">
+ <input type="checkbox" onchange="sessionStorage.insurance = checked ? 'true' : ''">
  I want insurance on this trip.
 </label></pre>
 
@@ -81755,6 +81755,7 @@
    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/>;
@@ -81805,8 +81806,8 @@
   <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>
@@ -81817,14 +81818,14 @@
        - 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
@@ -81853,37 +81854,23 @@
   <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,
@@ -82099,12 +82086,11 @@
 
   <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
@@ -82123,11 +82109,11 @@
 
   <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>

Modified: source
===================================================================
--- source	2011-08-04 06:37:41 UTC (rev 6363)
+++ source	2011-08-04 06:50:46 UTC (rev 6364)
@@ -92608,7 +92608,7 @@
    indicate that he wants insurance:</p>
 
    <pre><label>
- <input type="checkbox" onchange="sessionStorage.insurance = checked">
+ <input type="checkbox" onchange="sessionStorage.insurance = checked ? 'true' : ''">
  I want insurance on this trip.
 </label></pre>
 
@@ -92630,6 +92630,7 @@
    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/>;
@@ -92684,8 +92685,8 @@
   <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>
@@ -92696,17 +92697,14 @@
        - 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
@@ -92740,46 +92738,25 @@
   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,
@@ -93023,16 +93000,12 @@
   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
@@ -93056,11 +93029,11 @@
 
   <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




More information about the Commit-Watchers mailing list