Diff for /html5/webdatabase/Overview.html between versions 1.11 and 1.36

version 1.11, 2009/08/16 10:28:41 version 1.36, 2009/10/04 10:14:19
Line 35 Line 35
    .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }     .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
    .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }     .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
    .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }     .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
    .applies th > * { display: block; }  
    .applies thead code { display: block; }  
    .applies td { text-align: center; }  
    .applies .yes { background: yellow; }  
   
    .toc dfn, h1 dfn, h2 dfn, h3 dfn, h4 dfn, h5 dfn, h6 dfn { font: inherit; }     .toc dfn, h1 dfn, h2 dfn, h3 dfn, h4 dfn, h5 dfn, h6 dfn { font: inherit; }
    img.extra { float: right; }     img.extra { float: right; }
Line 96 Line 92
    .XXX { color: #E50000; background: white; border: solid red; padding: 0.5em; margin: 1em 0; }     .XXX { color: #E50000; background: white; border: solid red; padding: 0.5em; margin: 1em 0; }
    .XXX > :first-child { margin-top: 0; }     .XXX > :first-child { margin-top: 0; }
    p .XXX { line-height: 3em; }     p .XXX { line-height: 3em; }
      .annotation { border: solid thin black; background: #0C479D; color: white; position: relative; margin: 8px 0 20px 0; }
      .annotation:before { position: absolute; left: 0; top: 0; width: 100%; height: 100%; margin: 6px -6px -6px 6px; background: #333333; z-index: -1; content: ''; }
      .annotation :link, .annotation :visited { color: inherit; }
      .annotation :link:hover, .annotation :visited:hover { background: transparent; }
      .annotation span { border: none ! important; }
    .note { color: green; background: transparent; font-family: sans-serif; }     .note { color: green; background: transparent; font-family: sans-serif; }
    .warning { color: red; background: transparent; }     .warning { color: red; background: transparent; }
    .note, .warning { font-weight: bolder; font-style: italic; }     .note, .warning { font-weight: bolder; font-style: italic; }
Line 136 Line 137
      border-width: 0.25em;       border-width: 0.25em;
    }     }
   
    .example {     .example { display: block; color: #222222; background: #FCFCFC; border-left: double; margin-left: 2em; padding-left: 1em; }
      display: block;     td > .example:only-child { margin: 0 0 0 0.1em; }
      color: #222222;  
      background: #FCFCFC;  
      border-left: double;  
      margin-left: 2em;  
      padding-left: 1em;  
    }  
   
    .tall-and-narrow {     .tall-and-narrow {
      font-size: 0.6em;       font-size: 0.6em;
Line 169 Line 164
    ul.domTree .t7 code, .domTree .t8 code { color: green; }     ul.domTree .t7 code, .domTree .t8 code { color: green; }
    ul.domTree .t10 code { color: teal; }     ul.domTree .t10 code { color: teal; }
   
   </style><link href="http://www.w3.org/StyleSheets/TR/W3C-ED" rel="stylesheet" type="text/css"><!-- ZZZ ED vs WD --><div class="head">    </style><link href="http://www.w3.org/StyleSheets/TR/W3C-WD" rel="stylesheet" type="text/css"><div class="head">
    <p><a href="http://www.w3.org/"><img alt="W3C" height="48" src="http://www.w3.org/Icons/w3c_home" width="72"></a></p>     <p><a href="http://www.w3.org/"><img alt="W3C" height="48" src="http://www.w3.org/Icons/w3c_home" width="72"></a></p>
    <h1>Web Database</h1>     <h1>Web Database</h1>
    <!--ZZZ:-->     <h2 class="no-num no-toc" id="w3c-working-draft-10-september-2009">W3C Working Draft 10 September 2009</h2> <!-- ZZZ -->
    <!--<h2 class="no-num no-toc">W3C Working Draft 23 April 2009</h2>-->  
    <h2 class="no-num no-toc" id="editor-s-draft-date-1-january-1970">Editor's Draft 16 August 2009</h2>     <dl><dt>This Version:</dt>
    <!--:ZZZ-->      <dd><a href="http://www.w3.org/TR/2009/WD-webdatabase-20090910/">http://www.w3.org/TR/2009/WD-webdatabase-20090910/</a></dd> <!-- ZZZ date x2 -->
    <dl><!-- ZZZ: update the month/day (twice), (un)comment out  
     <dt>This Version:</dt>  
     <dd><a href="http://www.w3.org/TR/2009/WD-webdatabase-20090423/">http://www.w3.org/TR/2009/WD-webdatabase-20090423/</a></dd>  
     <dt>Latest Published Version:</dt>      <dt>Latest Published Version:</dt>
     <dd><a href="http://www.w3.org/TR/webdatabase/">http://www.w3.org/TR/webdatabase/</a></dd>      <dd><a href="http://www.w3.org/TR/webdatabase/">http://www.w3.org/TR/webdatabase/</a></dd>
  :ZZZ --><dt>Latest Editor's Draft:</dt>      <dt>Latest Editor's Draft:</dt>
     <dd><a href="http://dev.w3.org/html5/webdatabase/">http://dev.w3.org/html5/webdatabase/</a></dd>      <dd><a href="http://dev.w3.org/html5/webdatabase/">http://dev.w3.org/html5/webdatabase/</a></dd>
 <!-- ZZZ: add the new version after it has shipped  <!-- ZZZ: add the new version after it has shipped
     <dt>Previous Versions:</dt>      <dt>Previous Versions:</dt>
Line 239 Line 231
   </ul><!-- UNDER NO CIRCUMSTANCES IS THE PRECEDING LIST TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- status of document, group responsible (required) --><p>The W3C <a href="http://www.w3.org/2008/webapps/">Web Apps    </ul><!-- UNDER NO CIRCUMSTANCES IS THE PRECEDING LIST TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- status of document, group responsible (required) --><p>The W3C <a href="http://www.w3.org/2008/webapps/">Web Apps
   Working Group</a> is the W3C working group responsible for this    Working Group</a> is the W3C working group responsible for this
   specification's progress along the W3C Recommendation track.    specification's progress along the W3C Recommendation track.
   <!--ZZZ:-->    This specification is the 10 September 2009 First Public Working Draft. <!--ZZZ (date and remove 'first public'-->
   <!--This specification is the 23 April 2009 Working Draft.-->  
   This specification is the 16 August 2009 Editor's Draft.  
   <!--:ZZZ-->  
   </p><!-- required patent boilerplate --><p>This document was produced by a group operating under the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5    </p><!-- required patent boilerplate --><p>This document was produced by a group operating under the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5
   February 2004 W3C Patent Policy</a>. W3C maintains a <a href="http://www.w3.org/2004/01/pp-impl/42538/status" rel="disclosure">public list of    February 2004 W3C Patent Policy</a>. W3C maintains a <a href="http://www.w3.org/2004/01/pp-impl/42538/status" rel="disclosure">public list of
   any patent disclosures</a> made in connection with the deliverables    any patent disclosures</a> made in connection with the deliverables
Line 271 Line 261
      <li><a href="#executing-sql-statements-0"><span class="secno">4.4.1 </span>Executing SQL statements</a></ol></li>       <li><a href="#executing-sql-statements-0"><span class="secno">4.4.1 </span>Executing SQL statements</a></ol></li>
    <li><a href="#database-query-results"><span class="secno">4.5 </span>Database query results</a></li>     <li><a href="#database-query-results"><span class="secno">4.5 </span>Database query results</a></li>
    <li><a href="#errors-and-exceptions"><span class="secno">4.6 </span>Errors and exceptions</a></ol></li>     <li><a href="#errors-and-exceptions"><span class="secno">4.6 </span>Errors and exceptions</a></ol></li>
  <li><a href="#disk-space"><span class="secno">5 </span>Disk space</a></li>   <li><a href="#web-sql"><span class="secno">5 </span>Web SQL</a></li>
  <li><a href="#privacy"><span class="secno">6 </span>Privacy</a>   <li><a href="#disk-space"><span class="secno">6 </span>Disk space</a></li>
    <li><a href="#privacy"><span class="secno">7 </span>Privacy</a>
   <ol>    <ol>
    <li><a href="#user-tracking"><span class="secno">6.1 </span>User tracking</a></li>     <li><a href="#user-tracking"><span class="secno">7.1 </span>User tracking</a></li>
    <li><a href="#cookie-resurrection"><span class="secno">6.2 </span>Cookie resurrection</a></ol></li>     <li><a href="#sensitivity-of-data"><span class="secno">7.2 </span>Sensitivity of data</a></ol></li>
  <li><a href="#security"><span class="secno">7 </span>Security</a>   <li><a href="#security"><span class="secno">8 </span>Security</a>
   <ol>    <ol>
    <li><a href="#dns-spoofing-attacks"><span class="secno">7.1 </span>DNS spoofing attacks</a></li>     <li><a href="#dns-spoofing-attacks"><span class="secno">8.1 </span>DNS spoofing attacks</a></li>
    <li><a href="#cross-directory-attacks"><span class="secno">7.2 </span>Cross-directory attacks</a></li>     <li><a href="#cross-directory-attacks"><span class="secno">8.2 </span>Cross-directory attacks</a></li>
    <li><a href="#implementation-risks"><span class="secno">7.3 </span>Implementation risks</a></li>     <li><a href="#implementation-risks"><span class="secno">8.3 </span>Implementation risks</a></li>
    <li><a href="#sql-and-user-agents"><span class="secno">7.4 </span>SQL and user agents</a></li>     <li><a href="#sql-and-user-agents"><span class="secno">8.4 </span>SQL and user agents</a></li>
    <li><a href="#sql-injection"><span class="secno">7.5 </span>SQL injection</a></ol></li>     <li><a href="#sql-injection"><span class="secno">8.5 </span>SQL injection</a></ol></li>
  <li><a class="no-num" href="#references">References</a></ol>   <li><a class="no-num" href="#references">References</a></ol>
 <!--end-toc--><hr><!-- Feature requests for future versions (v2):  <!--end-toc--><hr><!-- Feature requests for future versions (v2):
         * deleting databases          * deleting databases
         * determining how much storage room is left          * determining how much storage room is left
         * handling the database getting corrupted          * handling the database getting corrupted
     --><h2 id="introduction"><span class="secno">1 </span>Introduction</h2><p><i>This section is non-normative.</i><p>This specification introduces a set of APIs to manipulate
   XXX should make it clear that UAs should treat data as sensitive and    client-side databases using SQL.<p>The API is asynchronous, so authors are likely to find anonymous
   should delete it properly when it is deleted    functions (lambdas) very useful in using this API.<p>Here is an example of a script using this API. First, a function
   --><h2 id="introduction"><span class="secno">1 </span>Introduction</h2><p><i>This section is non-normative.</i><p class="XXX">...</p><!-- include an example that does something like the following to show    <code title="">prepareDatabase()</code> is defined. This function
 you should never embed strings straight into the statement, even when you    tries to create the database if necessary, giving it one table
 have a variable and unknowable number of literals coming:    called "docids" with two columns ("id" and "name"). If it is
    var q = "";    successful, or if the table doesn't need creating, it calls a
    for each (var i in array)    section function, <code title="">getDatabase()</code>, which obtains
      q += (q == "" ? "" : ", ") + "?";    a handle to the database, and then calls the function to do the
    executeSql('SELECT rowid FROM t WHERE c IN (' + q + ')', array, ...);    actual work, in this case <code title="">showDocCount()</code>.<pre>function prepareDatabase(ready, error) {
 --><h2 id="conformance-requirements"><span class="secno">2 </span>Conformance requirements</h2><p>All diagrams, examples, and notes in this specification are    return openDatabase('documents', '1.0', 'Offline document storage', 5*1024*1024, function (db) {
       db.changeVersion('', '1.0', function (t) {
         t.executeSql('CREATE TABLE docids (id, name)');
       }, error);
     });
   }
   
   function showDocCount(db, span) {
     db.readTransaction(function (t) {
       t.executeSql('SELECT COUNT(*) AS c FROM docids', [], function (t, r) {
         span.textContent = r.rows[0].c;
       }, function (t, e) {
         // couldn't read database
         span.textContent = '(unknown: ' + e.message + ')';
       });
     });
   }
   
   prepareDatabase(function(db) {
     // got database
     var span = document.getElementById('doc-count');
     showDocCount(db, span);
   }, function (e) {
     // error getting database
     alert(e.message);
   });</pre><hr><p>The <code title="dom-sqltransaction-executeSql"><a href="#dom-sqltransaction-executesql">executeSql()</a></code> method has
     an argument intended to allow variables to be substituted into
     statements without risking SQL injection vulnerabilities:<pre>db.readTransaction(function (t) {
     t.executeSql('SELECT title, author FROM docs WHERE id=?', [id], function (t, data) {
       report(data.rows[0].title, data.rows[0].author);
     });
   });</pre><hr><p>Sometimes, there might be an arbitrary number of variables to
     substitute in. Even in these case, the right solution is to
     construct the query using only "?" characters, and then to pass the
     variables in as the second argument:<pre>function findDocs(db, resultCallback) {
     var q = "";
     for each (var i in labels)
       q += (q == "" ? "" : ", ") + "?";
     db.readTransaction(function (t) {
       t.executeSql('SELECT id FROM docs WHERE label IN (' + q + ')', labels, function (t, data) {
         resultCallback(data);
       });
     });
   }</pre><h2 id="conformance-requirements"><span class="secno">2 </span>Conformance requirements</h2><p>All diagrams, examples, and notes in this specification are
   non-normative, as are all sections explicitly marked non-normative.    non-normative, as are all sections explicitly marked non-normative.
   Everything else in this specification is normative.<p>The key words "MUST", "MUST NOT", "REQUIRED", <!--"SHALL", "SHALL    Everything else in this specification is normative.<p>The key words "MUST", "MUST NOT", "REQUIRED", <!--"SHALL", "SHALL
   NOT",--> "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and    NOT",--> "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and
Line 344  have a variable and unknowable number of Line 378  have a variable and unknowable number of
   scripts in Web applications, and does not necessarily imply the    scripts in Web applications, and does not necessarily imply the
   existence of an actual <code>Document</code> object or of any other    existence of an actual <code>Document</code> object or of any other
   <code>Node</code> objects as defined in the DOM Core    <code>Node</code> objects as defined in the DOM Core
   specifications. <a href="#refsDOMCORE">[DOMCORE]</a><p>A DOM attribute is said to be <em>getting</em> when its value is    specifications. <a href="#refsDOMCORE">[DOMCORE]</a><p>An IDL attribute is said to be <em>getting</em> when its value is
   being retrieved (e.g. by author script), and is said to be    being retrieved (e.g. by author script), and is said to be
   <em>setting</em> when a new value is assigned to it.<p>The term "JavaScript" is used to refer to ECMA262, rather than    <em>setting</em> when a new value is assigned to it.<p>The term "JavaScript" is used to refer to ECMA262, rather than
   the official term ECMAScript, since the term JavaScript is more    the official term ECMAScript, since the term JavaScript is more
Line 358  have a variable and unknowable number of Line 392  have a variable and unknowable number of
   another browser window) trying to write to a database with incorrect    another browser window) trying to write to a database with incorrect
   assumptions.<pre class="idl">[Supplemental, NoInterfaceObject]    assumptions.<pre class="idl">[Supplemental, NoInterfaceObject]
 interface <span>WindowDatabase</span> {  interface <span>WindowDatabase</span> {
   <a href="#database">Database</a> <a href="#dom-opendatabase" title="dom-opendatabase">openDatabase</a>(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize);    <a href="#database">Database</a> <a href="#dom-opendatabase" title="dom-opendatabase">openDatabase</a>(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in optional <a href="#databasecallback">DatabaseCallback</a> creationCallback);
 };  };
 <span>Window</span> implements <span>WindowDatabase</span>;  <span>Window</span> implements <span>WindowDatabase</span>;
   
 [Supplemental, NoInterfaceObject]  [Supplemental, NoInterfaceObject]
 interface <span>WorkerUtilsDatabase</span> {  interface <span>WorkerUtilsDatabase</span> {
   <a href="#database">Database</a> <a href="#dom-opendatabase" title="dom-opendatabase">openDatabase</a>(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize);    <a href="#database">Database</a> <a href="#dom-opendatabase" title="dom-opendatabase">openDatabase</a>(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in optional <a href="#databasecallback">DatabaseCallback</a> creationCallback);
   <a href="#databasesync">DatabaseSync</a> <a href="#dom-opendatabase-sync" title="dom-opendatabase-sync">openDatabaseSync</a>(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize);    <a href="#databasesync">DatabaseSync</a> <a href="#dom-opendatabase-sync" title="dom-opendatabase-sync">openDatabaseSync</a>(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in optional <a href="#databasecallback">DatabaseCallback</a> creationCallback);
 };  };
 <span>WorkerUtils</span> implements <span>WorkerUtilsDatabase</span>;</pre><p>The <dfn id="dom-opendatabase" title="dom-opendatabase"><code>openDatabase()</code></dfn> method on  <span>WorkerUtils</span> implements <span>WorkerUtilsDatabase</span>;
   the <code>Window</code> and <code>WorkerUtils</code> interfaces must  
   return a newly constructed <code><a href="#database">Database</a></code> object that  [Callback=FunctionOnly, NoInterfaceObject]
   represents the database requested.<p>The <dfn id="dom-opendatabase-sync" title="dom-opendatabase-sync"><code>openDatabaseSync()</code></dfn>  interface <dfn id="databasecallback">DatabaseCallback</dfn> {
   method on the <code>WorkerUtils</code> interfaces must return a    void <span title="dom-databasecallback-handleEvent">handleEvent</span>(in <a href="#database">Database</a> database);
   newly constructed <code><a href="#databasesync">DatabaseSync</a></code> object that represents  };</pre><p>The <dfn id="dom-opendatabase" title="dom-opendatabase"><code>openDatabase()</code></dfn> method on
   the database requested.<p>These methods take four arguments: a database name, a database    the <code>Window</code> and <code>WorkerUtils</code> interfaces and
   version, a display name, and an estimated size, in bytes, of the    the <dfn id="dom-opendatabase-sync" title="dom-opendatabase-sync"><code>openDatabaseSync()</code></dfn>
   data that will be stored in the database.<p>The database requested is the one with the given database    method on the <code>WorkerUtils</code> interface take the following
   name from the appropriate <span>origin</span>.<p>The <code title="dom-opendatabase"><a href="#dom-opendatabase">openDatabase()</a></code> method    arguments: a database name, a database version, a display name, an
   on the <code>Window</code> object must use and create databases from    estimated size &mdash; in bytes &mdash; of the data that will be
   the <span>origin</span> of the <span>active document</span> of the    stored in the database, and optionally a callback to be invoked if
   <span>browsing context</span> of the <code>Window</code> object on    the database has not yet been created. The callback, if provided, is
   which the method was invoked.<p>The <code title="dom-opendatabase"><a href="#dom-opendatabase">openDatabase()</a></code> and    intended to be used to call <code title="dom-database-changeVersion"><a href="#dom-database-changeversion">changeVersion()</a></code>; the
   <code title="dom-opendatabase-sync"><a href="#dom-opendatabase-sync">openDatabaseSync()</a></code>    callback is invoked with the database having the empty string as its
   methods on the <code>WorkerUtils</code> object must use and create    version regardless of the given database version. If the callback is
   databases from the <span>origin</span> of the scripts in the    not provided, the database is created with the given database
   worker.<p>All strings including the empty string are valid database    version as its version.<p>When invoked, these methods must run the following steps, with all
     but the last two steps being run atomically:<ol><li>
   
       <p>The user agent may raise a <code>SECURITY_ERR</code> exception
       instead of returning a <code><a href="#database">Database</a></code> object if the request
       violates a policy decision (e.g. if the user agent is configured
       to not allow the page to open databases).</p>
   
      </li>
   
      <li>
   
       <p>For the method on the <code>Window</code> object: let <var title="">origin</var> be the <span>origin</span> of the
       <span>active document</span> of the <span>browsing context</span>
       of the <code>Window</code> object on which the method was
       invoked.</p>
   
       <p>For the methods on the <code>WorkerUtils</code> object: let
       <var title="">origin</var> be the <span>origin</span> of the
       scripts in the worker.</p>
   
      </li>
   
      <li><p>If the database version provided is not the empty string,
      and there is already a database with the given name from the origin
      <var title="">origin</var>, but the database has a different
      version than the version provided, then throw an
      <code>INVALID_STATE_ERR</code> exception and abort these
      steps.</li>
   
      <li>
   
       <p>If no database with the given name from the origin <var title="">origin</var> exists, then create the database and let
       <var title="">created</var> be true. If a callback was passed to
       the method, then set the new database's version to the empty
       string. Otherwise, set the new database's version to the given
       database version.</p>
   
       <p>Otherwise, if a database with the given name already exists,
       let <var title="">created</var> be false.</p>
   
      </li>
   
      <li>
   
       <p>For the <code title="dom-opendatabase"><a href="#dom-opendatabase">openDatabase()</a></code>
       methods: let <var title="">result</var> be a newly constructed
       <code><a href="#database">Database</a></code> object representing the database with the
       given database name from the origin <var title="">origin</var>.</p>
   
       <p>For the <code title="dom-opendatabase-sync"><a href="#dom-opendatabase-sync">openDatabaseSync()</a></code> method:
       let <var title="">result</var> be a newly constructed
       <code><a href="#databasesync">DatabaseSync</a></code> object representing the database with
       the given database name from the origin <var title="">origin</var>.</p>
   
      </li>
   
      <li>
   
       <p>If <var title="">created</var> is false or if no callback was
       passed to the method, skip this step. Otherwise:</p>
   
       <p>For the <code title="dom-opendatabase"><a href="#dom-opendatabase">openDatabase()</a></code>
       methods: <span>queue a task</span> to to invoke the callback with
       <var title="">result</var> as its only argument.</p>
   
       <p>For the <code title="dom-opendatabase-sync"><a href="#dom-opendatabase-sync">openDatabaseSync()</a></code> method:
       invoke the callback with <var title="">result</var> as its only
       argument. If the callback throws an exception, rethrow that
       exception and abort these steps.</p>
   
      </li>
   
      <li>
   
       <p>Return <var title="">result</var>.</p>
   
      </li>
   
     </ol><p>All strings including the empty string are valid database
   names. Database names must be compared in a    names. Database names must be compared in a
   <span>case-sensitive</span> manner.<p class="note">Implementations can support this even in    <span>case-sensitive</span> manner.<p class="note">Implementations can support this even in
   environments that only support a subset of all strings as database    environments that only support a subset of all strings as database
   names by mapping database names (e.g. using a hashing algorithm) to    names by mapping database names (e.g. using a hashing algorithm) to
   the supported set of names.<p>If the database version provided is not the empty string, and the    the supported set of names.<p>The version that the database was opened with is the <dfn id="concept-database-expected-version" title="concept-database-expected-version">expected version</dfn> of
   database already exists but has a different version, or no version,  
   then the method must raise an <code>INVALID_STATE_ERR</code>  
   exception.<p>The version that the database was opened with is the <dfn id="concept-database-expected-version" title="concept-database-expected-version">expected version</dfn> of  
   this <code><a href="#database">Database</a></code> or <code><a href="#databasesync">DatabaseSync</a></code> object. It    this <code><a href="#database">Database</a></code> or <code><a href="#databasesync">DatabaseSync</a></code> object. It
   can be the empty string, in which case there is no expected version    can be the empty string, in which case there is no expected version
   &mdash; any version is fine.<p>Otherwise, if the database version provided is the empty string,    &mdash; any version is fine.<p>User agents are expected to use the display name and the
   or if the database doesn't yet exist, or if the database exists and  
   the version requested is the same as the current version associated  
   with the database, then the method must return an object  
   representing the database that has the name that was given. If no  
   such database exists, it must be created first.<p>The user agent may raise a <code>SECURITY_ERR</code> exception  
   instead of returning a <code><a href="#database">Database</a></code> object if the request  
   violates a policy decision (e.g. if the user agent is configured to  
   not allow the page to open databases).<p>User agents are expected to use the display name and the  
   estimated database size to optimize the user experience. For    estimated database size to optimize the user experience. For
   example, a user agent could use the estimated size to suggest an    example, a user agent could use the estimated size to suggest an
   initial quota to the user. This allows a site that is aware that it    initial quota to the user. This allows a site that is aware that it
Line 430  interface <span>WorkerUtilsDatabase</spa Line 532  interface <span>WorkerUtilsDatabase</spa
   
     <p>The result is <var title="">the statement</var>.</p>      <p>The result is <var title="">the statement</var>.</p>
   
     <p class="XXX">Implementation feedback is requested on what  
     to do with arguments that are of types that are not supported by  
     the underlying SQL backend. For example, SQLite doesn't support  
     booleans, so what should the UA do if passed a boolean? The Gears  
     team suggests failing, not silently converting types.</p>  
   
    </li>     </li>
   
    <li><p>If the <code><a href="#database">Database</a></code> object that the     <li><p>If the <code><a href="#database">Database</a></code> object that the
Line 488  interface <span>WorkerUtilsDatabase</spa Line 584  interface <span>WorkerUtilsDatabase</spa
   example, attempts to read from or write to the file system will    example, attempts to read from or write to the file system will
   fail.<p class="note">A future version of this specification will probably    fail.<p class="note">A future version of this specification will probably
   define the exact SQL subset required in more detail.<h3 id="asynchronous-database-api"><span class="secno">4.3 </span>Asynchronous database API</h3><pre class="idl">interface <dfn id="database">Database</dfn> {    define the exact SQL subset required in more detail.<h3 id="asynchronous-database-api"><span class="secno">4.3 </span>Asynchronous database API</h3><pre class="idl">interface <dfn id="database">Database</dfn> {
   void <a href="#dom-database-transaction" title="dom-database-transaction">transaction</a>(in <a href="#sqltransactioncallback">SQLTransactionCallback</a> callback, optional in <a href="#sqltransactionerrorcallback">SQLTransactionErrorCallback</a> errorCallback, optional in <a href="#sqlvoidcallback">SQLVoidCallback</a> successCallback);    void <a href="#dom-database-transaction" title="dom-database-transaction">transaction</a>(in <a href="#sqltransactioncallback">SQLTransactionCallback</a> callback, in optional <a href="#sqltransactionerrorcallback">SQLTransactionErrorCallback</a> errorCallback, in optional <a href="#sqlvoidcallback">SQLVoidCallback</a> successCallback);
   void <a href="#dom-database-readtransaction" title="dom-database-readTransaction">readTransaction</a>(in <a href="#sqltransactioncallback">SQLTransactionCallback</a> callback, optional in <a href="#sqltransactionerrorcallback">SQLTransactionErrorCallback</a> errorCallback, optional in <a href="#sqlvoidcallback">SQLVoidCallback</a> successCallback);    void <a href="#dom-database-readtransaction" title="dom-database-readTransaction">readTransaction</a>(in <a href="#sqltransactioncallback">SQLTransactionCallback</a> callback, in optional <a href="#sqltransactionerrorcallback">SQLTransactionErrorCallback</a> errorCallback, in optional <a href="#sqlvoidcallback">SQLVoidCallback</a> successCallback);
   
   readonly attribute DOMString <a href="#dom-database-version" title="dom-database-version">version</a>;    readonly attribute DOMString <a href="#dom-database-version" title="dom-database-version">version</a>;
   void <a href="#dom-database-changeversion" title="dom-database-changeVersion">changeVersion</a>(in DOMString oldVersion, in DOMString newVersion, in <a href="#sqltransactioncallback">SQLTransactionCallback</a> callback, in <a href="#sqltransactionerrorcallback">SQLTransactionErrorCallback</a> errorCallback, in <a href="#sqlvoidcallback">SQLVoidCallback</a> successCallback);    void <a href="#dom-database-changeversion" title="dom-database-changeVersion">changeVersion</a>(in DOMString oldVersion, in DOMString newVersion, in optional <a href="#sqltransactioncallback">SQLTransactionCallback</a> callback, in optional <a href="#sqltransactionerrorcallback">SQLTransactionErrorCallback</a> errorCallback, in optional <a href="#sqlvoidcallback">SQLVoidCallback</a> successCallback);
 };  };
   
 [Callback=FunctionOnly, NoInterfaceObject]  [Callback=FunctionOnly, NoInterfaceObject]
Line 541  interface <dfn id="sqltransactionerrorca Line 637  interface <dfn id="sqltransactionerrorca
    the value of the second argument to the <code title="dom-database-changeVersion"><a href="#dom-database-changeversion">changeVersion()</a></code>     the value of the second argument to the <code title="dom-database-changeVersion"><a href="#dom-database-changeversion">changeVersion()</a></code>
    method.</li>     method.</li>
   
   </ol><p>...and the <i>mode</i> being read/write.<h4 id="executing-sql-statements"><span class="secno">4.3.1 </span>Executing SQL statements</h4><p>The <code title="dom-database-transaction"><a href="#dom-database-transaction">transaction()</a></code>,    </ol><p>...and the <i>mode</i> being read/write.<p>If any of the optional arguments are omitted, then they must be
     treated as if they were null.<h4 id="executing-sql-statements"><span class="secno">4.3.1 </span>Executing SQL statements</h4><p>The <code title="dom-database-transaction"><a href="#dom-database-transaction">transaction()</a></code>,
   <code title="dom-database-readTransaction"><a href="#dom-database-readtransaction">readTransaction()</a></code>,    <code title="dom-database-readTransaction"><a href="#dom-database-readtransaction">readTransaction()</a></code>,
   and <code title="dom-database-changeVersion"><a href="#dom-database-changeversion">changeVersion()</a></code>    and <code title="dom-database-changeVersion"><a href="#dom-database-changeversion">changeVersion()</a></code>
   methods invoke callbacks with <code><a href="#sqltransaction">SQLTransaction</a></code>    methods invoke callbacks with <code><a href="#sqltransaction">SQLTransaction</a></code>
   objects.<pre class="idl">typedef sequence&lt;any&gt; <dfn id="objectarray">ObjectArray</dfn>;    objects.<pre class="idl">typedef sequence&lt;any&gt; <dfn id="objectarray">ObjectArray</dfn>;
   
 interface <dfn id="sqltransaction">SQLTransaction</dfn> {  interface <dfn id="sqltransaction">SQLTransaction</dfn> {
   void <a href="#dom-sqltransaction-executesql" title="dom-sqltransaction-executeSql">executeSql</a>(in DOMString sqlStatement, optional in <a href="#objectarray">ObjectArray</a> arguments, optional in <a href="#sqlstatementcallback">SQLStatementCallback</a> callback, optional in <a href="#sqlstatementerrorcallback">SQLStatementErrorCallback</a> errorCallback);    void <a href="#dom-sqltransaction-executesql" title="dom-sqltransaction-executeSql">executeSql</a>(in DOMString sqlStatement, in optional <a href="#objectarray">ObjectArray</a> arguments, in optional <a href="#sqlstatementcallback">SQLStatementCallback</a> callback, in optional <a href="#sqlstatementerrorcallback">SQLStatementErrorCallback</a> errorCallback);
 };  };
   
 [Callback=FunctionOnly, NoInterfaceObject]  [Callback=FunctionOnly, NoInterfaceObject]
Line 611  interface <dfn id="sqlstatementerrorcall Line 708  interface <dfn id="sqlstatementerrorcall
    to the last step. (This is basically a hook for the <code title="dom-database-changeVersion"><a href="#dom-database-changeversion">changeVersion()</a></code>     to the last step. (This is basically a hook for the <code title="dom-database-changeVersion"><a href="#dom-database-changeversion">changeVersion()</a></code>
    method.)</li>     method.)</li>
   
    <li><p><span>Queue a task</span> to invoke the <i>transaction     <li><p>If the <i>transaction callback</i> is not null, <span>queue
    callback</i> with the aforementioned <code><a href="#sqltransaction">SQLTransaction</a></code>     a task</span> to invoke the <i>transaction callback</i> with the
    object as its only argument, and wait for that task to be     aforementioned <code><a href="#sqltransaction">SQLTransaction</a></code> object as its only
    run.</li>     argument, and wait for that task to be run.</li>
   
    <li><p>If the callback couldn't be called (e.g. it was null), or if     <li><p>If the callback raised an exception, jump to the last
    the callback was invoked and raised an exception, jump to the last  
    step.</li>     step.</li>
 <!--  
    <li><p>If the callback could be called and returned false, let  
    <i>callback-canceled</i> be true. Otherwise, let it be  
    false.</p></li>  
 -->  
    <li><p>While there are any statements queued up in the transaction,     <li><p>While there are any statements queued up in the transaction,
    perform the following steps for each queued up statement in the     perform the following steps for each queued up statement in the
    transaction, oldest first. Each statement has a statement,     transaction, oldest first. Each statement has a statement,
Line 642  interface <dfn id="sqlstatementerrorcall Line 734  interface <dfn id="sqlstatementerrorcall
      <li><p>Create a <code><a href="#sqlresultset">SQLResultSet</a></code> object that represents       <li><p>Create a <code><a href="#sqlresultset">SQLResultSet</a></code> object that represents
      the result of the statement.</li>       the result of the statement.</li>
   
      <li><p>If the statement has a result set callback, <span>queue a       <li><p>If the statement has a result set callback that is not
      task</span> to invoke it with the <code><a href="#sqltransaction">SQLTransaction</a></code>       null, <span>queue a task</span> to invoke it with the
      object as its first argument and the new       <code><a href="#sqltransaction">SQLTransaction</a></code> object as its first argument and the
      <code><a href="#sqlresultset">SQLResultSet</a></code> object as its second argument, and wait       new <code><a href="#sqlresultset">SQLResultSet</a></code> object as its second argument, and
      for that task to be run.</li>       wait for that task to be run.</li>
   
      <li><p>If the callback was invoked and raised an exception, jump       <li><p>If the callback was invoked and raised an exception, jump
      to the last step in the overall steps.</li>       to the last step in the overall steps.</li>
Line 658  interface <dfn id="sqlstatementerrorcall Line 750  interface <dfn id="sqlstatementerrorcall
     say to jump to the "in case of error" steps), run the following      say to jump to the "in case of error" steps), run the following
     substeps:</p>      substeps:</p>
   
     <ol><li><p>If the statement had an associated error callback, then      <ol><li><p>If the statement had an associated error callback that is
      <span>queue a task</span> to invoke that error callback with the       not null, then <span>queue a task</span> to invoke that error
      <code><a href="#sqltransaction">SQLTransaction</a></code> object and a newly constructed       callback with the <code><a href="#sqltransaction">SQLTransaction</a></code> object and a newly
      <code><a href="#sqlerror">SQLError</a></code> object that represents the error that       constructed <code><a href="#sqlerror">SQLError</a></code> object that represents the
      caused these substeps to be run as the two arguments,       error that caused these substeps to be run as the two arguments,
      respectively, and wait for the task to be run.</li>       respectively, and wait for the task to be run.</li>
   
      <li><p>If the error callback returns false, then move on to the       <li><p>If the error callback returns false, then move on to the
Line 675  interface <dfn id="sqlstatementerrorcall Line 767  interface <dfn id="sqlstatementerrorcall
   
     </ol></li>      </ol></li>
   
    <li><p>If a <i>postflight operation</i> was defined for this     <li>
    instance of the transaction steps, run that. If it fails, then jump  
    to the last step. <!--The operation, if any, might depend  
    <i>callback-canceled</i>.--> (This is basically a hook for the  
    <code title="dom-database-changeVersion"><a href="#dom-database-changeversion">changeVersion()</a></code>  
    method.)</li>  
   
    <li><p>Commit the transaction.</li>      <p>If a <i>postflight operation</i> was defined for this instance
       of the transaction steps, then: as one atomic operation, commit
       the transaction and run the <i>postflight operation</i>. If either
       fails, then do neither, and instead jump to the last step. (This
       is basically a hook for the <code title="dom-database-changeVersion"><a href="#dom-database-changeversion">changeVersion()</a></code>
       method.)</p>
   
       <p>Otherwise: commit the transaction and run the <i>postflight
       operation</i>. If an error occurred in the committing of the
       transaction, jump to the last step.</p>
   
    <li><p>If an error occurred in the committing of the transaction,     </li>
    jump to the last step.</li>  
   
    <li><p><span>Queue a task</span> to invoke the <i>success     <li><p><span>Queue a task</span> to invoke the <i>success
    callback</i>.</li>     callback</i>, if it is not null.</li>
   
    <li><p>End these steps. The next step is only used when something     <li><p>End these steps. The next step is only used when something
    goes wrong.</li>     goes wrong.</li>
   
    <li><p><span>Queue a task</span> to invoke the <i>error     <li><p><span>Queue a task</span> to invoke the <i>error
    callback</i> with a newly constructed <code><a href="#sqlerror">SQLError</a></code> object     callback</i>, if it is not null, with a newly constructed
    that represents the last error to have occurred in this     <code><a href="#sqlerror">SQLError</a></code> object that represents the last error to have
    transaction. Rollback the transaction. Any still-pending statements     occurred in this transaction. Rollback the transaction. Any
    in the transaction are discarded.</li>     still-pending statements in the transaction are discarded.</li>
   
   </ol><p>The <span>task source</span> for these tasks is the <dfn id="database-access-task-source">database    </ol><p>The <span>task source</span> for these <span title="concept-task">tasks</span> is the <dfn id="database-access-task-source">database access task
   access task source</dfn>.<h3 id="synchronous-database-api"><span class="secno">4.4 </span>Synchronous database API</h3><pre class="idl">interface <dfn id="databasesync">DatabaseSync</dfn> {    source</dfn>.<h3 id="synchronous-database-api"><span class="secno">4.4 </span>Synchronous database API</h3><pre class="idl">interface <dfn id="databasesync">DatabaseSync</dfn> {
   void <a href="#dom-database-sync-transaction" title="dom-database-sync-transaction">transaction</a>(in <a href="#sqltransactionsynccallback">SQLTransactionSyncCallback</a> callback);    void <a href="#dom-database-sync-transaction" title="dom-database-sync-transaction">transaction</a>(in <a href="#sqltransactionsynccallback">SQLTransactionSyncCallback</a> callback);
   void <a href="#dom-database-sync-readtransaction" title="dom-database-sync-readTransaction">readTransaction</a>(in <a href="#sqltransactionsynccallback">SQLTransactionSyncCallback</a> callback);    void <a href="#dom-database-sync-readtransaction" title="dom-database-sync-readTransaction">readTransaction</a>(in <a href="#sqltransactionsynccallback">SQLTransactionSyncCallback</a> callback);
   
   readonly attribute DOMString <a href="#dom-database-sync-version" title="dom-database-sync-version">version</a>;    readonly attribute DOMString <a href="#dom-database-sync-version" title="dom-database-sync-version">version</a>;
   void <a href="#dom-database-sync-changeversion" title="dom-database-sync-changeVersion">changeVersion</a>(in DOMString oldVersion, in DOMString newVersion, in <a href="#sqltransactionsynccallback">SQLTransactionSyncCallback</a> callback);    void <a href="#dom-database-sync-changeversion" title="dom-database-sync-changeVersion">changeVersion</a>(in DOMString oldVersion, in DOMString newVersion, in optional <a href="#sqltransactionsynccallback">SQLTransactionSyncCallback</a> callback);
 };  };
   
 [Callback=FunctionOnly, NoInterfaceObject]  [Callback=FunctionOnly, NoInterfaceObject]
Line 759  interface <dfn id="sqltransactionsynccal Line 854  interface <dfn id="sqltransactionsynccal
    these steps. (<a href="#dom-sqlerror-code-2" title="dom-sqlerror-code-2">Error code     these steps. (<a href="#dom-sqlerror-code-2" title="dom-sqlerror-code-2">Error code
    2</a>.)</li>     2</a>.)</li>
   
    <li><p>If the third argument is null, rollback the transaction,     <li><p>If the third argument is not null, invoke the callback given
    throw a <code><a href="#sqlexception">SQLException</a></code> exception, and abort these steps.     by the third argument, passing it the <var title="">transaction</var> object as its only argument.</li>
    (<a href="#dom-sqlerror-code-0" title="dom-sqlerror-code-0">Error code  
    0</a>.)</li>  
   
    <li><p>Invoke the callback given by the third argument, passing it  
    the <var title="">transaction</var> object as its only  
    argument.</li>  
   
    <li><p>Mark the <code><a href="#sqltransactionsync">SQLTransactionSync</a></code> object as <i title="">stale</i>.</p>     <li><p>Mark the <code><a href="#sqltransactionsync">SQLTransactionSync</a></code> object as <i title="">stale</i>.</p>
   
Line 809  interface <dfn id="sqltransactionsynccal Line 898  interface <dfn id="sqltransactionsynccal
   
   </ol><h4 id="executing-sql-statements-0"><span class="secno">4.4.1 </span>Executing SQL statements</h4><p>The <code title="dom-database-sync-transaction"><a href="#dom-database-sync-transaction">transaction()</a></code>, <code title="dom-database-sync-readTransaction"><a href="#dom-database-sync-readtransaction">readTransaction()</a></code>,    </ol><h4 id="executing-sql-statements-0"><span class="secno">4.4.1 </span>Executing SQL statements</h4><p>The <code title="dom-database-sync-transaction"><a href="#dom-database-sync-transaction">transaction()</a></code>, <code title="dom-database-sync-readTransaction"><a href="#dom-database-sync-readtransaction">readTransaction()</a></code>,
   and <code title="dom-database-sync-changeVersion"><a href="#dom-database-sync-changeversion">changeVersion()</a></code>    and <code title="dom-database-sync-changeVersion"><a href="#dom-database-sync-changeversion">changeVersion()</a></code>
   methods return <code><a href="#sqltransactionsync">SQLTransactionSync</a></code> objects.<pre class="idl">// typedef sequence&lt;any&gt; <a href="#objectarray">ObjectArray</a>;    methods invoke callbacks that are passed
     <code><a href="#sqltransactionsync">SQLTransactionSync</a></code> objects.<pre class="idl">// typedef sequence&lt;any&gt; <a href="#objectarray">ObjectArray</a>;
   
 interface <dfn id="sqltransactionsync">SQLTransactionSync</dfn> {  interface <dfn id="sqltransactionsync">SQLTransactionSync</dfn> {
   <a href="#sqlresultset">SQLResultSet</a> <a href="#dom-sqltransaction-sync-executesql" title="dom-sqltransaction-sync-executeSql">executeSql</a>(in DOMString sqlStatement, optional in <a href="#objectarray">ObjectArray</a> arguments);    <a href="#sqlresultset">SQLResultSet</a> <a href="#dom-sqltransaction-sync-executesql" title="dom-sqltransaction-sync-executeSql">executeSql</a>(in DOMString sqlStatement, in optional <a href="#objectarray">ObjectArray</a> arguments);
 };</pre><p>A <code><a href="#sqltransactionsync">SQLTransactionSync</a></code> object is initially <i title="">fresh</i>, but it will be marked as <i title="">stale</i>  };</pre><p>A <code><a href="#sqltransactionsync">SQLTransactionSync</a></code> object is initially <i title="">fresh</i>, but it will be marked as <i title="">stale</i>
   once it has been committed or rolled back.<p>When the <dfn id="dom-sqltransaction-sync-executesql" title="dom-sqltransaction-sync-executeSql"><code>executeSql(<var title="">sqlStatement</var>, <var title="">arguments</var>)</code></dfn> method is invoked, the user    once it has been committed or rolled back.<p>When the <dfn id="dom-sqltransaction-sync-executesql" title="dom-sqltransaction-sync-executeSql"><code>executeSql(<var title="">sqlStatement</var>, <var title="">arguments</var>)</code></dfn> method is invoked, the user
   agent must run the following algorithm:<ol><li><p>If the <code><a href="#sqltransactionsync">SQLTransactionSync</a></code> object is <i title="">stale</i>, then throw an <code>INVALID_STATE_ERR</code>    agent must run the following algorithm:<ol><li><p>If the <code><a href="#sqltransactionsync">SQLTransactionSync</a></code> object is <i title="">stale</i>, then throw an <code>INVALID_STATE_ERR</code>
Line 900  interface <dfn id="sqltransactionsync">S Line 990  interface <dfn id="sqltransactionsync">S
   const unsigned short <a href="#dom-sqlexception-code-timeout" title="dom-SQLException-code-TIMEOUT">TIMEOUT_ERR</a> = 7;    const unsigned short <a href="#dom-sqlexception-code-timeout" title="dom-SQLException-code-TIMEOUT">TIMEOUT_ERR</a> = 7;
   readonly attribute unsigned short <a href="#dom-sqlerror-code" title="dom-SQLError-code">code</a>;    readonly attribute unsigned short <a href="#dom-sqlerror-code" title="dom-SQLError-code">code</a>;
   readonly attribute DOMString <a href="#dom-sqlerror-message" title="dom-SQLError-message">message</a>;    readonly attribute DOMString <a href="#dom-sqlerror-message" title="dom-SQLError-message">message</a>;
 };</pre><p>The <dfn id="dom-sqlerror-code" title="dom-SQLError-code"><code>code</code></dfn> DOM  };</pre><p>The <dfn id="dom-sqlerror-code" title="dom-SQLError-code"><code>code</code></dfn> IDL
   attribute must return the most appropriate code from the table    attribute must return the most appropriate code from the table
   below.<p>The <dfn id="dom-sqlerror-message" title="dom-SQLError-message"><code>message</code></dfn>    below.<p>The <dfn id="dom-sqlerror-message" title="dom-SQLError-message"><code>message</code></dfn>
   DOM attribute must return an error message describing the error    IDL attribute must return an error message describing the error
   encountered. The message should be localized to the user's    encountered. The message should be localized to the user's
   language.<hr><p>Errors in the synchronous database API are reported using    language.<hr><p>Errors in the synchronous database API are reported using
   <code><a href="#sqlexception">SQLException</a></code> exceptions:<pre class="idl">exception <dfn id="sqlexception">SQLException</dfn> {    <code><a href="#sqlexception">SQLException</a></code> exceptions:<pre class="idl">exception <dfn id="sqlexception">SQLException</dfn> {
Line 918  interface <dfn id="sqltransactionsync">S Line 1008  interface <dfn id="sqltransactionsync">S
   unsigned short <a href="#dom-sqlexception-code" title="dom-SQLException-code">code</a>;    unsigned short <a href="#dom-sqlexception-code" title="dom-SQLException-code">code</a>;
   DOMString <a href="#dom-sqlexception-message" title="dom-SQLException-message">message</a>;    DOMString <a href="#dom-sqlexception-message" title="dom-SQLException-message">message</a>;
 };</pre><p>The <dfn id="dom-sqlexception-code" title="dom-SQLException-code"><code>code</code></dfn>  };</pre><p>The <dfn id="dom-sqlexception-code" title="dom-SQLException-code"><code>code</code></dfn>
   DOM attribute must return the most appropriate code from the table    IDL attribute must return the most appropriate code from the table
   below.<p>The <dfn id="dom-sqlexception-message" title="dom-SQLException-message"><code>message</code></dfn> DOM    below.<p>The <dfn id="dom-sqlexception-message" title="dom-SQLException-message"><code>message</code></dfn> IDL
   attribute must return an error message describing the error    attribute must return an error message describing the error
   encountered. The message should be localized to the user's    encountered. The message should be localized to the user's
   language.<hr><p>The error codes are as follows:<table><thead><tr><th>Constant    language.<hr><p>The error codes are as follows:<table><thead><tr><th>Constant
