Describe transaction mode using enum. Resolves bug 16513
authorJoshua bell <jsbell@google.com>
Thu, 28 Feb 2013 14:41:46 -0800
changeset 389f3d40c6295ac
parent 388 491f7580e4bd
child 390 bf71413d740c
Describe transaction mode using enum. Resolves bug 16513
Overview.html
Speclet_020_IDB_API_Constructs.html
Speclet_022_IDB_API_Synchronous_APIs.html
Speclet_023_IDB_API_Asynchronous_APIs.html
     1.1 --- a/Overview.html	Thu Feb 28 11:33:27 2013 -0800
     1.2 +++ b/Overview.html	Thu Feb 28 14:41:46 2013 -0800
     1.3 @@ -783,28 +783,36 @@
     1.4              Transactions are opened in one of three <dfn title="mode">modes</dfn>. The mode
     1.5              determines how concurrent access to <a>object store</a>s in the transaction are isolated.
     1.6            </p>
     1.7 -          <ol>
     1.8 -            <li><code><dfn>"readonly"</dfn></code>. This mode means that the transaction is only allowed
     1.9 -            to read data. No modifications can be done by this type of transaction. This has the advantage
    1.10 -            that several <code>"readonly"</code> transactions can run at the same time even if their <a>scope</a>s
    1.11 -            are overlapping, i.e. if they are using the same object stores. This type of transaction can
    1.12 -            be created any time once a database has been opened using the <a>IDBDatabase.transaction()</a> or
    1.13 -            <a>IDBDatabaseSync.transaction()</a> functions.</li>
    1.14 -            <li><code><dfn>"readwrite"</dfn></code>. The type of transaction is allowed to read, modify and
    1.15 -            delete data from existing object stores. However object stores and indexes can't be added or removed.
    1.16 -            Multiple <code>"readwrite"</code> transactions can't run at the same time if their <a>scope</a>s are overlapping
    1.17 -            since that would mean that they can modify each other's data in the middle of the transaction.
    1.18 -            This type of transaction can be created any time once a database has been opened using the
    1.19 -            <a>IDBDatabase.transaction()</a> function.</li>
    1.20 -            <li><code><dfn>"versionchange"</dfn></code>. This is similar to a <code>"readwrite"</code> transaction,
    1.21 -            however it can additionally create and remove object stores and indexes. It is the only type of
    1.22 -            transaction that can do so. This type of transaction can't be manually created, but instead is created
    1.23 -            automatically when a <a><code>upgradeneeded</code></a> event is fired.</li>
    1.24 -          </ol>
    1.25 -          
    1.26 -          <p>
    1.27 -            The this is defined in more detail below.
    1.28 -          </p>
    1.29 +
    1.30 +          <dl class="idl" title="enum TransactionMode">
    1.31 +            <dt>readonly</dt>
    1.32 +            <dd>
    1.33 +                This mode means that the transaction is only allowed
    1.34 +                to read data. No modifications can be done by this type of transaction. This has the advantage
    1.35 +                that several <code>"readonly"</code> transactions can run at the same time even if their <a>scope</a>s
    1.36 +                are overlapping, i.e. if they are using the same object stores. This type of transaction can
    1.37 +                be created any time once a database has been opened using the <a>IDBDatabase.transaction()</a> or
    1.38 +                <a>IDBDatabaseSync.transaction()</a> functions.
    1.39 +            </dd>
    1.40 +
    1.41 +            <dt>readwrite</dt>
    1.42 +            <dd>
    1.43 +                The type of transaction is allowed to read, modify and
    1.44 +                delete data from existing object stores. However object stores and indexes can't be added or removed.
    1.45 +                Multiple <code>"readwrite"</code> transactions can't run at the same time if their <a>scope</a>s are overlapping
    1.46 +                since that would mean that they can modify each other's data in the middle of the transaction.
    1.47 +                This type of transaction can be created any time once a database has been opened using the
    1.48 +                <a>IDBDatabase.transaction()</a> function.
    1.49 +            </dd>
    1.50 +
    1.51 +            <dt>versionchange</dt>
    1.52 +            <dd>
    1.53 +                This is similar to a <code>"readwrite"</code> transaction,
    1.54 +                however it can additionally create and remove object stores and indexes. It is the only type of
    1.55 +                transaction that can do so. This type of transaction can't be manually created, but instead is created
    1.56 +                automatically when a <a><code>upgradeneeded</code></a> event is fired.
    1.57 +            </dd>
    1.58 +          </dl>
    1.59  
    1.60            <p>
    1.61              Any number of transactions opened in <a><code>"readonly"</code></a> mode are allowed to run concurrently,
    1.62 @@ -1846,9 +1854,6 @@
    1.63                  returned by the steps above.
    1.64                </p>
    1.65                <p>
    1.66 -              	If the value for the <var>mode</var> parameter is invalid, this method MUST throw a JavaScript <code>TypeError</code> exception.
    1.67 -              </p>
    1.68 -              <p>
    1.69                  If this method is called on <a>IDBDatabase</a> object for which a <code>"versionchange"</code>
    1.70                  transaction is still running, a <a>InvalidStateError</a> exception MUST be thrown. I.e. if a
    1.71                  <code>"versionchange"</code> transaction is started when a database is opened and this method is
    1.72 @@ -1862,7 +1867,7 @@
    1.73                  <dd>The names of <a title="object store">object stores</a> and 
    1.74                  <a title="index">indexes</a> in the <a>scope</a> of the new
    1.75                  <a>transaction</a></dd>
    1.76 -                <dt>optional DOMString mode</dt>
    1.77 +                <dt>optional TransactionMode mode</dt>
    1.78                  <dd> The <a>mode</a> for isolating access to data inside the given
    1.79                  <a title="object store">object stores</a>. If this parameter is not provided, the default
    1.80                  access <a>mode</a> is <code>"readonly"</code>.</dd>
    1.81 @@ -1874,8 +1879,6 @@
    1.82                  </dd>
    1.83                  <dt>NotFoundError</dt>
    1.84                  <dd>One of the names provided in the <var>storeNames</var> argument doesn't exist in this <a>database</a>.</dd>
    1.85 -                <dt>TypeError</dt>
    1.86 -                <dd>The value for the <a>mode</a> parameter is invalid.</dd>
    1.87                  <dt>InvalidAccessError</dt>
    1.88                  <dd>The function was called with an empty list of store names</dd>
    1.89                </dl>
    1.90 @@ -2755,7 +2758,7 @@
    1.91              <a title="transaction">Transaction</a> objects implement the following interface:
    1.92            </p>
    1.93            <dl class="idl" title="interface IDBTransaction : EventTarget">
    1.94 -            <dt>readonly attribute enum  mode</dt>
    1.95 +            <dt>readonly attribute TransactionMode mode</dt>
    1.96              <dd>On getting, provide the <a>mode</a> for isolating access to data inside
    1.97              the <a title="object store">object stores</a> that are in the
    1.98              <a>scope</a> of the <a>transaction</a>.</dd>
    1.99 @@ -3115,9 +3118,6 @@
   1.100                  returned by the steps above.
   1.101                </p>
   1.102                <p>
   1.103 -              	If the value for the <var>mode</var> parameter is invalid, this method MUST throw a JavaScript <code>TypeError</code> exception.
   1.104 -              </p>
   1.105 -              <p>
   1.106                  This method MUST throw an <code>DOMException</code> of type <a>InvalidStateError</a> 
   1.107                  when it is called within the <a>IDBTransactionCallback</a> of a <code>transaction</code> method or the
   1.108                  <a>IDBVersionChangeCallback</a> of a <code>open</code> method.
   1.109 @@ -3130,7 +3130,7 @@
   1.110                  <dt>IDBTransactionCallback callback</dt>
   1.111                  <dd>A callback which will be called with the newly created transaction. When the callback returns,
   1.112                    the transaction is committed.</dd>
   1.113 -                <dt>optional DOMString mode</dt>
   1.114 +                <dt>optional TransactionMode mode</dt>
   1.115                  <dd>
   1.116                      The <a>mode</a> for isolating access to data inside the given
   1.117                      <a title="object store">object stores</a>. If this parameter is not provided, the default
   1.118 @@ -3155,8 +3155,6 @@
   1.119                    <a>IDBVersionChangeCallback</a> of a <code>open</code> method.</dd>
   1.120                  <dt>NotFoundError</dt>
   1.121                  <dd>One of the names provided in the <var>storeNames</var> argument doesn't exist in this <a>database</a>.</dd>
   1.122 -                <dt>TypeError</dt>
   1.123 -                <dd>The value for the <a>mode</a> parameter is invalid.</dd>
   1.124                  <dt>InvalidAccessError</dt>
   1.125                  <dd>The function was called with an empty list of store names</dd>
   1.126                </dl>
   1.127 @@ -4183,7 +4181,7 @@
   1.128              to reserve the required <a>database</a> <a>objects</a>.
   1.129            </p>
   1.130            <dl class="idl" title="interface IDBTransactionSync">
   1.131 -            <dt>readonly attribute DOMString mode</dt>
   1.132 +            <dt>readonly attribute TransactionMode mode</dt>
   1.133              <dd>On getting, provide the <a>mode</a> for isolating access to data inside
   1.134              the <a title="object store">object stores</a> that are in the
   1.135              <a>scope</a> of the <a>transaction</a>.</dd>
     2.1 --- a/Speclet_020_IDB_API_Constructs.html	Thu Feb 28 11:33:27 2013 -0800
     2.2 +++ b/Speclet_020_IDB_API_Constructs.html	Thu Feb 28 14:41:46 2013 -0800
     2.3 @@ -561,28 +561,36 @@
     2.4              Transactions are opened in one of three <dfn title="mode">modes</dfn>. The mode
     2.5              determines how concurrent access to <a>object store</a>s in the transaction are isolated.
     2.6            </p>
     2.7 -          <ol>
     2.8 -            <li><code><dfn>"readonly"</dfn></code>. This mode means that the transaction is only allowed
     2.9 -            to read data. No modifications can be done by this type of transaction. This has the advantage
    2.10 -            that several <code>"readonly"</code> transactions can run at the same time even if their <a>scope</a>s
    2.11 -            are overlapping, i.e. if they are using the same object stores. This type of transaction can
    2.12 -            be created any time once a database has been opened using the <a>IDBDatabase.transaction()</a> or
    2.13 -            <a>IDBDatabaseSync.transaction()</a> functions.</li>
    2.14 -            <li><code><dfn>"readwrite"</dfn></code>. The type of transaction is allowed to read, modify and
    2.15 -            delete data from existing object stores. However object stores and indexes can't be added or removed.
    2.16 -            Multiple <code>"readwrite"</code> transactions can't run at the same time if their <a>scope</a>s are overlapping
    2.17 -            since that would mean that they can modify each other's data in the middle of the transaction.
    2.18 -            This type of transaction can be created any time once a database has been opened using the
    2.19 -            <a>IDBDatabase.transaction()</a> function.</li>
    2.20 -            <li><code><dfn>"versionchange"</dfn></code>. This is similar to a <code>"readwrite"</code> transaction,
    2.21 -            however it can additionally create and remove object stores and indexes. It is the only type of
    2.22 -            transaction that can do so. This type of transaction can't be manually created, but instead is created
    2.23 -            automatically when a <a><code>upgradeneeded</code></a> event is fired.</li>
    2.24 -          </ol>
    2.25 -          
    2.26 -          <p>
    2.27 -            The this is defined in more detail below.
    2.28 -          </p>
    2.29 +
    2.30 +          <dl class="idl" title="enum TransactionMode">
    2.31 +            <dt>readonly</dt>
    2.32 +            <dd>
    2.33 +                This mode means that the transaction is only allowed
    2.34 +                to read data. No modifications can be done by this type of transaction. This has the advantage
    2.35 +                that several <code>"readonly"</code> transactions can run at the same time even if their <a>scope</a>s
    2.36 +                are overlapping, i.e. if they are using the same object stores. This type of transaction can
    2.37 +                be created any time once a database has been opened using the <a>IDBDatabase.transaction()</a> or
    2.38 +                <a>IDBDatabaseSync.transaction()</a> functions.
    2.39 +            </dd>
    2.40 +
    2.41 +            <dt>readwrite</dt>
    2.42 +            <dd>
    2.43 +                The type of transaction is allowed to read, modify and
    2.44 +                delete data from existing object stores. However object stores and indexes can't be added or removed.
    2.45 +                Multiple <code>"readwrite"</code> transactions can't run at the same time if their <a>scope</a>s are overlapping
    2.46 +                since that would mean that they can modify each other's data in the middle of the transaction.
    2.47 +                This type of transaction can be created any time once a database has been opened using the
    2.48 +                <a>IDBDatabase.transaction()</a> function.
    2.49 +            </dd>
    2.50 +
    2.51 +            <dt>versionchange</dt>
    2.52 +            <dd>
    2.53 +                This is similar to a <code>"readwrite"</code> transaction,
    2.54 +                however it can additionally create and remove object stores and indexes. It is the only type of
    2.55 +                transaction that can do so. This type of transaction can't be manually created, but instead is created
    2.56 +                automatically when a <a><code>upgradeneeded</code></a> event is fired.
    2.57 +            </dd>
    2.58 +          </dl>
    2.59  
    2.60            <p>
    2.61              Any number of transactions opened in <a><code>"readonly"</code></a> mode are allowed to run concurrently,
     3.1 --- a/Speclet_022_IDB_API_Synchronous_APIs.html	Thu Feb 28 11:33:27 2013 -0800
     3.2 +++ b/Speclet_022_IDB_API_Synchronous_APIs.html	Thu Feb 28 14:41:46 2013 -0800
     3.3 @@ -387,9 +387,6 @@
     3.4                  returned by the steps above.
     3.5                </p>
     3.6                <p>
     3.7 -              	If the value for the <var>mode</var> parameter is invalid, this method MUST throw a JavaScript <code>TypeError</code> exception.
     3.8 -              </p>
     3.9 -              <p>
    3.10                  This method MUST throw an <code>DOMException</code> of type <a>InvalidStateError</a> 
    3.11                  when it is called within the <a>IDBTransactionCallback</a> of a <code>transaction</code> method or the
    3.12                  <a>IDBVersionChangeCallback</a> of a <code>open</code> method.
    3.13 @@ -402,7 +399,7 @@
    3.14                  <dt>IDBTransactionCallback callback</dt>
    3.15                  <dd>A callback which will be called with the newly created transaction. When the callback returns,
    3.16                    the transaction is committed.</dd>
    3.17 -                <dt>optional DOMString mode</dt>
    3.18 +                <dt>optional TransactionMode mode</dt>
    3.19                  <dd>
    3.20                      The <a>mode</a> for isolating access to data inside the given
    3.21                      <a title="object store">object stores</a>. If this parameter is not provided, the default
    3.22 @@ -427,8 +424,6 @@
    3.23                    <a>IDBVersionChangeCallback</a> of a <code>open</code> method.</dd>
    3.24                  <dt>NotFoundError</dt>
    3.25                  <dd>One of the names provided in the <var>storeNames</var> argument doesn't exist in this <a>database</a>.</dd>
    3.26 -                <dt>TypeError</dt>
    3.27 -                <dd>The value for the <a>mode</a> parameter is invalid.</dd>
    3.28                  <dt>InvalidAccessError</dt>
    3.29                  <dd>The function was called with an empty list of store names</dd>
    3.30                </dl>
    3.31 @@ -1455,7 +1450,7 @@
    3.32              to reserve the required <a>database</a> <a>objects</a>.
    3.33            </p>
    3.34            <dl class="idl" title="interface IDBTransactionSync">
    3.35 -            <dt>readonly attribute DOMString mode</dt>
    3.36 +            <dt>readonly attribute TransactionMode mode</dt>
    3.37              <dd>On getting, provide the <a>mode</a> for isolating access to data inside
    3.38              the <a title="object store">object stores</a> that are in the
    3.39              <a>scope</a> of the <a>transaction</a>.</dd>
     4.1 --- a/Speclet_023_IDB_API_Asynchronous_APIs.html	Thu Feb 28 11:33:27 2013 -0800
     4.2 +++ b/Speclet_023_IDB_API_Asynchronous_APIs.html	Thu Feb 28 14:41:46 2013 -0800
     4.3 @@ -535,9 +535,6 @@
     4.4                  returned by the steps above.
     4.5                </p>
     4.6                <p>
     4.7 -              	If the value for the <var>mode</var> parameter is invalid, this method MUST throw a JavaScript <code>TypeError</code> exception.
     4.8 -              </p>
     4.9 -              <p>
    4.10                  If this method is called on <a>IDBDatabase</a> object for which a <code>"versionchange"</code>
    4.11                  transaction is still running, a <a>InvalidStateError</a> exception MUST be thrown. I.e. if a
    4.12                  <code>"versionchange"</code> transaction is started when a database is opened and this method is
    4.13 @@ -551,7 +548,7 @@
    4.14                  <dd>The names of <a title="object store">object stores</a> and 
    4.15                  <a title="index">indexes</a> in the <a>scope</a> of the new
    4.16                  <a>transaction</a></dd>
    4.17 -                <dt>optional DOMString mode</dt>
    4.18 +                <dt>optional TransactionMode mode</dt>
    4.19                  <dd> The <a>mode</a> for isolating access to data inside the given
    4.20                  <a title="object store">object stores</a>. If this parameter is not provided, the default
    4.21                  access <a>mode</a> is <code>"readonly"</code>.</dd>
    4.22 @@ -563,8 +560,6 @@
    4.23                  </dd>
    4.24                  <dt>NotFoundError</dt>
    4.25                  <dd>One of the names provided in the <var>storeNames</var> argument doesn't exist in this <a>database</a>.</dd>
    4.26 -                <dt>TypeError</dt>
    4.27 -                <dd>The value for the <a>mode</a> parameter is invalid.</dd>
    4.28                  <dt>InvalidAccessError</dt>
    4.29                  <dd>The function was called with an empty list of store names</dd>
    4.30                </dl>
    4.31 @@ -1444,7 +1439,7 @@
    4.32              <a title="transaction">Transaction</a> objects implement the following interface:
    4.33            </p>
    4.34            <dl class="idl" title="interface IDBTransaction : EventTarget">
    4.35 -            <dt>readonly attribute enum  mode</dt>
    4.36 +            <dt>readonly attribute TransactionMode mode</dt>
    4.37              <dd>On getting, provide the <a>mode</a> for isolating access to data inside
    4.38              the <a title="object store">object stores</a> that are in the
    4.39              <a>scope</a> of the <a>transaction</a>.</dd>