Modern IDB: Make storage/indexeddb/modern tests more modern.
https://bugs.webkit.org/show_bug.cgi?id=153284

Reviewed by Alex Christensen.

* storage/indexeddb/modern/abort-requests-cancelled-expected.txt:
* storage/indexeddb/modern/aborted-put-expected.txt:
* storage/indexeddb/modern/autoincrement-abort-expected.txt:
* storage/indexeddb/modern/basic-add-expected.txt:
* storage/indexeddb/modern/basic-put-expected.txt:
* storage/indexeddb/modern/create-index-failures-expected.txt:
* storage/indexeddb/modern/createobjectstore-basic-expected.txt:
* storage/indexeddb/modern/createobjectstore-failures-expected.txt:
* storage/indexeddb/modern/cursor-1-expected.txt:
* storage/indexeddb/modern/cursor-2-expected.txt:
* storage/indexeddb/modern/cursor-3-expected.txt:
* storage/indexeddb/modern/cursor-4-expected.txt:
* storage/indexeddb/modern/cursor-5-expected.txt:
* storage/indexeddb/modern/cursor-6-expected.txt:
* storage/indexeddb/modern/cursor-7-expected.txt:
* storage/indexeddb/modern/cursor-8-expected.txt:
* storage/indexeddb/modern/date-basic-expected.txt:
* storage/indexeddb/modern/deletedatabase-1-expected.txt:
* storage/indexeddb/modern/deletedatabase-2-expected.txt:
* storage/indexeddb/modern/deleteindex-1-expected.txt:
* storage/indexeddb/modern/deleteindex-2-expected.txt:
* storage/indexeddb/modern/deleteobjectstore-1-expected.txt:
* storage/indexeddb/modern/double-abort-expected.txt:
* storage/indexeddb/modern/get-index-failures-expected.txt:
* storage/indexeddb/modern/get-keyrange-expected.txt:
* storage/indexeddb/modern/idbdatabase-deleteobjectstore-failures-expected.txt:
* storage/indexeddb/modern/idbdatabase-transaction-failures-expected.txt:
* storage/indexeddb/modern/idbindex-properties-basic-expected.txt:
* storage/indexeddb/modern/idbobjectstore-clear-1-expected.txt:
* storage/indexeddb/modern/idbobjectstore-clear-2-expected.txt:
* storage/indexeddb/modern/idbobjectstore-count-1-expected.txt:
* storage/indexeddb/modern/idbobjectstore-count-failures-expected.txt:
* storage/indexeddb/modern/idbobjectstore-delete-1-expected.txt:
* storage/indexeddb/modern/idbobjectstore-delete-2-expected.txt:
* storage/indexeddb/modern/idbobjectstore-delete-failures-expected.txt:
* storage/indexeddb/modern/idbobjectstore-get-failures-expected.txt:
* storage/indexeddb/modern/idbobjectstore-put-and-clear-failures-expected.txt:
* storage/indexeddb/modern/idbtransaction-objectstore-failures-expected.txt:
* storage/indexeddb/modern/index-1-expected.txt:
* storage/indexeddb/modern/index-2-expected.txt:
* storage/indexeddb/modern/index-3-expected.txt:
* storage/indexeddb/modern/index-4-expected.txt:
* storage/indexeddb/modern/index-5-expected.txt:
* storage/indexeddb/modern/index-cursor-1-expected.txt:
* storage/indexeddb/modern/index-cursor-2-expected.txt:
* storage/indexeddb/modern/index-cursor-3-expected.txt:
* storage/indexeddb/modern/index-get-count-basic-expected.txt:
* storage/indexeddb/modern/index-get-count-failures-expected.txt:
* storage/indexeddb/modern/keypath-basic-expected.txt:
* storage/indexeddb/modern/objectstore-attributes-expected.txt:
* storage/indexeddb/modern/objectstore-cursor-advance-failures-expected.txt:
* storage/indexeddb/modern/objectstore-cursor-continue-failures-expected.txt:
* storage/indexeddb/modern/opencursor-failures-expected.txt:
* storage/indexeddb/modern/opendatabase-success-after-versionchange-expected.txt:
* storage/indexeddb/modern/opendatabase-versions-expected.txt:
* storage/indexeddb/modern/resources/abort-requests-cancelled.js:
* storage/indexeddb/modern/resources/aborted-put.js:
* storage/indexeddb/modern/resources/autoincrement-abort.js:
* storage/indexeddb/modern/resources/basic-add.js:
* storage/indexeddb/modern/resources/basic-put.js:
* storage/indexeddb/modern/resources/create-index-failures.js:
* storage/indexeddb/modern/resources/createobjectstore-basic.js:
* storage/indexeddb/modern/resources/createobjectstore-failures.js:
* storage/indexeddb/modern/resources/cursor-1.js:
* storage/indexeddb/modern/resources/cursor-2.js:
* storage/indexeddb/modern/resources/cursor-3.js:
* storage/indexeddb/modern/resources/cursor-4.js:
* storage/indexeddb/modern/resources/cursor-5.js:
* storage/indexeddb/modern/resources/cursor-6.js:
* storage/indexeddb/modern/resources/cursor-7.js:
* storage/indexeddb/modern/resources/cursor-8.js:
* storage/indexeddb/modern/resources/date-basic.js:
* storage/indexeddb/modern/resources/deletedatabase-1.js:
* storage/indexeddb/modern/resources/deletedatabase-2.js:
* storage/indexeddb/modern/resources/deletedatabase-null-name-exception.js:
* storage/indexeddb/modern/resources/deletedatabase-request-event.js:
* storage/indexeddb/modern/resources/deletedatabase-request.js:
* storage/indexeddb/modern/resources/deleteindex-1.js:
* storage/indexeddb/modern/resources/deleteindex-2.js:
* storage/indexeddb/modern/resources/deleteobjectstore-1.js:
* storage/indexeddb/modern/resources/double-abort.js:
* storage/indexeddb/modern/resources/double-open.js:
* storage/indexeddb/modern/resources/get-index-failures.js:
* storage/indexeddb/modern/resources/get-keyrange.js:
* storage/indexeddb/modern/resources/idbdatabase-deleteobjectstore-failures.js:
* storage/indexeddb/modern/resources/idbdatabase-transaction-failures.js:
* storage/indexeddb/modern/resources/idbindex-properties-basic.js:
* storage/indexeddb/modern/resources/idbobjectstore-clear-1.js:
* storage/indexeddb/modern/resources/idbobjectstore-clear-2.js:
* storage/indexeddb/modern/resources/idbobjectstore-count-1.js:
* storage/indexeddb/modern/resources/idbobjectstore-count-failures.js:
* storage/indexeddb/modern/resources/idbobjectstore-delete-1.js:
* storage/indexeddb/modern/resources/idbobjectstore-delete-2.js:
* storage/indexeddb/modern/resources/idbobjectstore-delete-failures.js:
* storage/indexeddb/modern/resources/idbobjectstore-get-failures.js:
* storage/indexeddb/modern/resources/idbobjectstore-put-and-clear-failures.js:
* storage/indexeddb/modern/resources/idbtransaction-objectstore-failures.js:
* storage/indexeddb/modern/resources/index-1.js:
* storage/indexeddb/modern/resources/index-2.js:
* storage/indexeddb/modern/resources/index-3.js:
* storage/indexeddb/modern/resources/index-4.js:
* storage/indexeddb/modern/resources/index-5.js:
* storage/indexeddb/modern/resources/index-cursor-1.js:
* storage/indexeddb/modern/resources/index-cursor-2.js:
* storage/indexeddb/modern/resources/index-cursor-3.js:
* storage/indexeddb/modern/resources/index-get-count-basic.js:
* storage/indexeddb/modern/resources/index-get-count-failures.js:
* storage/indexeddb/modern/resources/keypath-basic.js:
* storage/indexeddb/modern/resources/objectstore-attributes.js:
* storage/indexeddb/modern/resources/objectstore-cursor-advance-failures.js:
* storage/indexeddb/modern/resources/objectstore-cursor-continue-failures.js:
* storage/indexeddb/modern/resources/opencursor-failures.js:
* storage/indexeddb/modern/resources/opendatabase-request-event.js:
* storage/indexeddb/modern/resources/opendatabase-request.js:
* storage/indexeddb/modern/resources/opendatabase-success-after-versionchange.js:
* storage/indexeddb/modern/resources/opendatabase-versions.js:
* storage/indexeddb/modern/resources/request-readystate.js:
* storage/indexeddb/modern/resources/transaction-scheduler-1.js:
* storage/indexeddb/modern/resources/transaction-scheduler-2.js:
* storage/indexeddb/modern/resources/transaction-scheduler-3.js:
* storage/indexeddb/modern/resources/transaction-scheduler-5.js:
* storage/indexeddb/modern/resources/transaction-scheduler-6.js:
* storage/indexeddb/modern/resources/versionchange-abort-then-reopen.js:
* storage/indexeddb/modern/resources/versionchange-event.js:
* storage/indexeddb/modern/transaction-scheduler-1-expected.txt:
* storage/indexeddb/modern/transaction-scheduler-2-expected.txt:
* storage/indexeddb/modern/transaction-scheduler-3-expected.txt:
* storage/indexeddb/modern/transaction-scheduler-5-expected.txt:
* storage/indexeddb/modern/transaction-scheduler-6-expected.txt:
* storage/indexeddb/modern/versionchange-abort-then-reopen-expected.txt:
* storage/indexeddb/modern/versionchange-event-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@195380 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 1d6cbed..0b9925b 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,142 @@
+2016-01-20  Brady Eidson  <beidson@apple.com>
+
+        Modern IDB: Make storage/indexeddb/modern tests more modern.
+        https://bugs.webkit.org/show_bug.cgi?id=153284
+
+        Reviewed by Alex Christensen.
+
+        * storage/indexeddb/modern/abort-requests-cancelled-expected.txt:
+        * storage/indexeddb/modern/aborted-put-expected.txt:
+        * storage/indexeddb/modern/autoincrement-abort-expected.txt:
+        * storage/indexeddb/modern/basic-add-expected.txt:
+        * storage/indexeddb/modern/basic-put-expected.txt:
+        * storage/indexeddb/modern/create-index-failures-expected.txt:
+        * storage/indexeddb/modern/createobjectstore-basic-expected.txt:
+        * storage/indexeddb/modern/createobjectstore-failures-expected.txt:
+        * storage/indexeddb/modern/cursor-1-expected.txt:
+        * storage/indexeddb/modern/cursor-2-expected.txt:
+        * storage/indexeddb/modern/cursor-3-expected.txt:
+        * storage/indexeddb/modern/cursor-4-expected.txt:
+        * storage/indexeddb/modern/cursor-5-expected.txt:
+        * storage/indexeddb/modern/cursor-6-expected.txt:
+        * storage/indexeddb/modern/cursor-7-expected.txt:
+        * storage/indexeddb/modern/cursor-8-expected.txt:
+        * storage/indexeddb/modern/date-basic-expected.txt:
+        * storage/indexeddb/modern/deletedatabase-1-expected.txt:
+        * storage/indexeddb/modern/deletedatabase-2-expected.txt:
+        * storage/indexeddb/modern/deleteindex-1-expected.txt:
+        * storage/indexeddb/modern/deleteindex-2-expected.txt:
+        * storage/indexeddb/modern/deleteobjectstore-1-expected.txt:
+        * storage/indexeddb/modern/double-abort-expected.txt:
+        * storage/indexeddb/modern/get-index-failures-expected.txt:
+        * storage/indexeddb/modern/get-keyrange-expected.txt:
+        * storage/indexeddb/modern/idbdatabase-deleteobjectstore-failures-expected.txt:
+        * storage/indexeddb/modern/idbdatabase-transaction-failures-expected.txt:
+        * storage/indexeddb/modern/idbindex-properties-basic-expected.txt:
+        * storage/indexeddb/modern/idbobjectstore-clear-1-expected.txt:
+        * storage/indexeddb/modern/idbobjectstore-clear-2-expected.txt:
+        * storage/indexeddb/modern/idbobjectstore-count-1-expected.txt:
+        * storage/indexeddb/modern/idbobjectstore-count-failures-expected.txt:
+        * storage/indexeddb/modern/idbobjectstore-delete-1-expected.txt:
+        * storage/indexeddb/modern/idbobjectstore-delete-2-expected.txt:
+        * storage/indexeddb/modern/idbobjectstore-delete-failures-expected.txt:
+        * storage/indexeddb/modern/idbobjectstore-get-failures-expected.txt:
+        * storage/indexeddb/modern/idbobjectstore-put-and-clear-failures-expected.txt:
+        * storage/indexeddb/modern/idbtransaction-objectstore-failures-expected.txt:
+        * storage/indexeddb/modern/index-1-expected.txt:
+        * storage/indexeddb/modern/index-2-expected.txt:
+        * storage/indexeddb/modern/index-3-expected.txt:
+        * storage/indexeddb/modern/index-4-expected.txt:
+        * storage/indexeddb/modern/index-5-expected.txt:
+        * storage/indexeddb/modern/index-cursor-1-expected.txt:
+        * storage/indexeddb/modern/index-cursor-2-expected.txt:
+        * storage/indexeddb/modern/index-cursor-3-expected.txt:
+        * storage/indexeddb/modern/index-get-count-basic-expected.txt:
+        * storage/indexeddb/modern/index-get-count-failures-expected.txt:
+        * storage/indexeddb/modern/keypath-basic-expected.txt:
+        * storage/indexeddb/modern/objectstore-attributes-expected.txt:
+        * storage/indexeddb/modern/objectstore-cursor-advance-failures-expected.txt:
+        * storage/indexeddb/modern/objectstore-cursor-continue-failures-expected.txt:
+        * storage/indexeddb/modern/opencursor-failures-expected.txt:
+        * storage/indexeddb/modern/opendatabase-success-after-versionchange-expected.txt:
+        * storage/indexeddb/modern/opendatabase-versions-expected.txt:
+        * storage/indexeddb/modern/resources/abort-requests-cancelled.js:
+        * storage/indexeddb/modern/resources/aborted-put.js:
+        * storage/indexeddb/modern/resources/autoincrement-abort.js:
+        * storage/indexeddb/modern/resources/basic-add.js:
+        * storage/indexeddb/modern/resources/basic-put.js:
+        * storage/indexeddb/modern/resources/create-index-failures.js:
+        * storage/indexeddb/modern/resources/createobjectstore-basic.js:
+        * storage/indexeddb/modern/resources/createobjectstore-failures.js:
+        * storage/indexeddb/modern/resources/cursor-1.js:
+        * storage/indexeddb/modern/resources/cursor-2.js:
+        * storage/indexeddb/modern/resources/cursor-3.js:
+        * storage/indexeddb/modern/resources/cursor-4.js:
+        * storage/indexeddb/modern/resources/cursor-5.js:
+        * storage/indexeddb/modern/resources/cursor-6.js:
+        * storage/indexeddb/modern/resources/cursor-7.js:
+        * storage/indexeddb/modern/resources/cursor-8.js:
+        * storage/indexeddb/modern/resources/date-basic.js:
+        * storage/indexeddb/modern/resources/deletedatabase-1.js:
+        * storage/indexeddb/modern/resources/deletedatabase-2.js:
+        * storage/indexeddb/modern/resources/deletedatabase-null-name-exception.js:
+        * storage/indexeddb/modern/resources/deletedatabase-request-event.js:
+        * storage/indexeddb/modern/resources/deletedatabase-request.js:
+        * storage/indexeddb/modern/resources/deleteindex-1.js:
+        * storage/indexeddb/modern/resources/deleteindex-2.js:
+        * storage/indexeddb/modern/resources/deleteobjectstore-1.js:
+        * storage/indexeddb/modern/resources/double-abort.js:
+        * storage/indexeddb/modern/resources/double-open.js:
+        * storage/indexeddb/modern/resources/get-index-failures.js:
+        * storage/indexeddb/modern/resources/get-keyrange.js:
+        * storage/indexeddb/modern/resources/idbdatabase-deleteobjectstore-failures.js:
+        * storage/indexeddb/modern/resources/idbdatabase-transaction-failures.js:
+        * storage/indexeddb/modern/resources/idbindex-properties-basic.js:
+        * storage/indexeddb/modern/resources/idbobjectstore-clear-1.js:
+        * storage/indexeddb/modern/resources/idbobjectstore-clear-2.js:
+        * storage/indexeddb/modern/resources/idbobjectstore-count-1.js:
+        * storage/indexeddb/modern/resources/idbobjectstore-count-failures.js:
+        * storage/indexeddb/modern/resources/idbobjectstore-delete-1.js:
+        * storage/indexeddb/modern/resources/idbobjectstore-delete-2.js:
+        * storage/indexeddb/modern/resources/idbobjectstore-delete-failures.js:
+        * storage/indexeddb/modern/resources/idbobjectstore-get-failures.js:
+        * storage/indexeddb/modern/resources/idbobjectstore-put-and-clear-failures.js:
+        * storage/indexeddb/modern/resources/idbtransaction-objectstore-failures.js:
+        * storage/indexeddb/modern/resources/index-1.js:
+        * storage/indexeddb/modern/resources/index-2.js:
+        * storage/indexeddb/modern/resources/index-3.js:
+        * storage/indexeddb/modern/resources/index-4.js:
+        * storage/indexeddb/modern/resources/index-5.js:
+        * storage/indexeddb/modern/resources/index-cursor-1.js:
+        * storage/indexeddb/modern/resources/index-cursor-2.js:
+        * storage/indexeddb/modern/resources/index-cursor-3.js:
+        * storage/indexeddb/modern/resources/index-get-count-basic.js:
+        * storage/indexeddb/modern/resources/index-get-count-failures.js:
+        * storage/indexeddb/modern/resources/keypath-basic.js:
+        * storage/indexeddb/modern/resources/objectstore-attributes.js:
+        * storage/indexeddb/modern/resources/objectstore-cursor-advance-failures.js:
+        * storage/indexeddb/modern/resources/objectstore-cursor-continue-failures.js:
+        * storage/indexeddb/modern/resources/opencursor-failures.js:
+        * storage/indexeddb/modern/resources/opendatabase-request-event.js:
+        * storage/indexeddb/modern/resources/opendatabase-request.js:
+        * storage/indexeddb/modern/resources/opendatabase-success-after-versionchange.js:
+        * storage/indexeddb/modern/resources/opendatabase-versions.js:
+        * storage/indexeddb/modern/resources/request-readystate.js:
+        * storage/indexeddb/modern/resources/transaction-scheduler-1.js:
+        * storage/indexeddb/modern/resources/transaction-scheduler-2.js:
+        * storage/indexeddb/modern/resources/transaction-scheduler-3.js:
+        * storage/indexeddb/modern/resources/transaction-scheduler-5.js:
+        * storage/indexeddb/modern/resources/transaction-scheduler-6.js:
+        * storage/indexeddb/modern/resources/versionchange-abort-then-reopen.js:
+        * storage/indexeddb/modern/resources/versionchange-event.js:
+        * storage/indexeddb/modern/transaction-scheduler-1-expected.txt:
+        * storage/indexeddb/modern/transaction-scheduler-2-expected.txt:
+        * storage/indexeddb/modern/transaction-scheduler-3-expected.txt:
+        * storage/indexeddb/modern/transaction-scheduler-5-expected.txt:
+        * storage/indexeddb/modern/transaction-scheduler-6-expected.txt:
+        * storage/indexeddb/modern/versionchange-abort-then-reopen-expected.txt:
+        * storage/indexeddb/modern/versionchange-event-expected.txt:
+
 2016-01-20  Saam barati  <sbarati@apple.com>
 
         Web Inspector: Hook the sampling profiler into the Timelines UI
