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

Side by Side Diff: third_party/WebKit/LayoutTests/storage/indexeddb/idbobjectstore-add-put-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
(Empty)
1 <!DOCTYPE html>
2 <title>IndexedDB: IDBObjectStore add()/put() Exception Ordering</title>
3 <meta charset=utf-8>
4 <link rel="help" href="https://w3c.github.io/IndexedDB/#dom-idbobjectstore-add">
5 <link rel="help" href="https://w3c.github.io/IndexedDB/#dom-idbobjectstore-put">
6 <script src="../../resources/testharness.js"></script>
7 <script src="../../resources/testharnessreport.js"></script>
8 <script src="resources/testharness-helpers.js"></script>
9 <script>
10
11 ['add', 'put'].forEach(method => {
12 indexeddb_test(
13 (t, db) => {
14 const store = db.createObjectStore('s');
15 const store2 = db.createObjectStore('s2');
16 const finish = pin_transaction(store);
17
18 db.deleteObjectStore('s2');
19
20 setTimeout(t.step_func(() => {
21 assert_throws(
22 'InvalidStateError', () => { store2[method]('key', 'value'); },
23 '"has been deleted" check (InvalidStateError) should precede ' +
24 '"not active" check (TransactionInactiveError)');
25
26 finish();
27 t.done();
28 }), 0);
29 },
30 (t, db) => {},
31 `IDBObjectStore.${method} exception order: ` +
32 'InvalidStateError vs. TransactionInactiveError'
33 );
34
35 indexeddb_test(
36 (t, db) => {
37 const store = db.createObjectStore('s');
38 },
39 (t, db) => {
40 const tx = db.transaction('s');
pwnall 2016/10/14 07:57:05 Do you think it's worth adding 'readonly' here, to
jsbell 2016/10/17 19:42:03 Done.
41 const store = tx.objectStore('s');
42 const finish = pin_transaction(store);
43
44 setTimeout(t.step_func(() => {
45 assert_throws(
46 'TransactionInactiveError', () => { store[method]('key', 'value'); },
47 '"not active" check (TransactionInactiveError) should precede ' +
48 '"read only" check (ReadOnlyError)');
49
50 finish();
51 t.done();
52 }), 0);
53 },
54
55 `IDBObjectStore.${method} exception order: ` +
56 'TransactionInactiveError vs. ReadOnlyError'
57 );
58
59 indexeddb_test(
60 (t, db) => {
61 const store = db.createObjectStore('s');
62 },
63 (t, db) => {
64 const tx = db.transaction('s');
65 const store = tx.objectStore('s');
66
67 assert_throws(
68 'ReadOnlyError', () => { store[method]({}, 'value'); },
69 '"read only" check (ReadOnlyError) should precede ' +
70 'key/data check (DataError)');
71
72 t.done();
73 },
74
75 `IDBObjectStore.${method} exception order: ` +
76 'ReadOnlyError vs. DataError'
77 );
78 });
79
80 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698