Line 978  interface <dfn id="sqltransactionsync">S Line 1068  interface <dfn id="sqltransactionsync">S
      <td>A lock for the transaction could not be obtained in a       <td>A lock for the transaction could not be obtained in a
      reasonable time.       reasonable time.
   
   </table><h2 id="disk-space"><span class="secno">5 </span>Disk space</h2><p>User agents should limit the total amount of space allowed for    </table><h2 id="web-sql"><span class="secno">5 </span>Web SQL</h2><p class="XXX">Need to define the SQL dialect.<h2 id="disk-space"><span class="secno">6 </span>Disk space</h2><p>User agents should limit the total amount of space allowed for
   databases.    databases.
       
   <p>User agents should guard against sites storing data under the    <p>User agents should guard against sites storing data under the
Line 991  interface <dfn id="sqltransactionsync">S Line 1081  interface <dfn id="sqltransactionsync">S
   is using.<p>A mostly arbitrary limit of five megabytes per    is using.<p>A mostly arbitrary limit of five megabytes per
   <span>origin</span> is recommended. Implementation feedback is    <span>origin</span> is recommended. Implementation feedback is
   welcome and will be used to update this suggestion in the    welcome and will be used to update this suggestion in the
   future.<h2 id="privacy"><span class="secno">6 </span>Privacy</h2><h3 id="user-tracking"><span class="secno">6.1 </span>User tracking</h3><p>A third-party advertiser (or any entity capable of getting    future.<h2 id="privacy"><span class="secno">7 </span>Privacy</h2><h3 id="user-tracking"><span class="secno">7.1 </span>User tracking</h3><p>A third-party advertiser (or any entity capable of getting
   content distributed to multiple sites) could use a unique identifier    content distributed to multiple sites) could use a unique identifier
   stored in its    stored in its
   client-side database    client-side database
