Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(356)

Side by Side Diff: third_party/WebKit/LayoutTests/storage/indexeddb/idbdatabase-createObjectStore-exception-order.html

Issue 2415203002: Indexed DB: More exception precedence tests (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>IndexedDB: IDBDatabase createObjectStore() Exception Ordering</title> 2 <title>IndexedDB: IDBDatabase createObjectStore() Exception Ordering</title>
3 <meta charset=utf-8>
3 <link rel="help" href="https://w3c.github.io/IndexedDB/#dom-idbdatabase-createob jectstore"> 4 <link rel="help" href="https://w3c.github.io/IndexedDB/#dom-idbdatabase-createob jectstore">
4 <script src="../../resources/testharness.js"></script> 5 <script src="../../resources/testharness.js"></script>
5 <script src="../../resources/testharnessreport.js"></script> 6 <script src="../../resources/testharnessreport.js"></script>
6 <script src="resources/testharness-helpers.js"></script> 7 <script src="resources/testharness-helpers.js"></script>
7
8 <script> 8 <script>
9 9
10 indexeddb_test( 10 indexeddb_test(
11 function(t, db) { 11 (t, db) => {
12 db.createObjectStore('s'); 12 db.createObjectStore('s');
13 assert_throws('SyntaxError', function() { 13 },
14 db.createObjectStore('s', {keyPath: 'not a valid key path'}); 14 (t, db) => {
15 }, '"Invalid keyath" check (SyntaxError) should precede ' + 15 const tx = db.transaction('s');
16 '"duplicate store name" check (ConstraintError)'); 16 const store = tx.objectStore('s');
17 t.done(); 17 const finish = pin_transaction(store);
18 }, 18
19 function(t, db) {}, 19 setTimeout(t.step_func(() => {
pwnall 2016/10/14 07:57:04 This alternative seems easier to reason about: in
jsbell 2016/10/17 19:42:03 Done, w/ slight tweaks.
20 'IDBDatabase.createObjectStore exception order: ConstraintError vs. SyntaxEr ror' 20 assert_throws(
21 'InvalidStateError', () => { db.createObjectStore('s2'); },
22 '"running an upgrade transaction" check (InvalidStateError) ' +
23 'should precede "not active" check (TransactionInactiveError)');
24
25 finish();
26 t.done();
27 }), 0);
28 },
29 'IDBDatabase.createObjectStore exception order: ' +
30 'InvalidStateError vs. TransactionInactiveError'
31 );
32
33 indexeddb_test(
34 (t, db) => {
35 const store = db.createObjectStore('s');
36 const finish = pin_transaction(store);
37
38 setTimeout(t.step_func(() => {
39 assert_throws(
pwnall 2016/10/14 07:57:04 Firefox Nightly 52.0a1 (2016-10-13) fails this che
jsbell 2016/10/17 19:42:03 Awesome investigation. Done, w/ slight tweaks.
40 'TransactionInactiveError',
41 () => { db.createObjectStore('s2', {keyPath: '-invalid-'}); },
42 '"not active" check (TransactionInactiveError) should precede ' +
43 '"valid key path" check (SyntaxError)');
44 finish();
45 t.done();
46 }), 0);
47 },
48 (t, db) => {},
49 'IDBDatabase.createObjectStore exception order: ' +
50 'TransactionInactiveError vs. SyntaxError'
51 );
52
53 indexeddb_test(
54 (t, db) => {
55 db.createObjectStore('s');
56 assert_throws('SyntaxError', () => {
57 db.createObjectStore('s', {keyPath: 'not a valid key path'});
58 }, '"Invalid keyath" check (SyntaxError) should precede ' +
59 '"duplicate store name" check (ConstraintError)');
60 t.done();
61 },
62 (t, db) => {},
63 'IDBDatabase.createObjectStore exception order: ' +
64 'SyntaxError vs. ConstraintError'
65 );
66
67 indexeddb_test(
68 (t, db) => {
69 db.createObjectStore('s');
70 assert_throws('ConstraintError', () => {
71 db.createObjectStore('s', {autoIncrement: true,
72 keyPath: ''});
73 }, '"already exists" check (ConstraintError) should precede ' +
74 '"autoIncrement vs. keyPath" check (InvalidAccessError)');
75 t.done();
76 },
77 (t, db) => {},
78 'IDBDatabase.createObjectStore exception order: ' +
79 'ConstraintError vs. InvalidAccessError'
21 ); 80 );
22 81
23 </script> 82 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698