The deleteObjectStore(name ) method, when invoked, must run these steps:
- Let database be the database associated with this connection .
+ Let database be the database associated with this connection .
- Let transaction be the upgrade transaction associated with database . If one does not exist or it is finished , throw an "InvalidStateError
" DOMException
.
+ Let transaction be database ’s upgrade transaction if it is not null, or throw an "InvalidStateError
" DOMException
otherwise.
If transaction is not active , throw a
"TransactionInactiveError
" DOMException
.
@@ -3403,8 +3405,8 @@ Destroy store .
- This method destroys the object store with the given name in the connected database . Note that this method must only be called
-from within an upgrade transaction .
+ This method destroys the object store with the given name in the connected database . Note that this method must only be called
+from within an upgrade transaction .
This method synchronously modifies the objectStoreNames
property on the IDBDatabase
instance on which it was called.
This method destroys the index with the given name in the object store . Note that this method must only be called from
-within an upgrade transaction .
+within an upgrade transaction .
This method synchronously modifies the indexNames
property on the IDBObjectStore
instance on which it was called.
Although this method does not return an IDBRequest
object, the
index destruction itself is processed as an asynchronous request
-within the upgrade transaction .
+within the upgrade transaction .
4.6. The IDBIndex
interface
The IDBIndex
interface represents an index handle .
[Exposed =(Window ,Worker )]
@@ -4253,7 +4255,7 @@ name = newName
Updates the name of the store to newName .
- Throws an "InvalidStateError
" DOMException
if not called within an upgrade
+ Throws an "InvalidStateError
" DOMException
if not called within an upgrade
transaction .
index . objectStore
Returns the IDBObjectStore
the index belongs to.
@@ -4269,9 +4271,9 @@ index handle 's name .
Is this the same as the index 's name ?
- As long as the transaction has not finished ,
- this is the same as the associated index 's name . But once the transaction has finished , this attribute will not reflect changes made with a
- later upgrade transaction .
+ As long as the transaction has not finished ,
+ this is the same as the associated index 's name . But once the transaction has finished , this attribute will not reflect changes made with a
+ later upgrade transaction .
The name
attribute’s setter must run these steps:
@@ -4283,7 +4285,7 @@
Let index be this index handle 's index .
- If transaction is not an upgrade transaction , throw an "InvalidStateError
" DOMException
.
+ If transaction is not an upgrade transaction , throw an "InvalidStateError
" DOMException
.
If transaction is not active , throw a
"TransactionInactiveError
" DOMException
.
@@ -5083,11 +5085,11 @@
transaction . objectStoreNames
Returns a list of the names of object stores in the
- transaction’s scope . For an upgrade transaction this is all object stores in the database .
+ transaction’s scope . For an upgrade transaction this is all object stores in the database .
transaction . mode
Returns the mode the transaction was created with
("readonly"
or "readwrite"
), or "versionchange"
for
- an upgrade transaction .
+ an upgrade transaction .
transaction . db
Returns the transaction’s connection .
transaction . error
@@ -5099,7 +5101,7 @@ objectStoreNames attribute’s getter must run these steps:
- If this transaction is an upgrade transaction ,
+
If this transaction is an upgrade transaction ,
return a DOMStringList
associated with a sorted name list of the names of the object stores in this transaction 's connection 's object store
set .
@@ -5112,12 +5114,12 @@ The contents of each list returned by this attribute does not
- change, but subsequent calls to this attribute during an upgrade
+ change, but subsequent calls to this attribute during an upgrade
transaction can return lists with different contents as object stores are created and deleted.
The mode attribute’s getter
must return the mode of the transaction .
The db attribute’s getter must
-return the database connection of which this transaction is a part.
+return the database connection of which this transaction is a part.
The error attribute’s getter
must return this transaction 's error , or null if
none.
@@ -5142,7 +5144,7 @@
- If transaction has finished , throw an
+
If transaction has finished , throw an
"InvalidStateError
" DOMException
.
Let store be the object store named name in this transaction 's scope , or throw a
@@ -5160,7 +5162,7 @@
- If this transaction is finished , throw an "InvalidStateError
" DOMException
.
+ If this transaction is finished , throw an "InvalidStateError
" DOMException
.
Unset the transaction 's active flag and run the
steps to abort a transaction with null as error .
@@ -5181,7 +5183,7 @@ 5.
The steps to open a database are as follows.
The algorithm in these steps takes four arguments:
-the origin which requested the database to be opened, a
+the origin which requested the database to be opened, a
database name , a database version , and a request .
@@ -5191,11 +5193,11 @@ 5.
Wait until all previous requests in queue have been processed.
- Let db be the database named name in origin , or null otherwise.
+ Let db be the database named name in origin , or null otherwise.
If version is undefined, let version be 1 if db is null, or db ’s version otherwise.
- If db is null, let db be a new database with name name , version 0 (zero), and with
+
If db is null, let db be a new database with name name , version 0 (zero), and with
no object stores . If this fails for any reason, return an
appropriate error (e.g. a "QuotaExceededError
" or
"UnknownError
" DOMException
).
@@ -5232,7 +5234,7 @@ 5.
If connection was closed , create and
return a newly created "AbortError
" DOMException
and abort these steps.
- If the upgrade transaction was aborted, run the steps
+
If the upgrade transaction was aborted, run the steps
to close a database connection with connection ,
create and return a newly created "AbortError
" DOMException
and abort these steps.
@@ -5270,12 +5272,12 @@
created using connection . All methods that create transactions first check the close pending flag first and throw an exception if it is set.
+ a given database to be closed before continuing.
5.3. Deleting a database
The steps to delete a database are as follows. The
algorithm in these steps takes three arguments: the origin that
-requested the database to be deleted, a database name , and a request .
+requested the
database to be deleted, a database
name , and a
request .
Let queue be the connection queue for origin and name .
@@ -5284,7 +5286,7 @@
Wait until all previous requests in queue have been processed.
- Let db be the database named name in origin , if one exists. Otherwise, return 0 (zero).
+ Let db be the database named name in origin , if one exists. Otherwise, return 0 (zero).
Let openConnections be the set of all connections associated with db .
@@ -5315,16 +5317,18 @@ transaction to commit.
- All the changes made to the database by transaction are
-written to the database .
+ All the changes made to the database by transaction are
+written to the database .
- If an error occurs while writing the changes to the database , abort the transaction by following the steps
+
If an error occurs while writing the changes to the database , abort the transaction by following the steps
to abort a transaction with transaction and an
appropriate for the error, for example "QuotaExceededError
" or
"UnknownError
" DOMException
.
Queue a task to run these steps:
+
+ If transaction is an upgrade transaction , set the database 's upgrade transaction to null.
Fire an event named complete
at transaction .
Even if an exception is thrown from one of the event handlers of
@@ -5345,7 +5349,7 @@ transaction to abort, and error .
- All the changes made to the database by the transaction are reverted. For upgrade transactions this includes changes
+
All the changes made to the database by the transaction are reverted. For upgrade transactions this includes changes
to the set of object stores and indexes , as well as the
change to the version . Any object stores and indexes which were created during the transaction are now
considered deleted for the purposes of other algorithms.
@@ -5377,10 +5381,12 @@
Queue a task to run these steps:
+
+ If transaction is an upgrade transaction , set the database 's upgrade transaction to null.
Fire an event named abort
at transaction with its bubbles
attribute initialized to true.
- If transaction is an upgrade transaction , then
+
If transaction is an upgrade transaction , then
let request be the request associated with transaction and set request ’s transaction to null.
@@ -5448,19 +5454,21 @@
The steps to run an upgrade transaction are as
follows. This algorithm takes three arguments: a connection object
-which is used to update the database , a new version to be set
-for the database , and a request .
+which is used to update the database , a new version to be set
+for the database , and a request .
- Let db be connection ’s database .
+ Let db be connection ’s database .
+
+ Let transaction be a new upgrade transaction with connection used as connection . The scope of transaction includes every object store in connection .
- Let transaction be a new upgrade transaction with connection used as connection . The scope of transaction includes every object store in connection .
+ Set database ’s upgrade transaction to transaction .
Unset transaction ’s active flag .
Start transaction .
+ other connections can be opened to the same database .
Let old version be db ’s version .
@@ -5488,24 +5496,24 @@ with the error property set to a newly created "AbortError
" DOMException
.
- Wait for transaction to finish .
+ Wait for transaction to finish .
+ include steps specific to upgrade transactions .
5.8. Aborting an upgrade transaction
The steps to abort an upgrade transaction with transaction are as follows.
Let connection be transaction ’s connection .
- Let database be connection ’s database .
+ Let database be connection ’s database .
Set connection ’s version to database ’s version if database previously existed, or 0 (zero)
if database was newly created.
@@ -5551,8 +5559,8 @@
+ not modified, even if the aborted upgrade transaction was
+ creating a new database .
5.9. Firing a success event
To fire a success event at a request ,
@@ -5625,7 +5633,7 @@
6. Database operations
- This section describes various operations done on the data in object stores and indexes in a database .
+
This section describes various operations done on the data in object stores and indexes in a database .
These operations are run by the steps to asynchronously execute
a request .
Invocations of StructuredDeserialize () in the operation
@@ -6687,8 +6695,9 @@ asynchronously execute a request steps.
(issue #192 )
- Use [HTML] 's StructuredSerializeForStorage hook.
-(issue #197 , issue #152 )
+ Define database 's associated upgrade transaction to
+align exceptions thrown from createObjectStore()
and deleteObjectStore()
with tests and implementations.
+(issue #192 )
11. Acknowledgements
Special thanks to Nikunj Mehta, the original author of the first
@@ -7229,7 +7238,12 @@
unique flag, in §2.6
update(value) , in §4.8
upgradeneeded , in §2.8.1
- upgrade transaction , in §2.7.2
+
+ upgrade transaction
+
upper , in §4.7
upper bound , in §2.9
upperBound(upper) , in §4.7
@@ -7634,27 +7648,28 @@ I
+
@@ -8315,24 +8339,24 @@ I