Line 1030  interface <dfn id="sqltransactionsync">S Line 1120  interface <dfn id="sqltransactionsync">S
   
     <p>However, this also puts the user's data at risk.</p>      <p>However, this also puts the user's data at risk.</p>
   
     <!-- XXX should there be an explicit way for sites to state when      <!--v2 consider adding an explicit way for sites to state when
     data should expire? as in      data should expire, as in  localStorage.expireData(365); -->
     localStorage.expireData(365); ? -->  
   
    </dd>     </dd>
   
    <dt>Treating persistent storage as cookies</dt>     <dt>Treating persistent storage as cookies</dt>
    <dd>     <dd>
   
     <p>User agents should present the      <p>If users attempt to protect their privacy by clearing cookies
     database feature      without also clearing data stored in the
   
       database
           
     to the user in a way that does not distinguish them from HTTP  
     session cookies. <a href="#refsRFC2109">[RFC2109]</a> <a href="#refsCOOKIES">[COOKIES]</a></p>  
   
     <p>This might encourage users to view such storage with healthy      feature, sites can defeat those attempts by using the two features
     suspicion.</p>      as redundant backup for each other. User agents should present the
       interfaces for clearing these in a way that helps users to
       understand this possibility and enables them to delete data in all
       persistent storage features simultaneously. <a href="#refsCOOKIES">[COOKIES]</a></p>
   
    </dd>     </dd>
   