diff --git a/LayoutTests/storage/indexeddb/modern/abort-requests-cancelled-expected.txt b/LayoutTests/storage/indexeddb/modern/abort-requests-cancelled-expected.txt
index 660384a..052bd84 100644
--- a/LayoutTests/storage/indexeddb/modern/abort-requests-cancelled-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/abort-requests-cancelled-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Error handling: "objectStore.put({ bar: 'A' }, 1);" (error)
 Error handling: "objectStore.put({ bar: 'B' }, 2);" (error)
diff --git a/LayoutTests/storage/indexeddb/modern/aborted-put-expected.txt b/LayoutTests/storage/indexeddb/modern/aborted-put-expected.txt
index 434e970..edd4b3c 100644
--- a/LayoutTests/storage/indexeddb/modern/aborted-put-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/aborted-put-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 First upgrade needed: Old version - 0 New version - 1
 [object IDBTransaction] - versionchange
 [object IDBDatabase]
diff --git a/LayoutTests/storage/indexeddb/modern/autoincrement-abort-expected.txt b/LayoutTests/storage/indexeddb/modern/autoincrement-abort-expected.txt
index 5a4a9c4..98ab13a 100644
--- a/LayoutTests/storage/indexeddb/modern/autoincrement-abort-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/autoincrement-abort-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Initial upgrade versionchange transaction complete
 Opening readwrite transaction to bump the key generator, but it will be aborted
diff --git a/LayoutTests/storage/indexeddb/modern/basic-add-expected.txt b/LayoutTests/storage/indexeddb/modern/basic-add-expected.txt
index bf2221c..ac57179 100644
--- a/LayoutTests/storage/indexeddb/modern/basic-add-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/basic-add-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Upgrade needed: Old version - 0 New version - 1
 [object IDBTransaction] - versionchange
 [object IDBDatabase]
diff --git a/LayoutTests/storage/indexeddb/modern/basic-put-expected.txt b/LayoutTests/storage/indexeddb/modern/basic-put-expected.txt
index c658c7f..3450b69 100644
--- a/LayoutTests/storage/indexeddb/modern/basic-put-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/basic-put-expected.txt
@@ -1,3 +1,7 @@
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Upgrade needed: Old version - 0 New version - 1
 [object IDBTransaction] - versionchange
 [object IDBDatabase]
diff --git a/LayoutTests/storage/indexeddb/modern/create-index-failures-expected.txt b/LayoutTests/storage/indexeddb/modern/create-index-failures-expected.txt
index 7d41d7f..6c70cd6 100644
--- a/LayoutTests/storage/indexeddb/modern/create-index-failures-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/create-index-failures-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Failed to create index with null name
 Failed to create index with invalid key path
diff --git a/LayoutTests/storage/indexeddb/modern/createobjectstore-basic-expected.txt b/LayoutTests/storage/indexeddb/modern/createobjectstore-basic-expected.txt
index 596d259..806f77e 100644
--- a/LayoutTests/storage/indexeddb/modern/createobjectstore-basic-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/createobjectstore-basic-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Object store names:
 FirstAbortedObjectStore
diff --git a/LayoutTests/storage/indexeddb/modern/createobjectstore-failures-expected.txt b/LayoutTests/storage/indexeddb/modern/createobjectstore-failures-expected.txt
index 78a4770..a0290eb 100644
--- a/LayoutTests/storage/indexeddb/modern/createobjectstore-failures-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/createobjectstore-failures-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Failed to create object store with both autoincrement and an empty keypath: Error: Failed to execute 'createObjectStore' on 'IDBDatabase': The autoIncrement option was set but the keyPath option was empty or an array.
 Object store names:
diff --git a/LayoutTests/storage/indexeddb/modern/cursor-1-expected.txt b/LayoutTests/storage/indexeddb/modern/cursor-1-expected.txt
index f938aa1..97b9cdb 100644
--- a/LayoutTests/storage/indexeddb/modern/cursor-1-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/cursor-1-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Success opening cursor
 Cursor is: [object IDBCursorWithValue]
diff --git a/LayoutTests/storage/indexeddb/modern/cursor-2-expected.txt b/LayoutTests/storage/indexeddb/modern/cursor-2-expected.txt
index 98cf577..915f39e 100644
--- a/LayoutTests/storage/indexeddb/modern/cursor-2-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/cursor-2-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Success iterating next cursor
 Cursor is: [object IDBCursorWithValue]
diff --git a/LayoutTests/storage/indexeddb/modern/cursor-3-expected.txt b/LayoutTests/storage/indexeddb/modern/cursor-3-expected.txt
index 5500fc5..67d72d2 100644
--- a/LayoutTests/storage/indexeddb/modern/cursor-3-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/cursor-3-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Success iterating cursor
 Cursor is: [object IDBCursorWithValue]
diff --git a/LayoutTests/storage/indexeddb/modern/cursor-4-expected.txt b/LayoutTests/storage/indexeddb/modern/cursor-4-expected.txt
index 7ead92b..48275a0 100644
--- a/LayoutTests/storage/indexeddb/modern/cursor-4-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/cursor-4-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Success iterating cursor
 Cursor is: [object IDBCursorWithValue]
diff --git a/LayoutTests/storage/indexeddb/modern/cursor-5-expected.txt b/LayoutTests/storage/indexeddb/modern/cursor-5-expected.txt
index 89efd3f..3ebabc1 100644
--- a/LayoutTests/storage/indexeddb/modern/cursor-5-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/cursor-5-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Cursor open at key 0
 Record 0 deleted, even though that's where the cursor currently points.
diff --git a/LayoutTests/storage/indexeddb/modern/cursor-6-expected.txt b/LayoutTests/storage/indexeddb/modern/cursor-6-expected.txt
index 0849cd7..250c2b8 100644
--- a/LayoutTests/storage/indexeddb/modern/cursor-6-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/cursor-6-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Cursor open at key 2
 Record 2 deleted, even though that's where the cursor currently points.
diff --git a/LayoutTests/storage/indexeddb/modern/cursor-7-expected.txt b/LayoutTests/storage/indexeddb/modern/cursor-7-expected.txt
index 28eb11e..e8aa2be 100644
--- a/LayoutTests/storage/indexeddb/modern/cursor-7-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/cursor-7-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Cursor open at key 0
 Object store cleared.
diff --git a/LayoutTests/storage/indexeddb/modern/cursor-8-expected.txt b/LayoutTests/storage/indexeddb/modern/cursor-8-expected.txt
index d6ac5c2..3b5cd64 100644
--- a/LayoutTests/storage/indexeddb/modern/cursor-8-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/cursor-8-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Cursor open at key 2
 Object store cleared.
diff --git a/LayoutTests/storage/indexeddb/modern/date-basic-expected.txt b/LayoutTests/storage/indexeddb/modern/date-basic-expected.txt
index 87210c9..6397b89 100644
--- a/LayoutTests/storage/indexeddb/modern/date-basic-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/date-basic-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Initial upgrade versionchange transaction complete
 Success getting key 'Fri Nov 04 1955 17:00:00 GMT-0700 (PDT)' of type object, result is 'Flux capacitor' of type string
diff --git a/LayoutTests/storage/indexeddb/modern/deletedatabase-1-expected.txt b/LayoutTests/storage/indexeddb/modern/deletedatabase-1-expected.txt
index e611894..c58b6b9 100644
--- a/LayoutTests/storage/indexeddb/modern/deletedatabase-1-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/deletedatabase-1-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade old version - 0 new version - 1
 Version change complete
 Requesting deleteDatabase
diff --git a/LayoutTests/storage/indexeddb/modern/deletedatabase-2-expected.txt b/LayoutTests/storage/indexeddb/modern/deletedatabase-2-expected.txt
index b92c73f..62427c7 100644
--- a/LayoutTests/storage/indexeddb/modern/deletedatabase-2-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/deletedatabase-2-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade old version - 0 new version - 1
 Requesting deleteDatabase
 First connection received versionchange event: oldVersion 1, newVersion null
diff --git a/LayoutTests/storage/indexeddb/modern/deleteindex-1-expected.txt b/LayoutTests/storage/indexeddb/modern/deleteindex-1-expected.txt
index 4c02a88..a42d45d 100644
--- a/LayoutTests/storage/indexeddb/modern/deleteindex-1-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/deleteindex-1-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Count is: 2
 Cursor at record: A / 1
diff --git a/LayoutTests/storage/indexeddb/modern/deleteindex-2-expected.txt b/LayoutTests/storage/indexeddb/modern/deleteindex-2-expected.txt
index 9919a81..57a3d13 100644
--- a/LayoutTests/storage/indexeddb/modern/deleteindex-2-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/deleteindex-2-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Count is: 2
 Cursor at record: A / 1
diff --git a/LayoutTests/storage/indexeddb/modern/deleteobjectstore-1-expected.txt b/LayoutTests/storage/indexeddb/modern/deleteobjectstore-1-expected.txt
index 6e53fe8..0c98d31 100644
--- a/LayoutTests/storage/indexeddb/modern/deleteobjectstore-1-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/deleteobjectstore-1-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Initial upgrade versionchange transaction complete
 Second upgrade needed: Old version - 1 New version - 2
