| OLD | NEW |
| 1 if (this.importScripts) { | 1 if (this.importScripts) { |
| 2 importScripts('../../../resources/testharness.js'); | 2 importScripts('../../../resources/testharness.js'); |
| 3 } | 3 } |
| 4 | 4 |
| 5 function callback(){}; | 5 function callback(){}; |
| 6 | 6 |
| 7 async_test(function(t) { | 7 async_test(function(t) { |
| 8 var description = 'observers constructor test'; | 8 var description = 'observer addition and removal test'; |
| 9 var dbname = location.pathname + ' - ' + description; | 9 var dbname = location.pathname + ' - ' + description; |
| 10 var openRequest = indexedDB.open(dbname); | 10 var openRequest = indexedDB.open(dbname); |
| 11 var obs1 = new IDBObserver(callback, {transaction: true, values: true}); | 11 var obs1 = new IDBObserver(callback, {transaction: true, values: true}); |
| 12 openRequest.onupgradeneeded = t.step_func(function() { | 12 var obs2 = new IDBObserver(callback, {transaction: true, values: true}); |
| 13 var db = openRequest.result; | 13 |
| 14 db.createObjectStore('store'); | 14 openRequest.onupgradeneeded = t.step_func(function() { |
| 15 }); | 15 var db = openRequest.result; |
| 16 openRequest.onsuccess = t.step_func(function() { | 16 db.createObjectStore('store'); |
| 17 var db = openRequest.result; | 17 }); |
| 18 var tx = db.transaction('store', 'readwrite'); | 18 openRequest.onsuccess = t.step_func(function() { |
| 19 var db = openRequest.result; |
| 20 var tx = db.transaction('store', 'readwrite'); |
| 21 var store = tx.objectStore('store'); |
| 22 var put_request = store.put(1,1); |
| 19 obs1.observe(db, tx); | 23 obs1.observe(db, tx); |
| 20 t.done(); | 24 obs1.unobserve(db); |
| 21 }); | 25 obs1.observe(db, tx); |
| 22 | 26 obs2.observe(db, tx); |
| 23 }, 'observers constructor test'); | 27 tx.oncomplete = t.step_func(function(){ |
| 28 obs1.unobserve(db); |
| 29 t.done(); |
| 30 }); |
| 31 }); |
| 32 }, 'observer addition and removal test'); |
| 24 | 33 |
| 25 done(); | 34 done(); |
| 26 | 35 |
| OLD | NEW |