| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>IndexedDB: aborting transactions reverts object store metadata</title> | 2 <title>IndexedDB: aborting transactions reverts object store metadata</title> |
| 3 <script src='../../resources/testharness.js'></script> | |
| 4 <link rel="help" href="https://w3c.github.io/IndexedDB/#abort-transaction"> | 3 <link rel="help" href="https://w3c.github.io/IndexedDB/#abort-transaction"> |
| 5 <link rel="author" href="pwnall@chromium.org" title="Victor Costan"> | 4 <link rel="author" href="pwnall@chromium.org" title="Victor Costan"> |
| 6 <script src='../../resources/testharnessreport.js'></script> | 5 <script src="/resources/testharness.js"></script> |
| 7 <script src='resources/rename-common.js'></script> | 6 <script src="/resources/testharnessreport.js"></script> |
| 7 <script src="support-promises.js"></script> |
| 8 <script> | 8 <script> |
| 9 | 9 |
| 10 promise_test(testCase => { | 10 promise_test(testCase => { |
| 11 let store = null, migrationTransaction = null, migrationDatabase = null; | 11 let store = null, migrationTransaction = null, migrationDatabase = null; |
| 12 return createDatabase(testCase, (database, transaction) => { | 12 return createDatabase(testCase, (database, transaction) => { |
| 13 createBooksStore(testCase, database); | 13 createBooksStore(testCase, database); |
| 14 }).then(database => { | 14 }).then(database => { |
| 15 database.close(); | 15 database.close(); |
| 16 }).then(() => migrateDatabase(testCase, 2, (database, transaction) => { | 16 }).then(() => migrateDatabase(testCase, 2, (database, transaction) => { |
| 17 store = createNotBooksStore(testCase, database); | 17 store = createNotBooksStore(testCase, database); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 'IDBDatabase.objectStoreNames should not include the newly ' + | 178 'IDBDatabase.objectStoreNames should not include the newly ' + |
| 179 'created store after the transaction is aborted'); | 179 'created store after the transaction is aborted'); |
| 180 assert_array_equals( | 180 assert_array_equals( |
| 181 migrationTransaction.objectStoreNames, ['books'], | 181 migrationTransaction.objectStoreNames, ['books'], |
| 182 'IDBTransaction.objectStoreNames should not include the newly ' + | 182 'IDBTransaction.objectStoreNames should not include the newly ' + |
| 183 'created store after the transaction is aborted'); | 183 'created store after the transaction is aborted'); |
| 184 }); | 184 }); |
| 185 }, 'Created+deleted stores are still marked as deleted after their ' + | 185 }, 'Created+deleted stores are still marked as deleted after their ' + |
| 186 'transaction aborts'); | 186 'transaction aborts'); |
| 187 | 187 |
| 188 promise_test(testCase => { | |
| 189 let migrationTransaction = null, migrationDatabase = null; | |
| 190 return createDatabase(testCase, (database, transaction) => { | |
| 191 createBooksStore(testCase, database); | |
| 192 createNotBooksStore(testCase, database); | |
| 193 }).then(database => { | |
| 194 database.close(); | |
| 195 }).then(() => migrateDatabase(testCase, 2, (database, transaction) => { | |
| 196 migrationDatabase = database; | |
| 197 migrationTransaction = transaction; | |
| 198 | |
| 199 database.deleteObjectStore('not_books'); | |
| 200 assert_array_equals( | |
| 201 transaction.objectStoreNames, ['books'], | |
| 202 'IDBTransaction.objectStoreNames should stop including the ' + | |
| 203 'deleted store immediately after IDBDatabase.deleteObjectStore() ' + | |
| 204 'returns'); | |
| 205 assert_array_equals( | |
| 206 database.objectStoreNames, ['books'], | |
| 207 'IDBDatabase.objectStoreNames should stop including the newly ' + | |
| 208 'created store immediately after IDBDatabase.deleteObjectStore() ' + | |
| 209 'returns'); | |
| 210 | |
| 211 transaction.abort(); | |
| 212 assert_array_equals( | |
| 213 database.objectStoreNames, ['books', 'not_books'], | |
| 214 'IDBDatabase.objectStoreNames should include the deleted store ' + | |
| 215 'store immediately after IDBTransaction.abort() returns'); | |
| 216 assert_array_equals( | |
| 217 transaction.objectStoreNames, ['books', 'not_books'], | |
| 218 'IDBTransaction.objectStoreNames should include the deleted ' + | |
| 219 'store immediately after IDBTransaction.abort() returns'); | |
| 220 })).then(() => { | |
| 221 assert_array_equals( | |
| 222 migrationDatabase.objectStoreNames, ['books', 'not_books'], | |
| 223 'IDBDatabase.objectStoreNames should include the previously ' + | |
| 224 'deleted store after the transaction is aborted'); | |
| 225 assert_array_equals( | |
| 226 migrationTransaction.objectStoreNames, ['books', 'not_books'], | |
| 227 'IDBTransaction.objectStoreNames should include the previously ' + | |
| 228 'deleted store after the transaction is aborted'); | |
| 229 }); | |
| 230 }, 'Un-instantiated deleted stores get marked as not-deleted after the ' + | |
| 231 'transaction aborts'); | |
| 232 | |
| 233 </script> | 188 </script> |
| OLD | NEW |