diff --git a/LayoutTests/storage/indexeddb/modern/double-abort-expected.txt b/LayoutTests/storage/indexeddb/modern/double-abort-expected.txt
index 325ab06..1b162b2 100644
--- a/LayoutTests/storage/indexeddb/modern/double-abort-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/double-abort-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Second abort failed: Error: Failed to execute 'abort' on 'IDBTransaction': The transaction is inactive or finished.
 Initial upgrade versionchange transaction aborted
diff --git a/LayoutTests/storage/indexeddb/modern/get-index-failures-expected.txt b/LayoutTests/storage/indexeddb/modern/get-index-failures-expected.txt
index f35a0bb..c9f5a0c 100644
--- a/LayoutTests/storage/indexeddb/modern/get-index-failures-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/get-index-failures-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Initial upgrade versionchange transaction complete
 Got an index as expected: [object IDBIndex]
diff --git a/LayoutTests/storage/indexeddb/modern/get-keyrange-expected.txt b/LayoutTests/storage/indexeddb/modern/get-keyrange-expected.txt
index b5b7724..6714036 100644
--- a/LayoutTests/storage/indexeddb/modern/get-keyrange-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/get-keyrange-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Initial upgrade versionchange transaction complete
 Success getting keyRange [-1 (Closed), undefined (Open)]
diff --git a/LayoutTests/storage/indexeddb/modern/idbdatabase-deleteobjectstore-failures-expected.txt b/LayoutTests/storage/indexeddb/modern/idbdatabase-deleteobjectstore-failures-expected.txt
index cf3af1f..102325b 100644
--- a/LayoutTests/storage/indexeddb/modern/idbdatabase-deleteobjectstore-failures-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/idbdatabase-deleteobjectstore-failures-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Initial upgrade versionchange transaction complete
 readwrite put success - about to try to delete an objectstore
diff --git a/LayoutTests/storage/indexeddb/modern/idbdatabase-transaction-failures-expected.txt b/LayoutTests/storage/indexeddb/modern/idbdatabase-transaction-failures-expected.txt
index 77fd498..6456220 100644
--- a/LayoutTests/storage/indexeddb/modern/idbdatabase-transaction-failures-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/idbdatabase-transaction-failures-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Upgrade needed: Old version - 0 New version - 1
 Failed to start a transaction while a versionChange transaction was in progress - Error: Failed to execute 'transaction' on 'IDBDatabase': A version change transaction is running.
 versionchange transaction completed
diff --git a/LayoutTests/storage/indexeddb/modern/idbindex-properties-basic-expected.txt b/LayoutTests/storage/indexeddb/modern/idbindex-properties-basic-expected.txt
index 5afd159..c37b558 100644
--- a/LayoutTests/storage/indexeddb/modern/idbindex-properties-basic-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/idbindex-properties-basic-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 TestIndex1
 [object IDBObjectStore]
diff --git a/LayoutTests/storage/indexeddb/modern/idbobjectstore-clear-1-expected.txt b/LayoutTests/storage/indexeddb/modern/idbobjectstore-clear-1-expected.txt
index 6a163c6..8435648 100644
--- a/LayoutTests/storage/indexeddb/modern/idbobjectstore-clear-1-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/idbobjectstore-clear-1-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Initial upgrade versionchange transaction complete
 Success opening database connection - Starting readwrite transaction
diff --git a/LayoutTests/storage/indexeddb/modern/idbobjectstore-clear-2-expected.txt b/LayoutTests/storage/indexeddb/modern/idbobjectstore-clear-2-expected.txt
index 8cf9a8a..dd356ab 100644
--- a/LayoutTests/storage/indexeddb/modern/idbobjectstore-clear-2-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/idbobjectstore-clear-2-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Initial upgrade versionchange transaction complete
 Success opening database connection - Starting readwrite transaction
diff --git a/LayoutTests/storage/indexeddb/modern/idbobjectstore-count-1-expected.txt b/LayoutTests/storage/indexeddb/modern/idbobjectstore-count-1-expected.txt
index b9d27a6..2954301 100644
--- a/LayoutTests/storage/indexeddb/modern/idbobjectstore-count-1-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/idbobjectstore-count-1-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Count is: 1
 Count is: 0
diff --git a/LayoutTests/storage/indexeddb/modern/idbobjectstore-count-failures-expected.txt b/LayoutTests/storage/indexeddb/modern/idbobjectstore-count-failures-expected.txt
index aed372e..72bfc47 100644
--- a/LayoutTests/storage/indexeddb/modern/idbobjectstore-count-failures-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/idbobjectstore-count-failures-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Failed to count records in object store with an invalid key
 Failed to count records in object store that's been deleted
diff --git a/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-1-expected.txt b/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-1-expected.txt
index 1c18f30..f491d7d 100644
--- a/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-1-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-1-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Count is 113
 Initial upgrade versionchange transaction complete
diff --git a/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-2-expected.txt b/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-2-expected.txt
index 671118d..8eb85b1 100644
--- a/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-2-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-2-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Initial upgrade versionchange transaction complete
 After delete, record for "foo" has value: undefined
diff --git a/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-failures-expected.txt b/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-failures-expected.txt
index 16d6a52..a0c42d1 100644
--- a/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-failures-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-failures-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Failed to delete record from object store with an invalid key
 Failed to delete record from object store that has been deleted
diff --git a/LayoutTests/storage/indexeddb/modern/idbobjectstore-get-failures-expected.txt b/LayoutTests/storage/indexeddb/modern/idbobjectstore-get-failures-expected.txt
index d2ebb00..6deaafb 100644
--- a/LayoutTests/storage/indexeddb/modern/idbobjectstore-get-failures-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/idbobjectstore-get-failures-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Failed to get record from object store with an invalid key
 Failed to get record from object store that has been deleted
diff --git a/LayoutTests/storage/indexeddb/modern/idbobjectstore-put-and-clear-failures-expected.txt b/LayoutTests/storage/indexeddb/modern/idbobjectstore-put-and-clear-failures-expected.txt
index e05eec6..dd3b76d 100644
--- a/LayoutTests/storage/indexeddb/modern/idbobjectstore-put-and-clear-failures-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/idbobjectstore-put-and-clear-failures-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Failed to put record into object store with an invalid key
 Failed to put record into object store that has been deleted
diff --git a/LayoutTests/storage/indexeddb/modern/idbtransaction-objectstore-failures-expected.txt b/LayoutTests/storage/indexeddb/modern/idbtransaction-objectstore-failures-expected.txt
index 8b01359..edde57c 100644
--- a/LayoutTests/storage/indexeddb/modern/idbtransaction-objectstore-failures-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/idbtransaction-objectstore-failures-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Upgrade needed: Old version - 0 New version - 1
 [object IDBTransaction] - versionchange
 [object IDBDatabase]
diff --git a/LayoutTests/storage/indexeddb/modern/index-1-expected.txt b/LayoutTests/storage/indexeddb/modern/index-1-expected.txt
index 6d6f3bc1..1fed99f 100644
--- a/LayoutTests/storage/indexeddb/modern/index-1-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/index-1-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 get "good" result is: [object Object]
 bar is good
diff --git a/LayoutTests/storage/indexeddb/modern/index-2-expected.txt b/LayoutTests/storage/indexeddb/modern/index-2-expected.txt
index 59830dc..62d4f4d 100644
--- a/LayoutTests/storage/indexeddb/modern/index-2-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/index-2-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 get "good" result is: [object Object]
 bar is good
diff --git a/LayoutTests/storage/indexeddb/modern/index-3-expected.txt b/LayoutTests/storage/indexeddb/modern/index-3-expected.txt
index 3e3777a..8457b7f 100644
--- a/LayoutTests/storage/indexeddb/modern/index-3-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/index-3-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 First put success
 Value of 1 is: [object Object]
diff --git a/LayoutTests/storage/indexeddb/modern/index-4-expected.txt b/LayoutTests/storage/indexeddb/modern/index-4-expected.txt
index a160dbd..dc38e22 100644
--- a/LayoutTests/storage/indexeddb/modern/index-4-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/index-4-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Count is: 18
 Cursor at record: A / 1
diff --git a/LayoutTests/storage/indexeddb/modern/index-5-expected.txt b/LayoutTests/storage/indexeddb/modern/index-5-expected.txt
index 9707e65..5fbd548 100644
--- a/LayoutTests/storage/indexeddb/modern/index-5-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/index-5-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Error getting cursor count
 Error opening or iterating cursor
diff --git a/LayoutTests/storage/indexeddb/modern/index-cursor-1-expected.txt b/LayoutTests/storage/indexeddb/modern/index-cursor-1-expected.txt
index 8e1b826..b1b6f20 100644
--- a/LayoutTests/storage/indexeddb/modern/index-cursor-1-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/index-cursor-1-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 
 Starting a new cursor: testCursorDirection(index1, 'next')
diff --git a/LayoutTests/storage/indexeddb/modern/index-cursor-2-expected.txt b/LayoutTests/storage/indexeddb/modern/index-cursor-2-expected.txt
index 0240cb0..77f18a4 100644
--- a/LayoutTests/storage/indexeddb/modern/index-cursor-2-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/index-cursor-2-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 
 Starting a new cursor: testCursorDirection('next', IDBKeyRange.bound('B', 'D', true, true))
diff --git a/LayoutTests/storage/indexeddb/modern/index-cursor-3-expected.txt b/LayoutTests/storage/indexeddb/modern/index-cursor-3-expected.txt
index 6e752ba..c8ffd24 100644
--- a/LayoutTests/storage/indexeddb/modern/index-cursor-3-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/index-cursor-3-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Starting a new cursor: testCursorDirection(index, 'next')
 TestIndex1 count is: 18
diff --git a/LayoutTests/storage/indexeddb/modern/index-get-count-basic-expected.txt b/LayoutTests/storage/indexeddb/modern/index-get-count-basic-expected.txt
index 345faaa..49f7d24 100644
--- a/LayoutTests/storage/indexeddb/modern/index-get-count-basic-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/index-get-count-basic-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 get result is: [object Object]
 bar is good
diff --git a/LayoutTests/storage/indexeddb/modern/index-get-count-failures-expected.txt b/LayoutTests/storage/indexeddb/modern/index-get-count-failures-expected.txt
index fa191bb..1fc0dc5 100644
--- a/LayoutTests/storage/indexeddb/modern/index-get-count-failures-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/index-get-count-failures-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Failed to get with a null key
 Failed to getKey with a null key
diff --git a/LayoutTests/storage/indexeddb/modern/keypath-basic-expected.txt b/LayoutTests/storage/indexeddb/modern/keypath-basic-expected.txt
index bf97fb4..4a9ae31 100644
--- a/LayoutTests/storage/indexeddb/modern/keypath-basic-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/keypath-basic-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 object put SUCCESS - foo1
 array put SUCCESS - foo2
diff --git a/LayoutTests/storage/indexeddb/modern/objectstore-attributes-expected.txt b/LayoutTests/storage/indexeddb/modern/objectstore-attributes-expected.txt
index c0f8249..3becfb8 100644
--- a/LayoutTests/storage/indexeddb/modern/objectstore-attributes-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/objectstore-attributes-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 First upgrade needed: Old version - 0 New version - 1
 [object IDBTransaction] - versionchange
 [object IDBDatabase]
diff --git a/LayoutTests/storage/indexeddb/modern/objectstore-cursor-advance-failures-expected.txt b/LayoutTests/storage/indexeddb/modern/objectstore-cursor-advance-failures-expected.txt
index 824b0a7..ccba7a6 100644
--- a/LayoutTests/storage/indexeddb/modern/objectstore-cursor-advance-failures-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/objectstore-cursor-advance-failures-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Failed to advance object store cursor with undefined count argument
 Failed to advance object store cursor with '0' count argument
diff --git a/LayoutTests/storage/indexeddb/modern/objectstore-cursor-continue-failures-expected.txt b/LayoutTests/storage/indexeddb/modern/objectstore-cursor-continue-failures-expected.txt
index d0625d8..47bb8f7 100644
--- a/LayoutTests/storage/indexeddb/modern/objectstore-cursor-continue-failures-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/objectstore-cursor-continue-failures-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Failed to continue a 'next' object store cursor to a key less than the current key
 Failed to continue object store cursor with invalid key
diff --git a/LayoutTests/storage/indexeddb/modern/opencursor-failures-expected.txt b/LayoutTests/storage/indexeddb/modern/opencursor-failures-expected.txt
index b681d0d..cdf1417 100644
--- a/LayoutTests/storage/indexeddb/modern/opencursor-failures-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/opencursor-failures-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Failed to open object store cursor with invalid keypath
 Failed to open object store cursor with invalid direction
diff --git a/LayoutTests/storage/indexeddb/modern/opendatabase-success-after-versionchange-expected.txt b/LayoutTests/storage/indexeddb/modern/opendatabase-success-after-versionchange-expected.txt
index 3c5546d..dbf307d 100644
--- a/LayoutTests/storage/indexeddb/modern/opendatabase-success-after-versionchange-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/opendatabase-success-after-versionchange-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 upgradeneeded: old version - 0 new version - 1
 [object IDBTransaction]
 Version change complete
diff --git a/LayoutTests/storage/indexeddb/modern/opendatabase-versions-expected.txt b/LayoutTests/storage/indexeddb/modern/opendatabase-versions-expected.txt
index c907f92..e0d9ed9 100644
--- a/LayoutTests/storage/indexeddb/modern/opendatabase-versions-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/opendatabase-versions-expected.txt
@@ -3,7 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-[object IDBOpenDBRequest] (firstPhase)
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 upgradeneeded (firstPhase): old version - 0 new version - 1
 [object IDBTransaction]
 Version change complete (firstPhase). Database version is now - 1
diff --git a/LayoutTests/storage/indexeddb/modern/resources/abort-requests-cancelled.js b/LayoutTests/storage/indexeddb/modern/resources/abort-requests-cancelled.js
index 3ea975a..77952fe 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/abort-requests-cancelled.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/abort-requests-cancelled.js
@@ -1,9 +1,7 @@
 description("This test makes sure that un-handled requests in a transaction receive onerror callbacks when the transaction is aborted.");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
@@ -32,45 +30,44 @@
     }   
 }
 
-startTest();
+var dbname;
 
