3 <script src=
"../../../http/tests/inspector/inspector-test.js"></script>
4 <script src=
"../../../http/tests/inspector/debugger-test.js"></script>
10 function testFunction()
17 console
.error("FAIL: " + new Error().stack
);
23 var request
= indexedDB
.open("async-callstack-indexed-db", version
);
24 request
.onupgradeneeded
= onUpgradeNeeded
;
25 request
.onsuccess
= onSuccessOpenDB
;
26 request
.onerror
= onError
;
29 function onUpgradeNeeded(e
)
32 var db
= e
.target
.result
;
33 e
.target
.transaction
.onerror
= onError
;
35 if (db
.objectStoreNames
.contains("foo"))
36 db
.deleteObjectStore("foo");
38 db
.createObjectStore("foo", { keyPath
: "id" });
41 function onSuccessOpenDB(e
)
50 var trans
= db
.transaction(["foo"], "readwrite");
51 var store
= trans
.objectStore("foo");
52 var request
= store
.put({ "id" : 1, "bar": "baz" });
53 request
.onsuccess
= onSuccessStorePut
;
54 request
.onerror
= onError
;
57 function onSuccessStorePut(e
)
63 function getAllItems()
65 var trans
= db
.transaction(["foo"], "readwrite");
66 var store
= trans
.objectStore("foo");
67 var keyRange
= IDBKeyRange
.lowerBound(0);
68 var cursorRequest
= store
.openCursor(keyRange
);
69 cursorRequest
.onsuccess
= onSuccessCursorRequest
;
70 cursorRequest
.onerror
= onError
;
73 function onSuccessCursorRequest(e
)
81 var trans
= db
.transaction(["foo"], "readwrite");
82 var store
= trans
.objectStore("foo");
83 var request
= store
.delete(1);
84 request
.onsuccess
= onSuccessDeleteItem
;
85 request
.onerror
= onError
;
88 function onSuccessDeleteItem()
97 var request
= indexedDB
.deleteDatabase("async-callstack-indexed-db");
98 request
.onsuccess
= onSuccessDeleteDatabase
;
99 request
.onerror
= onError
;
102 function onSuccessDeleteDatabase()
109 var totalDebuggerStatements
= 6;
110 var maxAsyncCallStackDepth
= 4;
111 InspectorTest
.runAsyncCallStacksTest(totalDebuggerStatements
, maxAsyncCallStackDepth
);
117 <body onload=
"runTest()">
118 <input type='button' onclick='testFunction()' value='Test'
/>
120 Tests asynchronous call stacks for IndexedDB.