blob: 6588ba24136ae8839e664430c22477e63a6b5b5b [file] [log] [blame]
Test that specifying a version when opening a non-existent db causes an upgradeneeded event and that the version number is set correctly.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
dbname = "intversion-open-with-version.html"
indexedDB.deleteDatabase(dbname)
Should trigger:
4.1.4: If no database with the given name from the origin origin was found, or if it was deleted during the previous step, then create a database with name name, with 0 as version, and with no object stores. Let db be the new database.
4.1.6: Create a new connection to db and let connection represent it.
4.1.7: If the version of db is lower than version, then run the steps for running a "versionchange" transaction using connection, version, request and upgrade callback.
4.1.9: Return connection.
request = indexedDB.open(dbname, 7)
PASS String(request) is "[object IDBOpenDBRequest]"
PASS In the upgradeneeded event hander:
Test 4.8.9.1:
db = event.target.result
PASS String(db) is "[object IDBDatabase]"
Test 4.8.9.3:
PASS event.oldVersion is 0
PASS event.newVersion is 7
PASS event.target.readyState is "done"
Test 4.1.4:
PASS db.name is dbname
PASS db.version is 7
PASS db.objectStoreNames.length is 0
transaction = event.target.transaction
PASS String(transaction) is "[object IDBTransaction]"
os = db.createObjectStore("someOS")
sawTransactionComplete = true
openSuccess():
Test 4.1.7, that a versionchange transaction was run.
PASS sawUpgradeNeeded is true
PASS sawTransactionComplete is true
db = event.target.result
Kind of test 4.1.9:
PASS String(db) is "[object IDBDatabase]"
PASS db.version is 7
PASS successfullyParsed is true
TEST COMPLETE