Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /IndexedDB/idbtransaction-oncomplete.any.html - WPT Dashboard Interop Dashboard
- /IndexedDB/idbtransaction-oncomplete.any.serviceworker.html - WPT Dashboard Interop Dashboard
- /IndexedDB/idbtransaction-oncomplete.any.sharedworker.html - WPT Dashboard Interop Dashboard
- /IndexedDB/idbtransaction-oncomplete.any.worker.html - WPT Dashboard Interop Dashboard
// META: title=IDBTransaction - complete event
// META: global=window,worker
// META: script=resources/support.js
'use strict';
async_test(t => {
let db;
let store;
let open_rq = createdb(t);
let stages = [];
open_rq.onupgradeneeded = function(e) {
stages.push('upgradeneeded');
db = e.target.result;
store = db.createObjectStore('store');
e.target.transaction.oncomplete = function() {
stages.push('complete');
};
};
open_rq.onsuccess = function(e) {
stages.push('success');
let tx = db.transaction('store', 'readonly');
store = tx.objectStore('store');
store.openCursor().onsuccess =
function(e) {
stages.push('opencursor');
}
db.transaction('store', 'readonly')
.objectStore('store')
.count()
.onsuccess = t.step_func(function(e) {
assert_array_equals(stages, [
'upgradeneeded', 'complete', 'success', 'opencursor'
]);
t.done();
});
}
});