| Odin Hørthe Omdal | 41424a7 | 2012-08-15 18:21:14 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <title>IDBTransaction</title> |
| Xie Yunxiao | e027b49 | 2014-04-09 07:20:33 | [diff] [blame] | 3 | <link rel="author" href="mailto:odinho@opera.com" title="Odin Hørthe Omdal"> |
| Odin Hørthe Omdal | 41424a7 | 2012-08-15 18:21:14 | [diff] [blame] | 4 | <script src="/resources/testharness.js"></script> |
| 5 | <script src="/resources/testharnessreport.js"></script> |
| 6 | <script src="support.js"></script> |
| 7 | |
| 8 | <script> |
| jsbell | 70a2c07 | 2017-04-21 21:03:16 | [diff] [blame] | 9 | async_test(function(t) { |
| 10 | var open_rq = indexedDB.open("idbtransaction-" + document.location + t.name); |
| Odin Hørthe Omdal | 41424a7 | 2012-08-15 18:21:14 | [diff] [blame] | 11 | |
| jsbell | 70a2c07 | 2017-04-21 21:03:16 | [diff] [blame] | 12 | open_rq.onblocked = t.unreached_func('open_rq.onblocked'); |
| 13 | open_rq.onerror = t.unreached_func('open_rq.onerror'); |
| Odin Hørthe Omdal | 41424a7 | 2012-08-15 18:21:14 | [diff] [blame] | 14 | |
| jsbell | 70a2c07 | 2017-04-21 21:03:16 | [diff] [blame] | 15 | open_rq.onupgradeneeded = t.step_func(function(e) { |
| 16 | t.add_cleanup(function() { |
| 17 | open_rq.onerror = function(e) { |
| 18 | e.preventDefault(); |
| 19 | }; |
| 20 | open_rq.result.close(); |
| 21 | indexedDB.deleteDatabase(open_rq.result.name); |
| Odin Hørthe Omdal | 41424a7 | 2012-08-15 18:21:14 | [diff] [blame] | 22 | }); |
| 23 | |
| jsbell | 70a2c07 | 2017-04-21 21:03:16 | [diff] [blame] | 24 | assert_equals(e.target, open_rq, "e.target is reusing the same IDBOpenDBRequest"); |
| 25 | assert_equals(e.target.transaction, open_rq.transaction, "IDBOpenDBRequest.transaction"); |
| Odin Hørthe Omdal | 41424a7 | 2012-08-15 18:21:14 | [diff] [blame] | 26 | |
| jsbell | 70a2c07 | 2017-04-21 21:03:16 | [diff] [blame] | 27 | assert_true(e.target.transaction instanceof IDBTransaction, "transaction instanceof IDBTransaction"); |
| 28 | t.done(); |
| 29 | }); |
| 30 | |
| 31 | }, document.title + " - request gotten by the handler"); |
| 32 | |
| 33 | async_test(function(t) { |
| 34 | var open_rq = indexedDB.open("idbtransaction-" + document.location + t.name); |
| 35 | |
| 36 | assert_equals(open_rq.transaction, null, "IDBOpenDBRequest.transaction"); |
| 37 | assert_equals(open_rq.source, null, "IDBOpenDBRequest.source"); |
| 38 | assert_equals(open_rq.readyState, "pending", "IDBOpenDBRequest.readyState"); |
| 39 | |
| 40 | assert_true(open_rq instanceof IDBOpenDBRequest, "open_rq instanceof IDBOpenDBRequest"); |
| 41 | assert_equals(open_rq + "", "[object IDBOpenDBRequest]", "IDBOpenDBRequest (open_rq)"); |
| 42 | |
| 43 | open_rq.onblocked = t.unreached_func('open_rq.onblocked'); |
| 44 | open_rq.onerror = t.unreached_func('open_rq.onerror'); |
| 45 | |
| 46 | open_rq.onupgradeneeded = t.step_func(function() { |
| 47 | t.add_cleanup(function() { |
| 48 | open_rq.onerror = function(e) { |
| 49 | e.preventDefault(); |
| 50 | }; |
| 51 | open_rq.result.close(); |
| 52 | indexedDB.deleteDatabase(open_rq.result.name); |
| Odin Hørthe Omdal | 41424a7 | 2012-08-15 18:21:14 | [diff] [blame] | 53 | }); |
| jsbell | 70a2c07 | 2017-04-21 21:03:16 | [diff] [blame] | 54 | t.done(); |
| 55 | }); |
| Odin Hørthe Omdal | 41424a7 | 2012-08-15 18:21:14 | [diff] [blame] | 56 | |
| jsbell | 70a2c07 | 2017-04-21 21:03:16 | [diff] [blame] | 57 | }, document.title + " - request returned by open()"); |
| Odin Hørthe Omdal | 41424a7 | 2012-08-15 18:21:14 | [diff] [blame] | 58 | |
| Odin Hørthe Omdal | 41424a7 | 2012-08-15 18:21:14 | [diff] [blame] | 59 | </script> |