Line 1103  interface <dfn id="sqltransactionsync">S Line 1195  interface <dfn id="sqltransactionsync">S
   retroactively). This information can then be shared with other    retroactively). This information can then be shared with other
   sites, using using visitors' IP addresses and other user-specific    sites, using using visitors' IP addresses and other user-specific
   data (e.g. user-agent headers and configuration settings) to combine    data (e.g. user-agent headers and configuration settings) to combine
   separate sessions into coherent user profiles.<h3 id="cookie-resurrection"><span class="secno">6.2 </span>Cookie resurrection</h3><p>If the user interface for persistent storage presents data in the    separate sessions into coherent user profiles.<h3 id="sensitivity-of-data"><span class="secno">7.2 </span>Sensitivity of data</h3><p>User agents should treat persistently stored data as potentially
   persistent storage features described in this specification    sensitive; it's quite possible for e-mails, calendar appointments,
   separately from data in HTTP session cookies, then users are likely    health records, or other confidential documents to be stored in this
   to delete data in one and not the other. This would allow sites to    mechanism.<p>To this end, user agents should ensure that when deleting data,
   use the two features as redundant backup for each other, defeating a    it is promptly deleted from the underlying storage.<h2 id="security"><span class="secno">8 </span>Security</h2><h3 id="dns-spoofing-attacks"><span class="secno">8.1 </span>DNS spoofing attacks</h3><p>Because of the potential for DNS spoofing attacks, one cannot
   user's attempts to protect his privacy.<h2 id="security"><span class="secno">7 </span>Security</h2><h3 id="dns-spoofing-attacks"><span class="secno">7.1 </span>DNS spoofing attacks</h3><p>Because of the potential for DNS spoofing attacks, one cannot  
   guarantee that a host claiming to be in a certain domain really is    guarantee that a host claiming to be in a certain domain really is
   from that domain. To mitigate this, pages can use SSL. Pages using    from that domain. To mitigate this, pages can use SSL. Pages using
   SSL can be sure that only pages using SSL that have certificates    SSL can be sure that only pages using SSL that have certificates
   identifying them as being from the same domain can access their    identifying them as being from the same domain can access their
   databases.    databases.
       
   <h3 id="cross-directory-attacks"><span class="secno">7.2 </span>Cross-directory attacks</h3><p>Different authors sharing one host name, for example users    <h3 id="cross-directory-attacks"><span class="secno">8.2 </span>Cross-directory attacks</h3><p>Different authors sharing one host name, for example users
   hosting content on <code>geocities.com</code>, all share one    hosting content on <code>geocities.com</code>, all share one
   set of databases.    set of databases.
       