-function startTest() {
-    var createRequest = window.indexedDB.open("AbortRequestsCancelledDatabase", 1);
-    createRequest.onupgradeneeded = function(event) {
-        debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
+function prepareDatabase(event) {
+    debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-        var versionTransaction = createRequest.transaction;
-        var database = event.target.result;
-        objectStore = database.createObjectStore("TestObjectStore");
-        setupRequest("objectStore.put({ bar: 'A' }, 1);");
-        setupRequest("objectStore.put({ bar: 'B' }, 2);");
-        setupRequest("objectStore.put({ bar: 'C' }, 3);");
+    var versionTransaction = event.target.transaction;
+    var database = event.target.result;
+    event.target.onerror = null;
+    dbname = database.name;
+    objectStore = database.createObjectStore("TestObjectStore");
+    setupRequest("objectStore.put({ bar: 'A' }, 1);");
+    setupRequest("objectStore.put({ bar: 'B' }, 2);");
+    setupRequest("objectStore.put({ bar: 'C' }, 3);");
 
-        versionTransaction.abort();
+    versionTransaction.abort();
 
-        versionTransaction.onabort = function(event) {
-            debug("Initial upgrade versionchange transaction aborted");
-            database.close();
-            continueTest1();
-        }
+    versionTransaction.onabort = function(event) {
+        debug("Initial upgrade versionchange transaction aborted");
+        database.close();
+        continueTest1();
+    }
 
-        versionTransaction.oncomplete = function(event) {
-            debug("Initial upgrade versionchange transaction unexpected complete");
-            done();
-        }
+    versionTransaction.oncomplete = function(event) {
+        debug("Initial upgrade versionchange transaction unexpected complete");
+        done();
+    }
 
-        versionTransaction.onerror = function(event) {
-            debug("Initial upgrade versionchange transaction error " + event);
-        }
+    versionTransaction.onerror = function(event) {
+        debug("Initial upgrade versionchange transaction error " + event);
     }
 }
 
 function continueTest1() {
-    var createRequest = window.indexedDB.open("AbortRequestsCancelledDatabase", 1);
+    var createRequest = window.indexedDB.open(dbname, 1);
     createRequest.onupgradeneeded = function(event) {
         debug("Second upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-        var versionTransaction = createRequest.transaction;
+        var versionTransaction = event.target.transaction;
         database = event.target.result;
         objectStore = database.createObjectStore("TestObjectStore");
     
diff --git a/LayoutTests/storage/indexeddb/modern/resources/aborted-put.js b/LayoutTests/storage/indexeddb/modern/resources/aborted-put.js
index df09171..7bd661d 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/aborted-put.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/aborted-put.js
@@ -2,24 +2,24 @@
 In a new transaction, it then overwrites those values, but then aborts the transaction. \
 Finally it verifies everything is set up from the first transaction, and nothing from the aborted one committed.");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
 
-var request = window.indexedDB.open("AbortedPutTestDatabase");
 
 function done()
 {
     finishJSTest();
 }
 
-request.onupgradeneeded = function(event)
+var dbname;
+
+function prepareDatabase(event)
 {
     debug("First upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
     
-    var tx = request.transaction;
+    event.target.onerror = null;
+    var tx = event.target.transaction;
     var db = event.target.result;
+    dbname = db.name;
 
     debug(tx + " - " + tx.mode);
     debug(db);
@@ -77,7 +77,7 @@
 
 function continueTest1()
 {
-    var request = window.indexedDB.open("AbortedPutTestDatabase", 2);
+    var request = window.indexedDB.open(dbname, 2);
 
     request.onupgradeneeded = function(event) {
         debug("Second upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
@@ -146,7 +146,7 @@
 
 function continueTest2()
 {
-    var request = window.indexedDB.open("AbortedPutTestDatabase", 2);
+    var request = window.indexedDB.open(dbname, 2);
 
     request.onupgradeneeded = function(event) {
         debug("Third upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
diff --git a/LayoutTests/storage/indexeddb/modern/resources/autoincrement-abort.js b/LayoutTests/storage/indexeddb/modern/resources/autoincrement-abort.js
index f1d2b50..594b9fd 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/autoincrement-abort.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/autoincrement-abort.js
@@ -3,25 +3,21 @@
 But it then aborts that transaction. \
 Then it opens a new one and puts something in it, double checking that the key generator was reverted when the above transaction was aborted.");
 
+indexedDBTest(prepareDatabase);
 
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
-
 function done()
 {
     finishJSTest();
 }
 
-var createRequest = window.indexedDB.open("AutoincrementAbortDatabase", 1);
 var database;
 
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     database = event.target.result;
     var objectStore = database.createObjectStore('TestObjectStore', { autoIncrement: true });
     
diff --git a/LayoutTests/storage/indexeddb/modern/resources/basic-add.js b/LayoutTests/storage/indexeddb/modern/resources/basic-add.js
index 6abc7c2..4225c0b 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/basic-add.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/basic-add.js
@@ -1,21 +1,18 @@
 description("This test does basic testing of IDBObjectStore.add(), making sure that an attempt to overwrite an already-existing key fails with the appropriate error.");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
 
-var request = window.indexedDB.open("NewDatabaseAddTestDatabase");
 
 function done()
 {
     finishJSTest();
 }
 
-request.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
     
-    var tx = request.transaction;
+    var tx = event.target.transaction;
     var db = event.target.result;
 
     debug(tx + " - " + tx.mode);
diff --git a/LayoutTests/storage/indexeddb/modern/resources/basic-put.js b/LayoutTests/storage/indexeddb/modern/resources/basic-put.js
index 03b61c9..5ac7df2 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/basic-put.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/basic-put.js
@@ -1,20 +1,17 @@
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
 
-var request = window.indexedDB.open("NewDatabasePutTestDatabase");
 
 function done()
 {
     finishJSTest();
 }
 
-request.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
     
-    var tx = request.transaction;
+    var tx = event.target.transaction;
     var db = event.target.result;
 
     debug(tx + " - " + tx.mode);
diff --git a/LayoutTests/storage/indexeddb/modern/resources/create-index-failures.js b/LayoutTests/storage/indexeddb/modern/resources/create-index-failures.js
index 19ef45e..0099c50 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/create-index-failures.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/create-index-failures.js
@@ -1,9 +1,7 @@
 description("This tests some obvious failures that can happen while calling IDBObjectStore.createIndex().");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
@@ -15,13 +13,13 @@
     debug(message);
 }
 
-var createRequest = window.indexedDB.open("IDBObjectStoreCreateIndexFailuresDatabase", 1);
 var database;
 
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     database = event.target.result;
     var objectStore = database.createObjectStore("TestObjectStore");
 
diff --git a/LayoutTests/storage/indexeddb/modern/resources/createobjectstore-basic.js b/LayoutTests/storage/indexeddb/modern/resources/createobjectstore-basic.js
index dd562ed..a1d40b1 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/createobjectstore-basic.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/createobjectstore-basic.js
@@ -1,10 +1,8 @@
 description("This test starts some version change transactions, creates some object stores, and variably commits or aborts the version change transactions. \
 At various stages it verifies the object stores in the database are as-expected.");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
@@ -19,13 +17,16 @@
     }
 }
 
-var createRequest = window.indexedDB.open("CreateObjectStoreTestDatabase", 1);
-
-createRequest.onupgradeneeded = function(event) {
+var dbname;
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    event.target.onerror = null;
+
+    var versionTransaction = event.target.transaction;
     var database = event.target.result;
+    dbname = database.name;
     var objectStore = database.createObjectStore("FirstAbortedObjectStore");
     var request = objectStore.put("foo", "bar");
 
@@ -59,12 +60,12 @@
 
 function continueTest1()
 {
-    createRequest = window.indexedDB.open("CreateObjectStoreTestDatabase", 1);
+    createRequest = window.indexedDB.open(dbname, 1);
 
     createRequest.onupgradeneeded = function(event) {
         debug("Second upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-        var versionTransaction = createRequest.transaction;
+        var versionTransaction = event.target.transaction;
         var database = event.target.result;
         dumpObjectStores(database);
         var objectStore = database.createObjectStore("FirstCommittedObjectStore");
@@ -90,12 +91,12 @@
 
 function continueTest2()
 {
-    createRequest = window.indexedDB.open("CreateObjectStoreTestDatabase", 2);
+    createRequest = window.indexedDB.open(dbname, 2);
 
     createRequest.onupgradeneeded = function(event) {
         debug("Third upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-        var versionTransaction = createRequest.transaction;
+        var versionTransaction = event.target.transaction;
         var database = event.target.result;
         var objectStore = database.createObjectStore("SecondCommittedObjectStore");
 
@@ -122,7 +123,7 @@
 
 function continueTest3()
 {
-    createRequest = window.indexedDB.open("CreateObjectStoreTestDatabase", 3);
+    createRequest = window.indexedDB.open(dbname, 3);
 
     createRequest.onupgradeneeded = function(event) {
         debug("Fourth upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
diff --git a/LayoutTests/storage/indexeddb/modern/resources/createobjectstore-failures.js b/LayoutTests/storage/indexeddb/modern/resources/createobjectstore-failures.js
index 5450064..32ce4af 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/createobjectstore-failures.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/createobjectstore-failures.js
@@ -1,9 +1,7 @@
 description("This test exercises the obvious ways that IDBDatabase.createObjectStore can fail.");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
@@ -18,14 +16,14 @@
     }
 }
 
-var createRequest = window.indexedDB.open("CreateObjectStoreFailuresTestDatabase", 1);
 var database;
 var versionTransaction;
 
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    versionTransaction = createRequest.transaction;
+    versionTransaction = event.target.transaction;
     database = event.target.result;
 
     try {
diff --git a/LayoutTests/storage/indexeddb/modern/resources/cursor-1.js b/LayoutTests/storage/indexeddb/modern/resources/cursor-1.js
index 3802aff..112a7c2 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/cursor-1.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/cursor-1.js
@@ -1,9 +1,7 @@
 description("This tests basic IDBCursor functionality");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
@@ -15,8 +13,6 @@
     debug(message);
 }
 
-var createRequest = window.indexedDB.open("Cursor1Database", 1);
-
 function logCursor(cursor)
 {
     debug("Cursor is: " + cursor);
@@ -54,10 +50,11 @@
     setupRequest(request);
 }
 
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     var database = event.target.result;
     objectStore = database.createObjectStore("TestObjectStore");
     index = objectStore.createIndex("TestIndex1", "bar");
diff --git a/LayoutTests/storage/indexeddb/modern/resources/cursor-2.js b/LayoutTests/storage/indexeddb/modern/resources/cursor-2.js
index c64aefa..4b88913 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/cursor-2.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/cursor-2.js
@@ -1,9 +1,7 @@
 description("This test checks basic functionality walking a \"next\" and \"prev\" cursor on an object store with some records.");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
@@ -15,8 +13,6 @@
     debug(message);
 }
 
-var createRequest = window.indexedDB.open("Cursor2Database", 1);
-
 function logCursor(cursor)
 {
     debug("Cursor is: " + cursor);
@@ -51,10 +47,11 @@
     } 
 }
 
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     var database = event.target.result;
     objectStore = database.createObjectStore("TestObjectStore");
 
diff --git a/LayoutTests/storage/indexeddb/modern/resources/cursor-3.js b/LayoutTests/storage/indexeddb/modern/resources/cursor-3.js
index 7c6bad1..5c29ac3 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/cursor-3.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/cursor-3.js
@@ -1,9 +1,7 @@
 description("This test various uses of advance() and continue() on a \"next\" cursor.");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
@@ -15,8 +13,6 @@
     debug(message);
 }
 
-var createRequest = window.indexedDB.open("Cursor3Database", 1);
-
 function logCursor(cursor)
 {
     debug("Cursor is: " + cursor);
@@ -61,10 +57,11 @@
     } 
 }
 
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     var database = event.target.result;
     objectStore = database.createObjectStore("TestObjectStore");
 
diff --git a/LayoutTests/storage/indexeddb/modern/resources/cursor-4.js b/LayoutTests/storage/indexeddb/modern/resources/cursor-4.js
index 606f29e..73426d9 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/cursor-4.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/cursor-4.js
@@ -1,9 +1,7 @@
 description("This test various uses of advance() and continue() on a \"prev\" cursor.");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
@@ -15,8 +13,6 @@
     debug(message);
 }
 
-var createRequest = window.indexedDB.open("Cursor4Database", 1);
-
 function logCursor(cursor)
 {
     debug("Cursor is: " + cursor);
@@ -61,10 +57,11 @@
     } 
 }
 
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     var database = event.target.result;
     objectStore = database.createObjectStore("TestObjectStore");
 
diff --git a/LayoutTests/storage/indexeddb/modern/resources/cursor-5.js b/LayoutTests/storage/indexeddb/modern/resources/cursor-5.js
index 2c78bc8..b49638d 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/cursor-5.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/cursor-5.js
@@ -1,9 +1,7 @@
 description("This tests iterating a \"next\" cursor in a read-write transaction while changing records.");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
@@ -15,12 +13,11 @@
     debug(message);
 }
 
-var createRequest = window.indexedDB.open("Cursor5Database", 1);
-
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     var database = event.target.result;
     var objectStore = database.createObjectStore("TestObjectStore");
 
diff --git a/LayoutTests/storage/indexeddb/modern/resources/cursor-6.js b/LayoutTests/storage/indexeddb/modern/resources/cursor-6.js
index ec03dc4..f6b76d0 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/cursor-6.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/cursor-6.js
@@ -1,9 +1,7 @@
 description("This tests iterating a \"prev\" cursor in a read-write transaction while changing records.");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
@@ -15,12 +13,11 @@
     debug(message);
 }
 
-var createRequest = window.indexedDB.open("Cursor6Database", 1);
-
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     var database = event.target.result;
     var objectStore = database.createObjectStore("TestObjectStore");
 
diff --git a/LayoutTests/storage/indexeddb/modern/resources/cursor-7.js b/LayoutTests/storage/indexeddb/modern/resources/cursor-7.js
index 60951e7..6c719e4 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/cursor-7.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/cursor-7.js
@@ -1,9 +1,7 @@
 description("This tests iterating a \"next\" cursor in a read-write transaction combined with clearing the object store.");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
@@ -15,12 +13,11 @@
     debug(message);
 }
 
-var createRequest = window.indexedDB.open("Cursor7Database", 1);
-
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     var database = event.target.result;
     var objectStore = database.createObjectStore("TestObjectStore");
 
diff --git a/LayoutTests/storage/indexeddb/modern/resources/cursor-8.js b/LayoutTests/storage/indexeddb/modern/resources/cursor-8.js
index 50465e5..6c3bc4f 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/cursor-8.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/cursor-8.js
@@ -1,9 +1,7 @@
 description("This tests iterating a \"prev\" cursor in a read-write transaction while changing records.");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
@@ -15,12 +13,11 @@
     debug(message);
 }
 
-var createRequest = window.indexedDB.open("Cursor8Database", 1);
-
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     var database = event.target.result;
     var objectStore = database.createObjectStore("TestObjectStore");
 
diff --git a/LayoutTests/storage/indexeddb/modern/resources/date-basic.js b/LayoutTests/storage/indexeddb/modern/resources/date-basic.js
index dec0b95..0b795a5 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/date-basic.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/date-basic.js
@@ -1,26 +1,24 @@
 description("This tests using Date objects as keys and values.");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
     finishJSTest();
 }
 
-var createRequest = window.indexedDB.open("DateBasicDatabase", 1);
 var database;
 
 var date1 = new Date("1955-11-05T00:00:00");
 var date2 = new Date("1955-11-12T18:00:00");
 var date3 = new Date("2015-10-21T16:00:00");
     
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     database = event.target.result;
     var objectStore = database.createObjectStore("TestObjectStore");
 
diff --git a/LayoutTests/storage/indexeddb/modern/resources/deletedatabase-1.js b/LayoutTests/storage/indexeddb/modern/resources/deletedatabase-1.js
index 1fd071a..3e50009 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/deletedatabase-1.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/deletedatabase-1.js
@@ -1,9 +1,7 @@
 description("This tests that if deleteDatabase is called while there is already an open connection to the database that the open connection gets the appropriate versionChange event.");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase, openSuccess);
+
 
 function done()
 {
@@ -15,27 +13,22 @@
     debug(message);
 }
 
-var request = window.indexedDB.open("DeleteDatabase1TestDatabase");
-request.onsuccess = function()
-{
+function openSuccess() {
     debug("open db success");
 }
-request.onerror = function(e)
-{
-    debug("Unexpected error");
-	done();
-}
 
-request.onupgradeneeded = function(e)
+var dbname;
+function prepareDatabase(e)
 {
     debug("Initial upgrade old version - " + e.oldVersion + " new version - " + e.newVersion);
     
-    var versionTransaction = request.transaction;
+    var versionTransaction = event.target.transaction;
     var database = event.target.result;
+    dbname = database.name;
     var objectStore = database.createObjectStore("TestObjectStore");
     objectStore.put("This is a record", 1);
         
-    request.transaction.oncomplete = function()
+    event.target.transaction.oncomplete = function()
     {
         debug("Version change complete");
         database.onversionchange = function(e)
@@ -45,12 +38,12 @@
         }
         continueTest1();
     }
-    request.transaction.onabort = function()
+    event.target.transaction.onabort = function()
     {
         debug("Version change unexpected abort");
         done();
     }
-    request.transaction.onerror = function()
+    event.target.transaction.onerror = function()
     {
         debug("Version change unexpected error");
         done();
@@ -60,7 +53,7 @@
 function continueTest1()
 {
     debug("Requesting deleteDatabase");
-    var request = window.indexedDB.deleteDatabase("DeleteDatabase1TestDatabase");
+    var request = window.indexedDB.deleteDatabase(dbname);
     request.onsuccess = function(e)
     {
         debug("Delete database success: oldVersion " + e.oldVersion + ", newVersion " + e.newVersion);
@@ -81,7 +74,7 @@
 function continueTest2()
 {
     debug("Recreating database to make sure it's new and empty");
-    var request = window.indexedDB.open("DeleteDatabase1TestDatabase");
+    var request = window.indexedDB.open(dbname);
 
     request.onupgradeneeded = function(e)
     {
diff --git a/LayoutTests/storage/indexeddb/modern/resources/deletedatabase-2.js b/LayoutTests/storage/indexeddb/modern/resources/deletedatabase-2.js
index a52622e..377859d 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/deletedatabase-2.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/deletedatabase-2.js
@@ -1,10 +1,7 @@
 description("This tests that if deleteDatabase is called while there is already an open connection to the database that the open connection gets the appropriate versionChange event. \
 That open connection also has an in-progress transaction at the time it gets the versionChange event.");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase, successCallback);
 
 function done()
 {
@@ -18,22 +15,23 @@
 
 var stopSpinning = false;
 
-var request = window.indexedDB.open("DeleteDatabase2TestDatabase");
-request.onsuccess = function()
+function successCallback()
 {
     debug("open db success");
 }
-request.onerror = function(e)
-{
-    debug("Open request error: " + request.error.name);
-}
 
-request.onupgradeneeded = function(e)
+var dbname;
+function prepareDatabase(e)
 {
     debug("Initial upgrade old version - " + e.oldVersion + " new version - " + e.newVersion);
     
-    var versionTransaction = request.transaction;
+    event.target.onerror = function(e) {
+        debug("Open request error: " + event.target.error.name);
+    }
+
+    var versionTransaction = event.target.transaction;
     var database = event.target.result;
+    dbname = database.name;
     var objectStore = database.createObjectStore("TestObjectStore");
     objectStore.put("This is a record", 1);
     
@@ -55,17 +53,17 @@
         window.setTimeout(shutErDown, 0);
     }
         
-    request.transaction.oncomplete = function()
+    event.target.transaction.oncomplete = function()
     {
         debug("First version change complete");
     }
     
-    request.transaction.onabort = function()
+    event.target.transaction.onabort = function()
     {
         debug("Version change unexpected abort");
         done();
     }
-    request.transaction.onerror = function()
+    event.target.transaction.onerror = function()
     {
         debug("Version change unexpected error");
         done();
@@ -77,7 +75,7 @@
 function continueTest1()
 {
     debug("Requesting deleteDatabase");
-    var request = window.indexedDB.deleteDatabase("DeleteDatabase2TestDatabase");
+    var request = window.indexedDB.deleteDatabase(dbname);
     request.onsuccess = function(e)
     {
         debug("Delete database success: oldVersion " + e.oldVersion + ", newVersion " + e.newVersion);
@@ -98,7 +96,7 @@
 function continueTest2()
 {
     debug("Recreating database to make sure it's new and empty");
-    var request = window.indexedDB.open("DeleteDatabase2TestDatabase");
+    var request = window.indexedDB.open(dbname);
 
     request.onupgradeneeded = function(e)
     {
diff --git a/LayoutTests/storage/indexeddb/modern/resources/deletedatabase-null-name-exception.js b/LayoutTests/storage/indexeddb/modern/resources/deletedatabase-null-name-exception.js
index 7b3f727..95ae93a 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/deletedatabase-null-name-exception.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/deletedatabase-null-name-exception.js
@@ -1,9 +1,5 @@
 description("This test calls deleteDatabase on window.indexedDB with a null database name, making sure there is an exception.");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
 
 function done()
 {
diff --git a/LayoutTests/storage/indexeddb/modern/resources/deletedatabase-request-event.js b/LayoutTests/storage/indexeddb/modern/resources/deletedatabase-request-event.js
index 4fb6f9f6..23b8dbc 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/deletedatabase-request-event.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/deletedatabase-request-event.js
@@ -1,9 +1,5 @@
 description("This test calls deleteDatabase on window.indexedDB and verifies that an event is fired at the request.");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
 
 function done()
 {
diff --git a/LayoutTests/storage/indexeddb/modern/resources/deletedatabase-request.js b/LayoutTests/storage/indexeddb/modern/resources/deletedatabase-request.js
index 2c7e489..c44192a 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/deletedatabase-request.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/deletedatabase-request.js
@@ -1,9 +1,5 @@
 description("This test calls deleteDatabase on window.indexedDB and verifies that an IDBOpenDBRequest object is returned.");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
 
 function done()
 {
diff --git a/LayoutTests/storage/indexeddb/modern/resources/deleteindex-1.js b/LayoutTests/storage/indexeddb/modern/resources/deleteindex-1.js
index 8b871ba..056f4e5 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/deleteindex-1.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/deleteindex-1.js
@@ -1,9 +1,7 @@
 description("This tests deleting an index and then committing the transaction.");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
@@ -45,11 +43,11 @@
     } 
 }
 
-var createRequest = window.indexedDB.open("DeleteIndex1Database", 1);
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     database = event.target.result;
     objectStore = database.createObjectStore("TestObjectStore");
     objectStore.put({ bar: "A" }, 1);
diff --git a/LayoutTests/storage/indexeddb/modern/resources/deleteindex-2.js b/LayoutTests/storage/indexeddb/modern/resources/deleteindex-2.js
index 0e9b32e..82d51a5 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/deleteindex-2.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/deleteindex-2.js
@@ -1,9 +1,7 @@
 description("This tests deleting an index and then aborting the transaction.");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
@@ -42,12 +40,15 @@
     } 
 }
 
-var createRequest = window.indexedDB.open("DeleteIndex2Database", 1);
-createRequest.onupgradeneeded = function(event) {
+var dbname;
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    event.target.onerror = null;
+    var versionTransaction = event.target.transaction;
     database = event.target.result;
+    dbname = database.name;
     objectStore = database.createObjectStore("TestObjectStore");
     objectStore.put({ bar: "A" }, 1);
     objectStore.put({ bar: "A" }, 2);
@@ -74,12 +75,12 @@
 }
 
 function continueTest1() {
-    var createRequest = window.indexedDB.open("DeleteIndex2Database", 2);
+    var createRequest = window.indexedDB.open(dbname, 2);
     createRequest.onupgradeneeded = function(event) {
         debug("Second upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
         database = event.target.result;
-        var versionTransaction = createRequest.transaction;
+        var versionTransaction = event.target.transaction;
         objectStore = versionTransaction.objectStore("TestObjectStore");
         objectStore.deleteIndex("TestIndex1");
         debug("Deleted the index");
@@ -104,11 +105,11 @@
 }
 
 function continueTest2() {
-    var createRequest = window.indexedDB.open("DeleteIndex2Database", 3);
+    var createRequest = window.indexedDB.open(dbname, 3);
     createRequest.onupgradeneeded = function(event) {
         debug("Third upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-        var versionTransaction = createRequest.transaction;
+        var versionTransaction = event.target.transaction;
         objectStore = versionTransaction.objectStore("TestObjectStore");
         index = objectStore.index("TestIndex1");
     
diff --git a/LayoutTests/storage/indexeddb/modern/resources/deleteobjectstore-1.js b/LayoutTests/storage/indexeddb/modern/resources/deleteobjectstore-1.js
index 24f50e1..d28a18c 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/deleteobjectstore-1.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/deleteobjectstore-1.js
@@ -2,23 +2,23 @@
 It then deletes it, but aborts that transaction. \
 Finally it checks to make sure everything from step 1 is there as expected.");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
     finishJSTest();
 }
 
-var createRequest = window.indexedDB.open("DeleteObjectStore1Database", 1);
-
-createRequest.onupgradeneeded = function(event) {
+var dbname;
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    event.target.onerror = null;
+    var versionTransaction = event.target.transaction;
     var database = event.target.result;
+    dbname = database.name;
     var objectStore = database.createObjectStore("TestObjectStore");
     for (var i = 0; i < 10; ++i)
         objectStore.put("AH AH AH AH AH", i + " puts");
@@ -46,7 +46,7 @@
 
 function continueTest1()
 {
-    var openRequest = window.indexedDB.open("DeleteObjectStore1Database", 2);
+    var openRequest = window.indexedDB.open(dbname, 2);
 
     openRequest.onerror = function(event) {
         debug("Request error - " + event);
@@ -90,7 +90,7 @@
 
 function continueTest2()
 {
-    var openRequest = window.indexedDB.open("DeleteObjectStore1Database", 1);
+    var openRequest = window.indexedDB.open(dbname, 1);
 
     openRequest.onerror = function(event) {
         debug("Request unexpected error - " + event);
diff --git a/LayoutTests/storage/indexeddb/modern/resources/double-abort.js b/LayoutTests/storage/indexeddb/modern/resources/double-abort.js
index 87eb787..24fe1dc 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/double-abort.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/double-abort.js
@@ -1,21 +1,18 @@
 description("This test aborts the same transaction twice, making the appropriate exception is thrown.");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
     finishJSTest();
 }
 
-var createRequest = window.indexedDB.open("DoubleAbortTestDatabase", 1);
-
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     var database = event.target.result;
 
     versionTransaction.abort();
diff --git a/LayoutTests/storage/indexeddb/modern/resources/double-open.js b/LayoutTests/storage/indexeddb/modern/resources/double-open.js
index 01d8ca3..ab24d2a 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/double-open.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/double-open.js
@@ -15,13 +15,15 @@
     testRunner.waitUntilDone();
 }
 
-var req1 = indexedDB.open("testDB");
+var dbname = "TestDB" + Date();
+
+var req1 = indexedDB.open(dbname);
 req1.onerror = function() {
     debug("First request unexpected error");
     done();
 }
 
-var req2 = indexedDB.open("testDB");
+var req2 = indexedDB.open(dbname);
 req2.onsuccess = function() {
     debug("Second request done");
     done();
diff --git a/LayoutTests/storage/indexeddb/modern/resources/get-index-failures.js b/LayoutTests/storage/indexeddb/modern/resources/get-index-failures.js
index 318a2de..e05181a 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/get-index-failures.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/get-index-failures.js
@@ -1,9 +1,7 @@
 description("This tests some obvious failures that can happen while calling IDBObjectStore.index().");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
@@ -15,14 +13,15 @@
     debug(message);
 }
 
-var createRequest = window.indexedDB.open("IDBObjectStoreGetIndexFailuresDatabase", 1);
 var database;
-
-createRequest.onupgradeneeded = function(event) {
+var dbname;
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     database = event.target.result;
+    dbname = database.name;
     var objectStore = database.createObjectStore("TestObjectStore");
     objectStore.createIndex("TestIndex", "foo");
     
@@ -81,11 +80,11 @@
 
 function continueTest2()
 {
-    var createRequest = window.indexedDB.open("IDBObjectStoreGetIndexFailuresDatabase", 2);
+    var createRequest = window.indexedDB.open(dbname, 2);
     createRequest.onupgradeneeded = function(event) {
         debug("Second upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-        var versionTransaction = createRequest.transaction;
+        var versionTransaction = event.target.transaction;
         var database = event.target.result;
         var objectStore = versionTransaction.objectStore("TestObjectStore");
         database.deleteObjectStore("TestObjectStore");
diff --git a/LayoutTests/storage/indexeddb/modern/resources/get-keyrange.js b/LayoutTests/storage/indexeddb/modern/resources/get-keyrange.js
index 94eae87..040f219 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/get-keyrange.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/get-keyrange.js
@@ -1,26 +1,23 @@
 description("This test exercises IDBObjectStore.get() with an IDBKeyRange as the parameter.");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
     finishJSTest();
 }
 
-var createRequest = window.indexedDB.open("GetKeyRangeDatabase", 1);
 var database;
 
 var date1 = new Date("1955-11-05T00:00:00");
 var date2 = new Date("1955-11-12T18:00:00");
 var date3 = new Date("2015-10-21T16:00:00");
     
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event) {
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     database = event.target.result;
     var objectStore = database.createObjectStore("TestObjectStore");
 
diff --git a/LayoutTests/storage/indexeddb/modern/resources/idbdatabase-deleteobjectstore-failures.js b/LayoutTests/storage/indexeddb/modern/resources/idbdatabase-deleteobjectstore-failures.js
index c637a4b..770ea06 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/idbdatabase-deleteobjectstore-failures.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/idbdatabase-deleteobjectstore-failures.js
@@ -1,23 +1,22 @@
 description("This tests some obvious failures that can happen while calling IDBDatabase.deleteObjectStore()");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
     finishJSTest();
 }
 
-var createRequest = window.indexedDB.open("IDBDatabaseDeleteObjectStoreFailuresDatabase", 1);
 var database;
-
-createRequest.onupgradeneeded = function(event) {
+var dbname;
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     database = event.target.result;
+    dbname = database.name;
     var objectStore = database.createObjectStore("TestObjectStore");
     var request = objectStore.put("bar", "foo");
 
@@ -71,7 +70,7 @@
 
 function continueTest2()
 {
-    var openRequest = window.indexedDB.open("IDBDatabaseDeleteObjectStoreFailuresDatabase", 2);
+    var openRequest = window.indexedDB.open(dbname, 2);
 
     openRequest.onerror = function(event) {
         debug("Request unexpected error - " + event);
@@ -89,7 +88,7 @@
     openRequest.onupgradeneeded = function(event) {
         debug("Second upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
     
-        var versionTransaction = openRequest.transaction;
+        var versionTransaction = event.target.transaction;
         database = event.target.result;
 
         try {
diff --git a/LayoutTests/storage/indexeddb/modern/resources/idbdatabase-transaction-failures.js b/LayoutTests/storage/indexeddb/modern/resources/idbdatabase-transaction-failures.js
index efa1cc4..e962fdb 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/idbdatabase-transaction-failures.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/idbdatabase-transaction-failures.js
@@ -1,22 +1,20 @@
 description("This tests some obvious failures that can happen while calling IDBDatabase.transaction()");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
     finishJSTest();
 }
 
-var createRequest = window.indexedDB.open("IDBDatabaseTransactionFailuresDatabase");
 var database;
 
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     database = event.target.result;
     var objectStore = database.createObjectStore("TestObjectStore");
     var request = objectStore.put("foo", "bar");
diff --git a/LayoutTests/storage/indexeddb/modern/resources/idbindex-properties-basic.js b/LayoutTests/storage/indexeddb/modern/resources/idbindex-properties-basic.js
index a4d6530..13916ee 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/idbindex-properties-basic.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/idbindex-properties-basic.js
@@ -1,9 +1,7 @@
 description("This tests getting basic properties on an IDBIndex.");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
@@ -25,15 +23,15 @@
     debug(index.unique);
 }
 
-var createRequest = window.indexedDB.open("IDBIndexPropertiesBasicDatabase", 1);
 var database;
 
 var indexes = new Array();
 
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     database = event.target.result;
     var objectStore = database.createObjectStore("TestObjectStore");
     
diff --git a/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-clear-1.js b/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-clear-1.js
index a98d4c3..19fc51a 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-clear-1.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-clear-1.js
@@ -1,23 +1,24 @@
 description("This test creates an object store then populates it. \
 It then clears it and makes sure it has nothing left in it.");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
     finishJSTest();
 }
 
-var createRequest = window.indexedDB.open("IDBObjectStoreClearDatabase", 1);
-
-createRequest.onupgradeneeded = function(event) {
+var dbname;
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    event.target.onerror = null;
+
+    var versionTransaction = event.target.transaction;
     var database = event.target.result;
+    dbname = database.name
     var objectStore = database.createObjectStore("TestObjectStore", { autoIncrement: true });
     var request = objectStore.put("bar1");
     var request = objectStore.put("bar2");
@@ -52,7 +53,7 @@
 
 function continueTest1()
 {
-    var openRequest = window.indexedDB.open("IDBObjectStoreClearDatabase", 1);
+    var openRequest = window.indexedDB.open(dbname, 1);
 
     openRequest.onerror = function(event) {
         debug("Request unexpected error - " + event);
diff --git a/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-clear-2.js b/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-clear-2.js
index fedaf61..8dd41e0 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-clear-2.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-clear-2.js
@@ -2,23 +2,24 @@
 It then clears it, but aborts that transaction. \
 Finally it checks to make sure everything from step 1 is still in there.");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
     finishJSTest();
 }
 
-var createRequest = window.indexedDB.open("IDBObjectStoreClear2Database", 1);
-
-createRequest.onupgradeneeded = function(event) {
+var dbname;
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    event.target.onerror = null;
+
+    var versionTransaction = event.target.transaction;
     var database = event.target.result;
+    dbname = database.name;
     var objectStore = database.createObjectStore("TestObjectStore", { autoIncrement: true });
     var request = objectStore.put("bar1");
     var request = objectStore.put("bar2");
@@ -53,7 +54,7 @@
 
 function continueTest1()
 {
-    var openRequest = window.indexedDB.open("IDBObjectStoreClear2Database", 1);
+    var openRequest = window.indexedDB.open(dbname, 1);
 
     openRequest.onerror = function(event) {
         debug("Request unexpected error - " + event);
@@ -118,7 +119,7 @@
 
 function continueTest2()
 {
-    var openRequest = window.indexedDB.open("IDBObjectStoreClear2Database", 1);
+    var openRequest = window.indexedDB.open(dbname, 1);
 
     openRequest.onerror = function(event) {
         debug("Request unexpected error - " + event);
diff --git a/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-count-1.js b/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-count-1.js
index 8f59ed8..5334288 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-count-1.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-count-1.js
@@ -1,16 +1,13 @@
 description("This test exercises various uses of IDBObjectStore.count()");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
     finishJSTest();
 }
 
-var createRequest = window.indexedDB.open("IDBObjectStoreCount1Database", 1);
 var database;
 var objectStore;
 
@@ -40,10 +37,11 @@
     getCount(7);    
 }
 
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     database = event.target.result;
     objectStore = database.createObjectStore("TestObjectStore");
     
diff --git a/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-count-failures.js b/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-count-failures.js
index 1aa6ea3..e31c8ff 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-count-failures.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-count-failures.js
@@ -1,22 +1,20 @@
 description("This tests some obvious failures that can happen while calling IDBObjectStore.count().");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
     finishJSTest();
 }
 
-var createRequest = window.indexedDB.open("IDBObjectStoreCountFailuresDatabase", 1);
 var database;
 
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     database = event.target.result;
     var objectStore = database.createObjectStore("TestObjectStore");
     var request = objectStore.put("bar", "foo");
diff --git a/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-delete-1.js b/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-delete-1.js
index 0b3e335..f5b9ade 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-delete-1.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-delete-1.js
@@ -1,10 +1,7 @@
 description("This test exercises various uses of IDBObjectStore.delete()");
 
+indexedDBTest(prepareDatabase);
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
 
 function log(message)
 {
@@ -24,7 +21,6 @@
     finishJSTest();
 }
 
-var createRequest = window.indexedDB.open("IDBObjectStoreDelete1Database", 1);
 var database;
 var objectStore;
 
@@ -37,10 +33,11 @@
 var date7 = new Date("2000-01-03T00:00:00");
 var date8 = new Date("2000-01-04T00:00:00");
 
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     database = event.target.result;
     objectStore = database.createObjectStore("TestObjectStore");
     
diff --git a/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-delete-2.js b/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-delete-2.js
index fe7276a..b685fc2 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-delete-2.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-delete-2.js
@@ -1,10 +1,7 @@
 description("This test exercises IDBObjectStore.delete() followed by an abort to make sure the delete is un-done.");
 
+indexedDBTest(prepareDatabase);
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
 
 function log(message)
 {
@@ -24,13 +21,13 @@
     finishJSTest();
 }
 
-var createRequest = window.indexedDB.open("IDBObjectStoreDelete2Database", 1);
 var database;
 
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     database = event.target.result;
     database.createObjectStore("TestObjectStore").put("bar", "foo");
 
diff --git a/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-delete-failures.js b/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-delete-failures.js
index 0dcd2a9..505aec4 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-delete-failures.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-delete-failures.js
@@ -1,10 +1,7 @@
 description("This tests some obvious failures that can happen while calling IDBObjectStore.delete().");
 
+indexedDBTest(prepareDatabase);
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
 
 function log(message)
 {
@@ -16,13 +13,13 @@
     finishJSTest();
 }
 
-var createRequest = window.indexedDB.open("IDBObjectStoreDeleteFailuresDatabase", 1);
 var database;
 
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     database = event.target.result;
     var objectStore = database.createObjectStore("TestObjectStore");
     var request = objectStore.put("bar", "foo");
diff --git a/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-get-failures.js b/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-get-failures.js
index 48d31fa..98218b9 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-get-failures.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-get-failures.js
@@ -1,22 +1,20 @@
 description("This tests some obvious failures that can happen while calling IDBObjectStore.get().");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
     finishJSTest();
 }
 
-var createRequest = window.indexedDB.open("IDBObjectStoreGetFailuresDatabase", 1);
 var database;
 
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     database = event.target.result;
     var objectStore = database.createObjectStore("TestObjectStore");
     var request = objectStore.put("bar", "foo");
diff --git a/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-put-and-clear-failures.js b/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-put-and-clear-failures.js
index 652e138..81f18f4 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-put-and-clear-failures.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-put-and-clear-failures.js
@@ -1,22 +1,20 @@
 description("This tests some obvious failures that can happen while calling IDBObjectStore.put() and IDBObjectStore.clear().");
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
     finishJSTest();
 }
 
-var createRequest = window.indexedDB.open("IDBObjectStorePutAndClearFailuresDatabase", 1);
 var database;
 
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     database = event.target.result;
     var objectStore = database.createObjectStore("TestObjectStore");
     var request = objectStore.put("bar", "foo");
diff --git a/LayoutTests/storage/indexeddb/modern/resources/idbtransaction-objectstore-failures.js b/LayoutTests/storage/indexeddb/modern/resources/idbtransaction-objectstore-failures.js
index 2be7c13..3a889f5 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/idbtransaction-objectstore-failures.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/idbtransaction-objectstore-failures.js
@@ -1,23 +1,18 @@
 description("This tests some obvious failures that can happen while calling transaction.objectStore()");
 
+indexedDBTest(prepareDatabase);
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
-
-var request = window.indexedDB.open("TransactionObjectStoreFailuresTestDatabase");
 
 function done()
 {
     finishJSTest();
 }
 
-request.onupgradeneeded = function(event)
+function prepareDatabase(event)
 {
     debug("Upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
     
-    var tx = request.transaction;
+    var tx = event.target.transaction;
     var db = event.target.result;
 
     debug(tx + " - " + tx.mode);
@@ -73,4 +68,3 @@
         done();
     }
 }
-
diff --git a/LayoutTests/storage/indexeddb/modern/resources/index-1.js b/LayoutTests/storage/indexeddb/modern/resources/index-1.js
index 78a10d0..4799f3f 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/index-1.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/index-1.js
@@ -1,8 +1,7 @@
 description("This tests the expected values from some more complex index situations.");
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
@@ -14,8 +13,6 @@
     debug(message);
 }
 
-var createRequest = window.indexedDB.open("Index1Database", 1);
-
 function checkKey(index, key)
 {
     var request1 = index.get(key);
@@ -55,10 +52,11 @@
     }
 }
 
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     var database = event.target.result;
     var objectStore = database.createObjectStore("TestObjectStore");
     var index1 = objectStore.createIndex("TestIndex1", "bar");
diff --git a/LayoutTests/storage/indexeddb/modern/resources/index-2.js b/LayoutTests/storage/indexeddb/modern/resources/index-2.js
index 49ad6e0..fd979e4 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/index-2.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/index-2.js
@@ -1,8 +1,7 @@
 description("This tests indexes are left in appropriate states after aborted transactions.");
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
@@ -14,8 +13,6 @@
     debug(message);
 }
 
-var createRequest = window.indexedDB.open("Index2Database", 1);
-
 function checkKey(index, key)
 {
     var request1 = index.get(key);
@@ -49,10 +46,11 @@
 
 var database;
 
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     database = event.target.result;
     var objectStore = database.createObjectStore("TestObjectStore");
     var index1 = objectStore.createIndex("TestIndex1", "bar");
diff --git a/LayoutTests/storage/indexeddb/modern/resources/index-3.js b/LayoutTests/storage/indexeddb/modern/resources/index-3.js
index 4e916cd..48b26fc 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/index-3.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/index-3.js
@@ -1,8 +1,7 @@
 description("This test exercises the \"unique\" constraint of indexes.");
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
@@ -14,7 +13,6 @@
     debug(message);
 }
 
-var createRequest = window.indexedDB.open("Index3Database", 1);
 var objectStore;
 
 function checkObjectStore()
@@ -41,10 +39,11 @@
     }
 }
 
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     var database = event.target.result;
     objectStore = database.createObjectStore("TestObjectStore");
     var i1 = objectStore.createIndex("TestIndex1", "bar", { unique: true });
diff --git a/LayoutTests/storage/indexeddb/modern/resources/index-4.js b/LayoutTests/storage/indexeddb/modern/resources/index-4.js
index 9263d87..1c04bf8 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/index-4.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/index-4.js
@@ -1,8 +1,7 @@
 description("This tests that indexes added to an object store with existing records are populated upon their creation.");
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
@@ -42,11 +41,11 @@
     } 
 }
 
-var createRequest = window.indexedDB.open("Index4Database", 1);
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     var database = event.target.result;
     objectStore = database.createObjectStore("TestObjectStore");
     objectStore.put({ bar: "A" }, 1);
diff --git a/LayoutTests/storage/indexeddb/modern/resources/index-5.js b/LayoutTests/storage/indexeddb/modern/resources/index-5.js
index f4de387..0e35a42 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/index-5.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/index-5.js
@@ -1,8 +1,7 @@
 description("This tests creating an index on an object store that already has records, and those records would violate the unique constraint of the index. (The index creation should fail).");
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
@@ -44,11 +43,11 @@
     } 
 }
 
-var createRequest = window.indexedDB.open("Index5Database", 1);
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     var database = event.target.result;
     objectStore = database.createObjectStore("TestObjectStore");
     objectStore.put({ bar: "A" }, 1);
diff --git a/LayoutTests/storage/indexeddb/modern/resources/index-cursor-1.js b/LayoutTests/storage/indexeddb/modern/resources/index-cursor-1.js
index 3702fd6..720d5f5 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/index-cursor-1.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/index-cursor-1.js
@@ -1,8 +1,7 @@
 description("This tests cursors that iterate over entire indexes.");
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
@@ -75,11 +74,11 @@
     eval(command);
 }
     
-var createRequest = window.indexedDB.open("IndexCursor1Database", 1);
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     var database = event.target.result;
     var objectStore = database.createObjectStore("TestObjectStore");
     index1 = objectStore.createIndex("TestIndex1", "bar");
diff --git a/LayoutTests/storage/indexeddb/modern/resources/index-cursor-2.js b/LayoutTests/storage/indexeddb/modern/resources/index-cursor-2.js
index f6f568a..c26413f 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/index-cursor-2.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/index-cursor-2.js
@@ -1,8 +1,7 @@
 description("This tests cursors that iterate over parts of indexes.");
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
@@ -85,11 +84,11 @@
     eval(command);
 }
     
-var createRequest = window.indexedDB.open("IndexCursor2Database", 1);
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     var database = event.target.result;
     var objectStore = database.createObjectStore("TestObjectStore");
     index = objectStore.createIndex("TestIndex1", "bar");
diff --git a/LayoutTests/storage/indexeddb/modern/resources/index-cursor-3.js b/LayoutTests/storage/indexeddb/modern/resources/index-cursor-3.js
index 73a3606..d0f44ec 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/index-cursor-3.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/index-cursor-3.js
@@ -1,8 +1,7 @@
 description("This tests that index cursors properly handle changing indexes.");
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
@@ -142,11 +141,11 @@
     objectStore.put({ bar: "I" }, 18);  
 }
 
-var createRequest = window.indexedDB.open("IndexCursor3Database", 1);
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     var database = event.target.result;
     objectStore = database.createObjectStore("TestObjectStore");
     index = objectStore.createIndex("TestIndex1", "bar");
diff --git a/LayoutTests/storage/indexeddb/modern/resources/index-get-count-basic.js b/LayoutTests/storage/indexeddb/modern/resources/index-get-count-basic.js
index d6d5d56..84d5eb8 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/index-get-count-basic.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/index-get-count-basic.js
@@ -1,8 +1,7 @@
 description("This tests the most basic operation of the IDBIndex methods get(), getKey(), and count().");
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
@@ -14,12 +13,11 @@
     debug(message);
 }
 
-var createRequest = window.indexedDB.open("IndexGetCountBasicDatabase", 1);
-
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     var database = event.target.result;
     var objectStore = database.createObjectStore("TestObjectStore");
     var index = objectStore.createIndex("TestIndex", "bar");
diff --git a/LayoutTests/storage/indexeddb/modern/resources/index-get-count-failures.js b/LayoutTests/storage/indexeddb/modern/resources/index-get-count-failures.js
index 5e37a6a..27bcbaa 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/index-get-count-failures.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/index-get-count-failures.js
@@ -1,8 +1,7 @@
 description("This tests some obvious failures that can happen while calling the IDBIndex methods get(), getKey(), and count().");
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
@@ -14,14 +13,14 @@
     debug(message);
 }
 
-var createRequest = window.indexedDB.open("IndexGetCountFailuresDatabase", 1);
 var database;
 var index;
 
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     database = event.target.result;
     var objectStore = database.createObjectStore("TestObjectStore");
     index = objectStore.createIndex("TestIndex", "foo");
diff --git a/LayoutTests/storage/indexeddb/modern/resources/keypath-basic.js b/LayoutTests/storage/indexeddb/modern/resources/keypath-basic.js
index b364c7f..4b09f44 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/keypath-basic.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/keypath-basic.js
@@ -1,22 +1,18 @@
 description("This test creates some object stores with keypaths. It then puts some values in them. It makes sure the keys used are as expected.");
 
+indexedDBTest(prepareDatabase);
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
 
 function done()
 {
     finishJSTest();
 }
 
-var createRequest = window.indexedDB.open("KeypathBasicTestDatabase", 1);
-
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     var database = event.target.result;    
     var objectStore1 = database.createObjectStore("OS1", { keyPath: "foo" });
     var objectStore2 = database.createObjectStore("OS2", { keyPath: "foo.bar" });
diff --git a/LayoutTests/storage/indexeddb/modern/resources/objectstore-attributes.js b/LayoutTests/storage/indexeddb/modern/resources/objectstore-attributes.js
index 4953b7b..76870d1 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/objectstore-attributes.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/objectstore-attributes.js
@@ -1,10 +1,7 @@
 description("This test exercises the readonly attributes on an IDBObjectStore.");
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
 
-var request = window.indexedDB.open("ObjectStoreAttributesTestDatabase");
+indexedDBTest(prepareDatabase);
+
 
 function log(message)
 {
@@ -18,11 +15,11 @@
 
 var database;
 
-request.onupgradeneeded = function(event)
+function prepareDatabase(event)
 {
     debug("First upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
     
-    var tx = request.transaction;
+    var tx = event.target.transaction;
     database = event.target.result;
 
     debug(tx + " - " + tx.mode);
diff --git a/LayoutTests/storage/indexeddb/modern/resources/objectstore-cursor-advance-failures.js b/LayoutTests/storage/indexeddb/modern/resources/objectstore-cursor-advance-failures.js
index 4bcee80..1151c20 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/objectstore-cursor-advance-failures.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/objectstore-cursor-advance-failures.js
@@ -1,8 +1,7 @@
 description("This tests some obvious failures that can happen while calling IDBCursor.advance() on object store cursors.");
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
@@ -14,13 +13,13 @@
     debug(message);
 }
 
-var createRequest = window.indexedDB.open("IDBAdvanceFailuresDatabase", 1);
 var database;
 
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     database = event.target.result;
     var objectStore = database.createObjectStore("TestObjectStore");
     for (var i = 0; i < 10; ++i)
diff --git a/LayoutTests/storage/indexeddb/modern/resources/objectstore-cursor-continue-failures.js b/LayoutTests/storage/indexeddb/modern/resources/objectstore-cursor-continue-failures.js
index 5244540..0ccf5e7 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/objectstore-cursor-continue-failures.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/objectstore-cursor-continue-failures.js
@@ -1,8 +1,7 @@
 description("This tests some obvious failures that can happen while calling IDBCursor.continue() on object store cursors.");
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
@@ -14,13 +13,13 @@
     debug(message);
 }
 
-var createRequest = window.indexedDB.open("IDBContinueFailuresDatabase", 1);
 var database;
 
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     database = event.target.result;
     var objectStore = database.createObjectStore("TestObjectStore");
     for (var i = 0; i < 10; ++i)
diff --git a/LayoutTests/storage/indexeddb/modern/resources/opencursor-failures.js b/LayoutTests/storage/indexeddb/modern/resources/opencursor-failures.js
index 7435f67..8652ab7 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/opencursor-failures.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/opencursor-failures.js
@@ -1,8 +1,7 @@
 description("This tests some obvious failures that can happen while opening cursors.");
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+
+indexedDBTest(prepareDatabase);
+
 
 function done()
 {
@@ -14,15 +13,15 @@
     debug(message);
 }
 
-var createRequest = window.indexedDB.open("OpenCursorFailuresDatabase", 1);
 var database;
 var objectStore;
 var index;
 
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     database = event.target.result;
     objectStore = database.createObjectStore("TestObjectStore");
     index = objectStore.createIndex("TestIndex", "bar");
diff --git a/LayoutTests/storage/indexeddb/modern/resources/opendatabase-request-event.js b/LayoutTests/storage/indexeddb/modern/resources/opendatabase-request-event.js
index e88c939..e84a316 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/opendatabase-request-event.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/opendatabase-request-event.js
@@ -1,29 +1,26 @@
 description("This test calls open on window.indexedDB in various ways, verifying that IDBOpenDBRequest objects are returned when expected and exceptions are thrown when expected.");
 
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
-
 function done()
 {
     finishJSTest();
 }
 
+var dbname = "TestDatabase" + Date();
+
 try {
-    window.indexedDB.open("TestDatabase", 0);
+    window.indexedDB.open(dbname, 0);
 } catch (e) {
     debug("Caught exception " + e);
 }
 
 try {
-    window.indexedDB.open("TestDatabase", -1);
+    window.indexedDB.open(dbname, -1);
 } catch (e) {
     debug("Caught exception " + e);
 }
 
-var request = window.indexedDB.open("TestDatabase");
+var request = window.indexedDB.open(dbname);
 debug(request);
 
 request.onsuccess = function()
diff --git a/LayoutTests/storage/indexeddb/modern/resources/opendatabase-request.js b/LayoutTests/storage/indexeddb/modern/resources/opendatabase-request.js
index f801327..cbf1062 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/opendatabase-request.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/opendatabase-request.js
@@ -1,17 +1,12 @@
 description("This test calls open on window.indexedDB in various ways, verifying that IDBOpenDBRequest objects are returned when expected and exceptions are thrown when expected.");
 
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
-
 function done()
 {
     finishJSTest();
 }
 
-var request = window.indexedDB.open("TestDatabase");
+var request = window.indexedDB.open("OpenDatabaseRequestTestDatabase" + Date());
 debug(request);
 
 request = window.indexedDB.open("");
diff --git a/LayoutTests/storage/indexeddb/modern/resources/opendatabase-success-after-versionchange.js b/LayoutTests/storage/indexeddb/modern/resources/opendatabase-success-after-versionchange.js
index a518bf3..4489fb8 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/opendatabase-success-after-versionchange.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/opendatabase-success-after-versionchange.js
@@ -2,10 +2,9 @@
     - Opening a new database results in the onupgradeneeded handler being called on the IDBOpenDBRequest. \
     - The versionchange transaction representing the upgrade commits successfully. \
     - After that transaction commits, the onsuccess handler on the original IDBOpenDBRequest is called.");
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+
+indexedDBTest(prepareDatabase, openSuccess);
+
 
 function done()
 {
@@ -19,34 +18,29 @@
 
 var request = window.indexedDB.open("OpenDatabaseSuccessAfterVersionChangeDatabase");
 
-request.onsuccess = function()
+function openSuccess()
 {
     debug("Got the onsuccess handler as expected.");
 	done();
 }
-request.onerror = function(e)
-{
-    debug("Unexpected onerror handler called");
-	done();
-}
 
-request.onupgradeneeded = function(e)
+function prepareDatabase(e)
 {
     debug("upgradeneeded: old version - " + e.oldVersion + " new version - " + e.newVersion);
-    debug(request.transaction);
+    debug(e.target.transaction);
     
-    request.transaction.oncomplete = function()
+    e.target.transaction.oncomplete = function()
     {
         debug("Version change complete");
     }
     
-    request.transaction.onabort = function()
+    e.target.transaction.onabort = function()
     {
         debug("Version change unexpected abort");
         done();
     }
     
-    request.transaction.onerror = function()
+    e.target.transaction.onerror = function()
     {
         debug("Version change unexpected error");
         done();
diff --git a/LayoutTests/storage/indexeddb/modern/resources/opendatabase-versions.js b/LayoutTests/storage/indexeddb/modern/resources/opendatabase-versions.js
index ca5ad30..429843b 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/opendatabase-versions.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/opendatabase-versions.js
@@ -1,16 +1,12 @@
 description("This test creates a new database with the default version, commits that versionchange transaction, and then reopens it at different versions to make sure the IDBOpenDBRequests behave appropriately.");
 
-
+indexedDBTest(prepareDatabase, openSuccessful);
 
 function log(msg)
 {
     document.getElementById("logger").innerHTML += msg + "";
 }
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
 
 function done()
 {
@@ -18,35 +14,36 @@
 }
 
 var request = window.indexedDB.open("VersionTestDatabase");
-debug(request + " (firstPhase)");
 
-request.onsuccess = function()
+function openSuccessful()
 {
     debug("First version change successful");
 }
-request.onerror = function(e)
-{
-    debug("Open request error (firstPhase) " + request.error.name);
-}
 
-request.onupgradeneeded = function(e)
+var dbname;
+function prepareDatabase(e)
 {
     var database = event.target.result;
+    dbname = database.name;
+
+    event.target.onerror = function(e) {
+        debug("Open request error (firstPhase) " + event.target.error.name);
+    }
 
     debug("upgradeneeded (firstPhase): old version - " + e.oldVersion + " new version - " + e.newVersion);
     debug(request.transaction);
-    request.transaction.oncomplete = function()
+    event.target.transaction.oncomplete = function()
     {
         debug("Version change complete (firstPhase). Database version is now - " + database.version);
         database.close();
         secondPhase();
     }
-    request.transaction.onabort = function()
+    event.target.transaction.onabort = function()
     {
         debug("Version change transaction unexpected abort! (firstPhase)");
         done();
     }
-    request.transaction.onerror = function()
+    event.target.transaction.onerror = function()
     {
         debug("Version change transaction unexpected error! (firstPhase)");
         done();
@@ -55,7 +52,7 @@
 
 function secondPhase()
 {
-    var request = window.indexedDB.open("VersionTestDatabase", 1);
+    var request = window.indexedDB.open(dbname, 1);
     debug(request + " (secondPhase)");
     request.onsuccess = function()
     {
@@ -78,7 +75,7 @@
 
 function thirdPhase()
 {
-    var request = window.indexedDB.open("VersionTestDatabase", 2);
+    var request = window.indexedDB.open(dbname, 2);
     debug(request + " (thirdPhase)");
     request.onsuccess = function()
     {
@@ -116,7 +113,7 @@
 function fourthPhase()
 {
     // We've upgraded to version 2, so version 1 should not be openable.
-    var request = window.indexedDB.open("VersionTestDatabase", 1);
+    var request = window.indexedDB.open(dbname, 1);
     debug(request + " (fourthPhase)");
     request.onsuccess = function()
     {
diff --git a/LayoutTests/storage/indexeddb/modern/resources/request-readystate.js b/LayoutTests/storage/indexeddb/modern/resources/request-readystate.js
index 75ef1db..b8c8d80 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/request-readystate.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/request-readystate.js
@@ -1,8 +1,5 @@
 description("This test makes sure that IDBRequest.readyState returns expected values.");
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
+
 
 function done()
 {
@@ -14,7 +11,7 @@
     debug(message);
 }
 
-var createRequest = window.indexedDB.open("RequestReadyStateDatabase", 1);
+var createRequest = window.indexedDB.open("RequestReadyStateDatabase" + Date(), 1);
 debug("After calling indexedDB.open(), create request readyState is: " + createRequest.readyState);
 
 createRequest.onupgradeneeded = function(event) {
diff --git a/LayoutTests/storage/indexeddb/modern/resources/transaction-scheduler-1.js b/LayoutTests/storage/indexeddb/modern/resources/transaction-scheduler-1.js
index f14e7e7..d68dc69 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/transaction-scheduler-1.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/transaction-scheduler-1.js
@@ -1,23 +1,23 @@
 description("This test makes sure that two read-only transactions to an object store are active at the same time.");
 
+indexedDBTest(prepareDatabase);
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
 
 function done()
 {
     finishJSTest();
 }
 
-var createRequest = window.indexedDB.open("TransactionScheduler1Database");
-
-createRequest.onupgradeneeded = function(event) {
+var dbname;
+function prepareDatabase(event)
+{
     debug("Upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    event.target.onerror = null;
+
+    var versionTransaction = event.target.transaction;
     var database = event.target.result;
+    dbname = database.name;
     var objectStore = database.createObjectStore("TestObjectStore");
     var request = objectStore.put("foo", "bar");
 
@@ -45,8 +45,8 @@
 
 function continueTest()
 {
-    var request1 = window.indexedDB.open("TransactionScheduler1Database", 1);
-    var request2 = window.indexedDB.open("TransactionScheduler1Database", 1);
+    var request1 = window.indexedDB.open(dbname, 1);
+    var request2 = window.indexedDB.open(dbname, 1);
 
     setupRequest(request1, "request 1");
     setupRequest(request2, "request 2");
diff --git a/LayoutTests/storage/indexeddb/modern/resources/transaction-scheduler-2.js b/LayoutTests/storage/indexeddb/modern/resources/transaction-scheduler-2.js
index 3e3d642..18007df 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/transaction-scheduler-2.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/transaction-scheduler-2.js
@@ -1,23 +1,23 @@
 description("This test makes sure that two read-only transactions to two different object stores are active at the same time.");
 
+indexedDBTest(prepareDatabase);
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
 
 function done()
 {
     finishJSTest();
 }
 
-var createRequest = window.indexedDB.open("TransactionScheduler2Database");
-
-createRequest.onupgradeneeded = function(event) {
+var dbname;
+function prepareDatabase(event)
+{
     debug("Upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    event.target.onerror = null;
+
+    var versionTransaction = event.target.transaction;
     var database = event.target.result;
+    dbname = database.name;
     var objectStore = database.createObjectStore("OS1");
     var request = objectStore.put("foo1", "bar1");
 
@@ -53,8 +53,8 @@
 
 function continueTest()
 {
-    var request1 = window.indexedDB.open("TransactionScheduler2Database", 1);
-    var request2 = window.indexedDB.open("TransactionScheduler2Database", 1);
+    var request1 = window.indexedDB.open(dbname, 1);
+    var request2 = window.indexedDB.open(dbname, 1);
 
     setupRequest(request1, "OS1");
     setupRequest(request2, "OS2");
diff --git a/LayoutTests/storage/indexeddb/modern/resources/transaction-scheduler-3.js b/LayoutTests/storage/indexeddb/modern/resources/transaction-scheduler-3.js
index e2b6bdc..cd7e981 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/transaction-scheduler-3.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/transaction-scheduler-3.js
@@ -1,23 +1,23 @@
 description("This test makes sure that a write transaction is blocked by a read transaction with overlapping scope. It also makes sure the write transaction starts after the read transaction completes.");
 
+indexedDBTest(prepareDatabase);
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
 
 function done()
 {
     finishJSTest();
 }
 
-var createRequest = window.indexedDB.open("TransactionScheduler3Database");
-
-createRequest.onupgradeneeded = function(event) {
+var dbname;
+function prepareDatabase(event)
+{
     debug("Upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    event.target.onerror = null;
+
+    var versionTransaction = event.target.transaction;
     var database = event.target.result;
+    dbname = database.name;
     var objectStore = database.createObjectStore("OS");
     var request = objectStore.put("bar", "foo");
 
@@ -46,7 +46,7 @@
 var secondDatabaseConnection;
 function continueTest()
 {
-    var longRunningReadRequest = window.indexedDB.open("TransactionScheduler3Database", 1);
+    var longRunningReadRequest = window.indexedDB.open(dbname, 1);
     longRunningReadRequest.onsuccess = function(event) {
         debug("Success opening database connection - Starting readonly transaction");
         secondDatabaseConnection = event.target.result;
diff --git a/LayoutTests/storage/indexeddb/modern/resources/transaction-scheduler-5.js b/LayoutTests/storage/indexeddb/modern/resources/transaction-scheduler-5.js
index f0c7bb540..0e23e44 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/transaction-scheduler-5.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/transaction-scheduler-5.js
@@ -3,24 +3,24 @@
 It then opens a read-write transaction to both object stores. \
 The read-only transactions both need to finish before the read-write transaction starts.");
 
+indexedDBTest(prepareDatabase);
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
 
 function done()
 {
     finishJSTest();
 }
 
-var createRequest = window.indexedDB.open("TransactionScheduler5Database");
-
-createRequest.onupgradeneeded = function(event) {
+var dbname;
+function prepareDatabase(event)
+{
     debug("Upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    event.target.onerror = null;
+
+    var versionTransaction = event.target.transaction;
     var database = event.target.result;
+    dbname = database.name;
     var objectStore = database.createObjectStore("OS1");
     var request = objectStore.put("bar", "foo");
 
@@ -78,7 +78,7 @@
 
 function continueTest()
 {
-    var openDBRequest = window.indexedDB.open("TransactionScheduler5Database", 1);
+    var openDBRequest = window.indexedDB.open(dbname, 1);
     openDBRequest.onsuccess = function(event) {
         debug("Success opening database connection - Starting transactions");
         secondDatabaseConnection = event.target.result;
diff --git a/LayoutTests/storage/indexeddb/modern/resources/transaction-scheduler-6.js b/LayoutTests/storage/indexeddb/modern/resources/transaction-scheduler-6.js
index 0756e2c..3c8a352 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/transaction-scheduler-6.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/transaction-scheduler-6.js
@@ -1,24 +1,21 @@
 description("This test starts two read-only transactions to an object store followed by a read-write transaction. \
 It verifies that the read-write doesn't start until both read-onlys have finished.");
 
+indexedDBTest(prepareDatabase);
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
 
 function done()
 {
     finishJSTest();
 }
 
-var createRequest = window.indexedDB.open("TransactionScheduler6Database");
 var database;
 
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
+    var versionTransaction = event.target.transaction;
     database = event.target.result;
     var objectStore = database.createObjectStore("TestObjectStore");
     var request = objectStore.put("foo", "bar");
diff --git a/LayoutTests/storage/indexeddb/modern/resources/versionchange-abort-then-reopen.js b/LayoutTests/storage/indexeddb/modern/resources/versionchange-abort-then-reopen.js
index c569e99..dd4b137 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/versionchange-abort-then-reopen.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/versionchange-abort-then-reopen.js
@@ -3,25 +3,24 @@
 It then reopens the database, upgrading it's version. It aborts this versionchange, as well. \
 Finally it reopens the database again, upgrading its version, making sure things had reverted back to before the second aborted versionchange.");
 
+indexedDBTest(prepareDatabase);
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
 
 function done()
 {
     finishJSTest();
 }
 
-var createRequest = window.indexedDB.open("VersionChangeAbortTestDatabase", 1);
-
-createRequest.onupgradeneeded = function(event) {
+function prepareDatabase(event)
+{
     debug("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-    var versionTransaction = createRequest.transaction;
-    var database = event.target.result;
+    event.target.onerror = null;
 
+    var versionTransaction = event.target.transaction;
+    var database = event.target.result;
+    event.target.onerror = null;
+    
     versionTransaction.abort();
 
     versionTransaction.onabort = function(event) {
@@ -47,7 +46,7 @@
     createRequest.onupgradeneeded = function(event) {
         debug("Second upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-        var versionTransaction = createRequest.transaction;
+        var versionTransaction = event.target.transaction;
         var database = event.target.result;
 
         versionTransaction.onabort = function(event) {
@@ -75,7 +74,7 @@
     createRequest.onupgradeneeded = function(event) {
         debug("Third upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
 
-        var versionTransaction = createRequest.transaction;
+        var versionTransaction = event.target.transaction;
         var database = event.target.result;
 
         versionTransaction.abort();
diff --git a/LayoutTests/storage/indexeddb/modern/resources/versionchange-event.js b/LayoutTests/storage/indexeddb/modern/resources/versionchange-event.js
index f4556fc..78bdfce 100644
--- a/LayoutTests/storage/indexeddb/modern/resources/versionchange-event.js
+++ b/LayoutTests/storage/indexeddb/modern/resources/versionchange-event.js
@@ -7,37 +7,30 @@
 -Closes the first and second connections \
 -Makes sure the versionchange transaction for the second connection starts successfully");
 
+indexedDBTest(prepareDatabase, openSuccess);
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
 
 function done()
 {
     finishJSTest();
 }
 
-var request = window.indexedDB.open("VersionChangeTestDatabase");
 var connection1;
 var connection2;
 
-request.onsuccess = function()
+function openSuccess()
 {
     debug("First version change successful");
 }
-request.onerror = function(e)
-{
-    debug("Unexpected error (firstPhase)");
-	done();
-}
 
-request.onupgradeneeded = function(e)
+var dbname;
+function prepareDatabase(e)
 {
     var database = event.target.result;
+    dbname = database.name;
 
     debug("upgradeneeded (firstPhase): old version - " + e.oldVersion + " new version - " + e.newVersion);
-    request.transaction.oncomplete = function()
+    event.target.transaction.oncomplete = function()
     {
         debug("Version change complete (firstPhase). Database version is now - " + database.version);
 
@@ -50,12 +43,12 @@
         }
         secondPhase();
     }
-    request.transaction.onabort = function()
+    event.target.transaction.onabort = function()
     {
         debug("Version change transaction unexpected abort (firstPhase)");
         done();
     }
-    request.transaction.onerror = function()
+    event.target.transaction.onerror = function()
     {
         debug("Version change transaction unexpected error (firstPhase)");
         done();
@@ -64,7 +57,7 @@
 
 function secondPhase()
 {
-    var request = window.indexedDB.open("VersionChangeTestDatabase", 1);
+    var request = window.indexedDB.open(dbname, 1);
     request.onsuccess = function()
     {
         debug("Open success (secondPhase)");
@@ -91,7 +84,7 @@
 
 function thirdPhase()
 {
-    var request = window.indexedDB.open("VersionChangeTestDatabase", 2);
+    var request = window.indexedDB.open(dbname, 2);
     debug("thirdPhase - Requested database connection with version 2");
     request.onsuccess = function()
     {
diff --git a/LayoutTests/storage/indexeddb/modern/transaction-scheduler-1-expected.txt b/LayoutTests/storage/indexeddb/modern/transaction-scheduler-1-expected.txt
index 41b2a1f..f1cd5ee 100644
--- a/LayoutTests/storage/indexeddb/modern/transaction-scheduler-1-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/transaction-scheduler-1-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Upgrade needed: Old version - 0 New version - 1
 versionchange transaction completed
 Success opening database connection - request 1
diff --git a/LayoutTests/storage/indexeddb/modern/transaction-scheduler-2-expected.txt b/LayoutTests/storage/indexeddb/modern/transaction-scheduler-2-expected.txt
index 8a6188a2..b934e1e 100644
--- a/LayoutTests/storage/indexeddb/modern/transaction-scheduler-2-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/transaction-scheduler-2-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Upgrade needed: Old version - 0 New version - 1
 versionchange transaction completed
 Success opening database connection - Starting transaction to ObjectStore OS1
diff --git a/LayoutTests/storage/indexeddb/modern/transaction-scheduler-3-expected.txt b/LayoutTests/storage/indexeddb/modern/transaction-scheduler-3-expected.txt
index 9f1f765..19b6457 100644
--- a/LayoutTests/storage/indexeddb/modern/transaction-scheduler-3-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/transaction-scheduler-3-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Upgrade needed: Old version - 0 New version - 1
 versionchange transaction completed
 Success opening database connection - Starting readonly transaction
diff --git a/LayoutTests/storage/indexeddb/modern/transaction-scheduler-5-expected.txt b/LayoutTests/storage/indexeddb/modern/transaction-scheduler-5-expected.txt
index 5091634..a02f4df 100644
--- a/LayoutTests/storage/indexeddb/modern/transaction-scheduler-5-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/transaction-scheduler-5-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Upgrade needed: Old version - 0 New version - 1
 versionchange transaction completed
 Success opening database connection - Starting transactions
diff --git a/LayoutTests/storage/indexeddb/modern/transaction-scheduler-6-expected.txt b/LayoutTests/storage/indexeddb/modern/transaction-scheduler-6-expected.txt
index 0255d7d..d6a48df 100644
--- a/LayoutTests/storage/indexeddb/modern/transaction-scheduler-6-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/transaction-scheduler-6-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Upgrade needed: Old version - 0 New version - 1
 versionchange transaction completed
 Starting a readonly transaction
diff --git a/LayoutTests/storage/indexeddb/modern/versionchange-abort-then-reopen-expected.txt b/LayoutTests/storage/indexeddb/modern/versionchange-abort-then-reopen-expected.txt
index acc00c6..3ac8194 100644
--- a/LayoutTests/storage/indexeddb/modern/versionchange-abort-then-reopen-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/versionchange-abort-then-reopen-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 Initial upgrade needed: Old version - 0 New version - 1
 Initial upgrade versionchange transaction aborted
 Second upgrade needed: Old version - 0 New version - 1
diff --git a/LayoutTests/storage/indexeddb/modern/versionchange-event-expected.txt b/LayoutTests/storage/indexeddb/modern/versionchange-event-expected.txt
index 45f7b9d..6e40dbb 100644
--- a/LayoutTests/storage/indexeddb/modern/versionchange-event-expected.txt
+++ b/LayoutTests/storage/indexeddb/modern/versionchange-event-expected.txt
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
 upgradeneeded (firstPhase): old version - 0 new version - 1
 Version change complete (firstPhase). Database version is now - 1
 First version change successful