OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- Submitted from TestTWF Paris --> | 2 <!-- Submitted from TestTWF Paris --> |
3 <meta charset=utf-8"> | 3 <meta charset=utf-8"> |
4 <meta name="timeout" content="long"> | 4 <meta name="timeout" content="long"> |
5 <title>Valid key</title> | 5 <title>Valid key</title> |
6 <link rel=help href="http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#
key-construct"> | 6 <link rel=help href="http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#
key-construct"> |
7 <link rel=assert title="A value is said to be a valid key if it is one of the fo
llowing types: Array JavaScript objects [ECMA-262], DOMString [WEBIDL], Date [EC
MA-262] or float [WEBIDL]. However Arrays are only valid keys if every item in t
he array is defined and is a valid key (i.e. sparse arrays can not be valid keys
) and if the Array doesn't directly or indirectly contain itself. Any non-numeri
c properties are ignored, and thus does not affect whether the Array is a valid
key. Additionally, if the value is of type float, it is only a valid key if it i
s not NaN, and if the value is of type Date it is only a valid key if its [[Prim
itiveValue]] internal property, as defined by [ECMA-262], is not NaN. Conforming
user agents must support all valid keys as keys."> | 7 <link rel=assert title="A value is said to be a valid key if it is one of the fo
llowing types: Array JavaScript objects [ECMA-262], DOMString [WEBIDL], Date [EC
MA-262] or float [WEBIDL]. However Arrays are only valid keys if every item in t
he array is defined and is a valid key (i.e. sparse arrays can not be valid keys
) and if the Array doesn't directly or indirectly contain itself. Any non-numeri
c properties are ignored, and thus does not affect whether the Array is a valid
key. Additionally, if the value is of type float, it is only a valid key if it i
s not NaN, and if the value is of type Date it is only a valid key if its [[Prim
itiveValue]] internal property, as defined by [ECMA-262], is not NaN. Conforming
user agents must support all valid keys as keys."> |
8 <link rel=author href="mailto:batifon@yahoo.fr" title="Baptiste Fontaine"> | 8 <link rel=author href="mailto:batifon@yahoo.fr" title="Baptiste Fontaine"> |
9 <script src=../../../resources/testharness.js></script> | 9 <script src=../../../resources/testharness.js></script> |
10 <script src=../../../resources/testharnessreport.js></script> | 10 <script src=../../../resources/testharnessreport.js></script> |
(...skipping 17 matching lines...) Expand all Loading... |
28 open_rq.onsuccess = function(e) { | 28 open_rq.onsuccess = function(e) { |
29 var rq = db.transaction("store") | 29 var rq = db.transaction("store") |
30 .objectStore("store") | 30 .objectStore("store") |
31 .get(key) | 31 .get(key) |
32 rq.onsuccess = t.step_func(function(e) { | 32 rq.onsuccess = t.step_func(function(e) { |
33 assert_equals(e.target.result, 'value') | 33 assert_equals(e.target.result, 'value') |
34 var rq = db.transaction("store2") | 34 var rq = db.transaction("store2") |
35 .objectStore("store2") | 35 .objectStore("store2") |
36 .get(['v', key]) | 36 .get(['v', key]) |
37 rq.onsuccess = t.step_func(function(e) { | 37 rq.onsuccess = t.step_func(function(e) { |
38 assert_object_equals(e.target.result, { x: 'v', keypath: key
}) | 38 assert_equals(e.target.result.x, 'v'); |
| 39 assert_key_equals(e.target.result.keypath, key); |
39 t.done() | 40 t.done() |
40 }) | 41 }) |
41 }) | 42 }) |
42 } | 43 } |
43 } | 44 } |
44 | 45 |
45 // Date | 46 // Date |
46 valid_key( 'new Date()' , new Date() ); | 47 valid_key( 'new Date()' , new Date() ); |
47 valid_key( 'new Date(0)' , new Date(0) ); | 48 valid_key( 'new Date(0)' , new Date(0) ); |
48 | 49 |
(...skipping 16 matching lines...) Expand all Loading... |
65 valid_key( '"\\n"' , "\n" ); | 66 valid_key( '"\\n"' , "\n" ); |
66 valid_key( '""' , "" ); | 67 valid_key( '""' , "" ); |
67 valid_key( '"\\""' , "\"" ); | 68 valid_key( '"\\""' , "\"" ); |
68 valid_key( '"\\u1234"' , "\u1234" ); | 69 valid_key( '"\\u1234"' , "\u1234" ); |
69 valid_key( '"\\u0000"' , "\u0000" ); | 70 valid_key( '"\\u0000"' , "\u0000" ); |
70 valid_key( '"NaN"' , "NaN" ); | 71 valid_key( '"NaN"' , "NaN" ); |
71 | 72 |
72 </script> | 73 </script> |
73 | 74 |
74 <div id=log></div> | 75 <div id=log></div> |
OLD | NEW |