Line 1125  interface <dfn id="sqltransactionsync">S Line 1216  interface <dfn id="sqltransactionsync">S
   and overwrite it.<p class="note">Even if a path-restriction feature was made    and overwrite it.<p class="note">Even if a path-restriction feature was made
   available, the usual DOM scripting security model would make it    available, the usual DOM scripting security model would make it
   trivial to bypass this protection and access the data from any    trivial to bypass this protection and access the data from any
   path.<h3 id="implementation-risks"><span class="secno">7.3 </span>Implementation risks</h3><p>The two primary risks when implementing these persistent storage    path.<h3 id="implementation-risks"><span class="secno">8.3 </span>Implementation risks</h3><p>The two primary risks when implementing these persistent storage
   features are letting hostile sites read information from other    features are letting hostile sites read information from other
   domains, and letting hostile sites write information that is then    domains, and letting hostile sites write information that is then
   read from other domains.<p>Letting third-party sites read data that is not supposed to be    read from other domains.<p>Letting third-party sites read data that is not supposed to be
Line 1139  interface <dfn id="sqltransactionsync">S Line 1230  interface <dfn id="sqltransactionsync">S
   user's wishlist; or a hostile site could set a user's session    user's wishlist; or a hostile site could set a user's session
   identifier to a known ID that the hostile site can then use to track    identifier to a known ID that the hostile site can then use to track
   the user's actions on the victim site.<p>Thus, strictly following the <span>origin</span> model described    the user's actions on the victim site.<p>Thus, strictly following the <span>origin</span> model described
   in this specification is important for user security.<h3 id="sql-and-user-agents"><span class="secno">7.4 </span>SQL and user agents</h3><p>User agent implementors are strongly encouraged to audit all    in this specification is important for user security.<h3 id="sql-and-user-agents"><span class="secno">8.4 </span>SQL and user agents</h3><p>User agent implementors are strongly encouraged to audit all
   their supported SQL statements for security implications. For    their supported SQL statements for security implications. For
   example, <code title="">LOAD DATA INFILE</code> is likely to pose    example, <code title="">LOAD DATA INFILE</code> is likely to pose
   security risks and there is little reason to support it.<p>In general, it is recommended that user agents not support    security risks and there is little reason to support it.<p>In general, it is recommended that user agents not support
   features that control how databases are stored on disk. For example,    features that control how databases are stored on disk. For example,
   there is little reason to allow Web authors to control the character    there is little reason to allow Web authors to control the character
   encoding used in the disk representation of the data, as all data in    encoding used in the disk representation of the data, as all data in
   JavaScript is implicitly UTF-16.<h3 id="sql-injection"><span class="secno">7.5 </span>SQL injection</h3><p>Authors are strongly recommended to make use of the <code title="">?</code> placeholder feature of the <code title="dom-sqltransaction-executeSql"><a href="#dom-sqltransaction-executesql">executeSql()</a></code> method,    JavaScript is implicitly UTF-16.<h3 id="sql-injection"><span class="secno">8.5 </span>SQL injection</h3><p>Authors are strongly recommended to make use of the <code title="">?</code> placeholder feature of the <code title="dom-sqltransaction-executeSql"><a href="#dom-sqltransaction-executesql">executeSql()</a></code> method,
   and to never construct SQL statements on the fly.<h2 class="no-num" id="references">References</h2><p>All references are normative unless marked "Non-normative".<dl><dt id="refsCOOKIES">[COOKIES]</dt>    and to never construct SQL statements on the fly.</p><!--START vCard--><!--START vEvent--><h2 class="no-num" id="references">References</h2><!--REFS--><!--END vCard--><!--END vEvent--><p>All references are normative unless marked "Non-normative".</p><!--START vCard--><!--START vEvent--><dl><dt id="refsCOOKIES">[COOKIES]</dt>
    <!--     <!--
    <dd><cite><a href="http://www.ietf.org/rfc/rfc2965.txt">HTTP State Management     <dd><cite><a href="http://www.ietf.org/rfc/rfc2965.txt">HTTP State Management
    Mechanism</a></cite>, D. Kristol, L. Montulli. IETF, October 2000.</dd>     Mechanism</a></cite>, D. Kristol, L. Montulli. IETF, October 2000.</dd>
