2 <title>IDBCursor.key</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>
10 function cursor_key(key)
13 t = async_test(document.title + " - " + key);
15 var open_rq = createdb(t);
16 open_rq.onupgradeneeded = function(e) {
18 var objStore = db.createObjectStore("test");
20 objStore.add("data", key);
23 open_rq.onsuccess = t.step_func(function(e) {
24 var cursor_rq = db.transaction("test")
28 cursor_rq.onsuccess = t.step_func(function(e) {
29 var cursor = e.target.result;
30 assert_equals(cursor.value, "data", "prequisite cursor.value");
32 assert_object_equals(cursor.key, key, 'key');
33 assert_readonly(cursor, 'key');
35 if (key instanceof Array) {
36 cursor.key.push("new");
39 assert_object_equals(cursor.key, key, 'key after array push');
41 // But we can not change key (like readonly, just a bit different)
43 assert_object_equals(cursor.key, key, 'key after assignment');
53 cursor_key(["my", "key"]);