OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>IDBTransaction - complete event</title> |
| 3 <link rel="author" href="mailto:odinho@opera.com" title="Odin Hørthe Omdal"> |
| 4 <script src="../../../resources/testharness.js"></script> |
| 5 <script src="../../../resources/testharnessreport.js"></script> |
| 6 <script src="support.js"></script> |
| 7 |
| 8 <script> |
| 9 var db, store, |
| 10 t = async_test(document.title, {timeout: 10000}), |
| 11 open_rq = createdb(t), |
| 12 stages = []; |
| 13 |
| 14 open_rq.onupgradeneeded = function(e) { |
| 15 stages.push("upgradeneeded"); |
| 16 |
| 17 db = e.target.result; |
| 18 store = db.createObjectStore('store'); |
| 19 |
| 20 e.target.transaction.oncomplete = function() { |
| 21 stages.push("complete"); |
| 22 }; |
| 23 }; |
| 24 |
| 25 open_rq.onsuccess = function(e) { |
| 26 stages.push("success"); |
| 27 |
| 28 // Making a totally new transaction to check |
| 29 db.transaction('store').objectStore('store').count().onsuccess = t.step_
func(function(e) { |
| 30 assert_array_equals(stages, [ "upgradeneeded", |
| 31 "complete", |
| 32 "success" ]); |
| 33 t.done(); |
| 34 }); |
| 35 // XXX: Make one with real transactions, not only open() versionchange o
ne |
| 36 |
| 37 /*db.transaction.objectStore('store').openCursor().onsuccess = function(
e) { |
| 38 stages.push("opencursor1"); |
| 39 } |
| 40 |
| 41 store.openCursor().onsuccess = function(e) { |
| 42 stages.push("opencursor2"); |
| 43 } |
| 44 |
| 45 e.target.transaction.objectStore('store').openCursor().onsuccess = funct
ion(e) { |
| 46 stages.push("opencursor3"); |
| 47 } |
| 48 */ |
| 49 } |
| 50 |
| 51 </script> |
| 52 |
| 53 <div id="log"></div> |
OLD | NEW |