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

Side by Side Diff: third_party/WebKit/LayoutTests/storage/indexeddb/idbcursor-update-exception-order.html

Issue 1897253003: IndexedDB: Align exception priorities with Firefox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review feedback: more cases, split files, better messages Created 4 years, 3 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: IDBCursor update() Exception Ordering</title>
3 <link rel="help" href="https://w3c.github.io/IndexedDB/#dom-idbcursor-update">
4 <script src="../../resources/testharness.js"></script>
5 <script src="../../resources/testharnessreport.js"></script>
6 <script src="resources/testharness-helpers.js"></script>
7
8 <script>
9
10 indexeddb_test(
11 function(t, db) {
12 var s = db.createObjectStore('s');
13 s.put('value', 'key');
14 },
15 function(t, db) {
16 var s = db.transaction('s', 'readonly').objectStore('s');
17 var r = s.openCursor();
18 r.onsuccess = t.step_func(function() {
19 r.onsuccess = null;
20 var cursor = r.result;
21 setTimeout(t.step_func(function() {
22 assert_throws('TransactionInactiveError', function() {
23 cursor.update('value2');
24 }, '"Transaction inactive" check (TransactionInactiveError) ' +
25 'should precede "read only" check (ReadOnlyError)');
26 t.done();
27 }), 0);
28 });
29 },
30 'IDBCursor.update exception order: TransactionInactiveError vs. ReadOnlyErro r'
31 );
32
33 indexeddb_test(
34 function(t, db) {
35 var s = db.createObjectStore('s');
36 s.put('value', 'key');
37 },
38 function(t, db) {
39 var s = db.transaction('s', 'readonly').objectStore('s');
40 var r = s.openCursor();
41 r.onsuccess = t.step_func(function() {
42 r.onsuccess = null;
43 var cursor = r.result;
44 cursor.continue();
45 assert_throws('ReadOnlyError', function() {
46 cursor.update('value2');
47 }, '"Read only" check (ReadOnlyError) should precede '+
48 '"got value flag" check (InvalidStateError)');
49 t.done();
50 });
51 },
52 'IDBCursor.update exception order: ReadOnlyError vs. InvalidStateError #1'
53 );
54
55 indexeddb_test(
56 function(t, db) {
57 var s = db.createObjectStore('s');
58 s.put('value', 'key');
59 },
60 function(t, db) {
61 var s = db.transaction('s', 'readonly').objectStore('s');
62 var r = s.openKeyCursor();
63 r.onsuccess = t.step_func(function() {
64 r.onsuccess = null;
65 var cursor = r.result;
66 cursor.continue();
67 assert_throws('ReadOnlyError', function() {
68 cursor.update('value2');
69 }, '"Read only" check (ReadOnlyError) should precede '+
70 '"key only flag" check (InvalidStateError)');
71 t.done();
72 });
73 },
74 'IDBCursor.update exception order: ReadOnlyError vs. InvalidStateError #2'
75 );
76
77 indexeddb_test(
78 function(t, db) {
79 var s = db.createObjectStore('s', {keyPath: 'id'});
80 s.put({id: 123, data: 'value'});
81 },
82 function(t, db) {
83 var s = db.transaction('s', 'readwrite').objectStore('s');
84 var r = s.openCursor();
85 r.onsuccess = t.step_func(function() {
86 r.onsuccess = null;
87 var cursor = r.result;
88 cursor.continue();
89 assert_throws('InvalidStateError', function() {
90 cursor.update({id: 123, data: 'value2'});
91 }, '"Got value flag" check (InvalidStateError) should precede ' +
92 '"modified key" check (DataError)');
93 t.done();
94 });
95 },
96 'IDBCursor.update exception order: InvalidStateError vs. DataError'
97 );
98
99 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698