Line 1171  interface <dfn id="sqltransactionsync">S Line 1262  interface <dfn id="sqltransactionsync">S
   
    <dt id="refsHTML5">[HTML5]</dt>     <dt id="refsHTML5">[HTML5]</dt>
    <!--     <!--
    <dd><cite><a href="http://www.w3.org/TR/html5/">HTML 5</a></cite>,     <dd><cite><a href="http://www.w3.org/TR/html5/">HTML5</a></cite>,
    I. Hickson, D. Hyatt. W3C, April 2009.</dd>     I. Hickson, D. Hyatt. W3C, April 2009.</dd>
    <dd><cite><a href="http://www.w3.org/html/wg/html5/">HTML     <dd><cite><a
    5</a></cite>, I. Hickson, D. Hyatt. W3C, August 2009.</dd>     href="http://www.w3.org/html/wg/html5/">HTML5</a></cite>,
      I. Hickson, D. Hyatt. W3C, August 2009.</dd>
    -->     -->
    <dd><cite><a href="http://www.whatwg.org/specs/web-apps/current-work/">HTML     <dd><cite><a href="http://www.whatwg.org/specs/web-apps/current-work/">HTML5</a></cite>,
    5</a></cite>, I. Hickson. WHATWG, August 2009.</dd>     I. Hickson. WHATWG, August 2009.</dd>
   
    <dt id="refsRFC2109">[RFC2109]</dt>  
    <dd><cite><a href="http://www.ietf.org/rfc/rfc2109.txt">HTTP State Management  
    Mechanism</a></cite>, D. Kristol, L. Montulli. IETF, February 1997.</dd>  
   
    <dt id="refsRFC2119">[RFC2119]</dt>     <dt id="refsRFC2119">[RFC2119]</dt>
    <dd><cite><a href="http://www.ietf.org/rfc/rfc2119.txt">Key words for use in     <dd><cite><a href="http://www.ietf.org/rfc/rfc2119.txt">Key words for use in
Line 1199  interface <dfn id="sqltransactionsync">S Line 1287  interface <dfn id="sqltransactionsync">S
    <dd><cite><a href="http://dev.w3.org/2006/webapi/WebIDL/">Web     <dd><cite><a href="http://dev.w3.org/2006/webapi/WebIDL/">Web
    IDL</a></cite>, C. McCormack. W3C, July 2009.</dd>     IDL</a></cite>, C. McCormack. W3C, July 2009.</dd>
   
   </dl>    </dl><!--END vCard--><!--END vEvent-->

Removed from v.1.11  
changed lines
  Added in v.1.36


Webmaster