| 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 <title>Invalid keypath</title> | 4 <title>Invalid keypath</title> |
| 5 <link rel=help href="http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#
key-path-construct"> | 5 <link rel=help href="http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#
key-path-construct"> |
| 6 <link rel=assert title="A key path is a DOMString that defines how to extract a
key from a value. A valid key path is either the empty string, a JavaScript iden
tifier, or multiple Javascript identifiers separated by periods (ASCII character
code 46) [ECMA-262]."> | 6 <link rel=assert title="A key path is a DOMString that defines how to extract a
key from a value. A valid key path is either the empty string, a JavaScript iden
tifier, or multiple Javascript identifiers separated by periods (ASCII character
code 46) [ECMA-262]."> |
| 7 <script src="/resources/testharness.js"></script> | 7 <script src="/resources/testharness.js"></script> |
| 8 <script src="/resources/testharnessreport.js"></script> | 8 <script src="/resources/testharnessreport.js"></script> |
| 9 <script src="support.js"></script> | 9 <script src="support.js"></script> |
| 10 | 10 |
| 11 <script> | 11 <script> |
| 12 | 12 |
| 13 var global_db = createdb_for_multiple_tests(); | 13 var global_db = createdb_for_multiple_tests(); |
| 14 | 14 |
| 15 function invalid_keypath(keypath, desc) { | 15 function invalid_keypath(keypath, desc) { |
| 16 var t = async_test("Invalid keyPath - " + (desc ? desc : format_value(ke
ypath)), undefined, 2); | 16 var t = async_test("Invalid keyPath - " + (desc ? desc : format_value(ke
ypath)), undefined, 2); |
| 17 | 17 |
| 18 var openrq = global_db.setTest(t), | 18 var openrq = global_db.setTest(t), |
| 19 store_name = "store-" + Date.now() + Math.random(); | 19 store_name = "store-" + Date.now() + Math.random(); |
| 20 | 20 |
| 21 openrq.onupgradeneeded = function(e) { | 21 openrq.onupgradeneeded = function(e) { |
| 22 var db = e.target.result; | 22 var db = e.target.result; |
| 23 assert_throws('SyntaxError', function() { | 23 assert_throws('SyntaxError', function() { |
| 24 db.createObjectStore(store_name, { keyPath: keypath }) | 24 db.createObjectStore(store_name, { keyPath: keypath }) |
| 25 }, "createObjectStore with keyPath"); | 25 }, "createObjectStore with keyPath"); |
| 26 | 26 |
| 27 store = db.createObjectStore(store_name); | 27 var store = db.createObjectStore(store_name); |
| 28 assert_throws('SyntaxError', function() { | 28 assert_throws('SyntaxError', function() { |
| 29 store.createIndex('index', keypath); | 29 store.createIndex('index', keypath); |
| 30 }, "createIndex with keyPath"); | 30 }, "createIndex with keyPath"); |
| 31 | 31 |
| 32 db.close(); | 32 db.close(); |
| 33 | 33 |
| 34 this.done(); | 34 this.done(); |
| 35 }; | 35 }; |
| 36 } | 36 } |
| 37 | 37 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 56 invalid_keypath('m&'); | 56 invalid_keypath('m&'); |
| 57 invalid_keypath('m!'); | 57 invalid_keypath('m!'); |
| 58 invalid_keypath('*'); | 58 invalid_keypath('*'); |
| 59 invalid_keypath('*.*'); | 59 invalid_keypath('*.*'); |
| 60 invalid_keypath('^m'); | 60 invalid_keypath('^m'); |
| 61 invalid_keypath('/m/'); | 61 invalid_keypath('/m/'); |
| 62 | 62 |
| 63 </script> | 63 </script> |
| 64 | 64 |
| 65 <div id=log></div> | 65 <div id=log></div> |
| OLD | NEW |