summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/IndexedDB/keypath_invalid.htm
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/IndexedDB/keypath_invalid.htm
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/IndexedDB/keypath_invalid.htm')
-rw-r--r--testing/web-platform/tests/IndexedDB/keypath_invalid.htm65
1 files changed, 65 insertions, 0 deletions
diff --git a/testing/web-platform/tests/IndexedDB/keypath_invalid.htm b/testing/web-platform/tests/IndexedDB/keypath_invalid.htm
new file mode 100644
index 000000000..9c5bd6c2f
--- /dev/null
+++ b/testing/web-platform/tests/IndexedDB/keypath_invalid.htm
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<!-- Submitted from TestTWF Paris -->
+<meta charset="utf-8">
+<title>Invalid keypath</title>
+<link rel=help href="http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#key-path-construct">
+<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 identifier, or multiple Javascript identifiers separated by periods (ASCII character code 46) [ECMA-262].">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="support.js"></script>
+
+<script>
+
+ var global_db = createdb_for_multiple_tests();
+
+ function invalid_keypath(keypath, desc) {
+ var t = async_test("Invalid keyPath - " + (desc ? desc : format_value(keypath)), undefined, 2);
+
+ var openrq = global_db.setTest(t),
+ store_name = "store-" + Date.now() + Math.random();
+
+ openrq.onupgradeneeded = function(e) {
+ var db = e.target.result;
+ assert_throws('SyntaxError', function() {
+ db.createObjectStore(store_name, { keyPath: keypath })
+ }, "createObjectStore with keyPath");
+
+ store = db.createObjectStore(store_name);
+ assert_throws('SyntaxError', function() {
+ store.createIndex('index', keypath);
+ }, "createIndex with keyPath");
+
+ db.close();
+
+ this.done();
+ };
+ }
+
+ invalid_keypath('j a');
+ invalid_keypath('.yo');
+ invalid_keypath('yo,lo');
+ invalid_keypath([]);
+ invalid_keypath(['array with space']);
+ invalid_keypath(['multi_array', ['a', 'b']], "multidimensional array (invalid toString)"); // => ['multi_array', 'a,b']
+ invalid_keypath('3m');
+ invalid_keypath({toString:function(){return '3m'}}, '{toString->3m}');
+ invalid_keypath('my.1337');
+ invalid_keypath('..yo');
+ invalid_keypath('y..o');
+ invalid_keypath('y.o.');
+ invalid_keypath('y.o..');
+ invalid_keypath('m.*');
+ invalid_keypath('"m"');
+ invalid_keypath('m%');
+ invalid_keypath('m/');
+ invalid_keypath('m/a');
+ invalid_keypath('m&');
+ invalid_keypath('m!');
+ invalid_keypath('*');
+ invalid_keypath('*.*');
+ invalid_keypath('^m');
+ invalid_keypath('/m/');
+
+</script>
+
+<div id=log></div>