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

Side by Side Diff: LayoutTests/storage/indexeddb/resources/transaction-basics.js

Issue 243523003: Fire window.onerror for uncaught IndexedDB errors (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Include error name Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 if (this.importScripts) { 1 if (this.importScripts) {
2 importScripts('../../../resources/js-test.js'); 2 importScripts('../../../resources/js-test.js');
3 importScripts('shared.js'); 3 importScripts('shared.js');
4 } 4 }
5 5
6 description("Test IndexedDB transaction basics."); 6 description("Test IndexedDB transaction basics.");
7 7
8 indexedDBTest(prepareDatabase, testSetVersionAbort1); 8 indexedDBTest(prepareDatabase, testSetVersionAbort1);
9 function prepareDatabase() 9 function prepareDatabase()
10 { 10 {
(...skipping 21 matching lines...) Expand all
32 var index = evalAndLog("index = store.createIndex('indexFail', 'x')"); 32 var index = evalAndLog("index = store.createIndex('indexFail', 'x')");
33 33
34 evalAndLog("db.deleteObjectStore('storeFail')"); 34 evalAndLog("db.deleteObjectStore('storeFail')");
35 evalAndExpectException("store.deleteIndex('indexFail')", "DOMException.INVAL ID_STATE_ERR", "'InvalidStateError'"); 35 evalAndExpectException("store.deleteIndex('indexFail')", "DOMException.INVAL ID_STATE_ERR", "'InvalidStateError'");
36 36
37 trans.abort(); 37 trans.abort();
38 } 38 }
39 39
40 function testSetVersionAbort2() 40 function testSetVersionAbort2()
41 { 41 {
42 expectError();
42 debug(""); 43 debug("");
43 debug("testSetVersionAbort2():"); 44 debug("testSetVersionAbort2():");
44 checkMetadataEmpty(); 45 checkMetadataEmpty();
45 evalAndLog("request = newConnection()"); 46 evalAndLog("request = newConnection()");
46 request.onupgradeneeded = addRemoveAddIDBObjects; 47 request.onupgradeneeded = addRemoveAddIDBObjects;
47 request.onerror = null; 48 request.onerror = null;
48 } 49 }
49 50
50 function addRemoveAddIDBObjects() 51 function addRemoveAddIDBObjects()
51 { 52 {
(...skipping 11 matching lines...) Expand all
63 evalAndExpectException("store.deleteIndex('indexFail')", "DOMException.INVAL ID_STATE_ERR", "'InvalidStateError'"); 64 evalAndExpectException("store.deleteIndex('indexFail')", "DOMException.INVAL ID_STATE_ERR", "'InvalidStateError'");
64 65
65 var store = evalAndLog("store = db.createObjectStore('storeFail', null)"); 66 var store = evalAndLog("store = db.createObjectStore('storeFail', null)");
66 var index = evalAndLog("index = store.createIndex('indexFail', 'x')"); 67 var index = evalAndLog("index = store.createIndex('indexFail', 'x')");
67 68
68 trans.abort(); 69 trans.abort();
69 } 70 }
70 71
71 function testSetVersionAbort3() 72 function testSetVersionAbort3()
72 { 73 {
74 expectError();
73 debug(""); 75 debug("");
74 debug("testSetVersionAbort3():"); 76 debug("testSetVersionAbort3():");
75 shouldBeFalse("event.cancelable"); 77 shouldBeFalse("event.cancelable");
76 checkMetadataEmpty(); 78 checkMetadataEmpty();
77 evalAndLog("request = newConnection()"); 79 evalAndLog("request = newConnection()");
78 request.onupgradeneeded = addIDBObjects; 80 request.onupgradeneeded = addIDBObjects;
79 request.onsuccess = unexpectedSuccessCallback; 81 request.onsuccess = unexpectedSuccessCallback;
80 request.onerror = testSetVersionAbort4; 82 request.onerror = testSetVersionAbort4;
81 } 83 }
82 84
(...skipping 26 matching lines...) Expand all
109 evalAndExpectException("store.put(0, 0)", "0", "'TransactionInactiveError'") ; 111 evalAndExpectException("store.put(0, 0)", "0", "'TransactionInactiveError'") ;
110 evalAndExpectException("store.add(0, 0)", "0", "'TransactionInactiveError'") ; 112 evalAndExpectException("store.add(0, 0)", "0", "'TransactionInactiveError'") ;
111 evalAndExpectException("store.delete(0)", "0", "'TransactionInactiveError'") ; 113 evalAndExpectException("store.delete(0)", "0", "'TransactionInactiveError'") ;
112 evalAndExpectException("store.clear()", "0", "'TransactionInactiveError'"); 114 evalAndExpectException("store.clear()", "0", "'TransactionInactiveError'");
113 evalAndExpectException("store.get(0)", "0", "'TransactionInactiveError'"); 115 evalAndExpectException("store.get(0)", "0", "'TransactionInactiveError'");
114 evalAndExpectException("store.openCursor()", "0", "'TransactionInactiveError '"); 116 evalAndExpectException("store.openCursor()", "0", "'TransactionInactiveError '");
115 } 117 }
116 118
117 function testSetVersionAbort4() 119 function testSetVersionAbort4()
118 { 120 {
121 expectError();
119 debug(""); 122 debug("");
120 debug("testSetVersionAbort4():"); 123 debug("testSetVersionAbort4():");
121 checkMetadataEmpty(); 124 checkMetadataEmpty();
122 evalAndLog("request = newConnection()"); 125 evalAndLog("request = newConnection()");
123 request.onupgradeneeded = addIDBObjectsAndCommit; 126 request.onupgradeneeded = addIDBObjectsAndCommit;
124 request.onerror = unexpectedErrorCallback; 127 request.onerror = unexpectedErrorCallback;
125 request.onsuccess = testSetVersionAbort5; 128 request.onsuccess = testSetVersionAbort5;
126 } 129 }
127 130
128 function addIDBObjectsAndCommit() 131 function addIDBObjectsAndCommit()
(...skipping 23 matching lines...) Expand all
152 evalAndExpectException("store.put(0, 0)", "0", "'TransactionInactiveError'") ; 155 evalAndExpectException("store.put(0, 0)", "0", "'TransactionInactiveError'") ;
153 evalAndExpectException("store.add(0, 0)", "0", "'TransactionInactiveError'") ; 156 evalAndExpectException("store.add(0, 0)", "0", "'TransactionInactiveError'") ;
154 evalAndExpectException("store.delete(0)", "0", "'TransactionInactiveError'") ; 157 evalAndExpectException("store.delete(0)", "0", "'TransactionInactiveError'") ;
155 evalAndExpectException("store.clear()", "0", "'TransactionInactiveError'"); 158 evalAndExpectException("store.clear()", "0", "'TransactionInactiveError'");
156 evalAndExpectException("store.get(0)", "0", "'TransactionInactiveError'"); 159 evalAndExpectException("store.get(0)", "0", "'TransactionInactiveError'");
157 evalAndExpectException("store.openCursor()", "0", "'TransactionInactiveError '"); 160 evalAndExpectException("store.openCursor()", "0", "'TransactionInactiveError '");
158 } 161 }
159 162
160 function testSetVersionAbort5() 163 function testSetVersionAbort5()
161 { 164 {
165 expectError();
162 debug(""); 166 debug("");
163 debug("testSetVersionAbort5():"); 167 debug("testSetVersionAbort5():");
164 checkMetadataExistingObjectStore(); 168 checkMetadataExistingObjectStore();
165 evalAndLog("request = newConnection()"); 169 evalAndLog("request = newConnection()");
166 request.onupgradeneeded = removeIDBObjects; 170 request.onupgradeneeded = removeIDBObjects;
167 request.onsuccess = unexpectedSuccessCallback; 171 request.onsuccess = unexpectedSuccessCallback;
168 request.onerror = testSetVersionAbort6; 172 request.onerror = testSetVersionAbort6;
169 } 173 }
170 174
171 function removeIDBObjects() 175 function removeIDBObjects()
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 trans.oncomplete = verifyDegenerateNames; 293 trans.oncomplete = verifyDegenerateNames;
290 }; 294 };
291 function verifyDegenerateNames() { 295 function verifyDegenerateNames() {
292 shouldNotThrow("transaction = db.transaction(null)"); 296 shouldNotThrow("transaction = db.transaction(null)");
293 shouldBeNonNull("transaction.objectStore('null')"); 297 shouldBeNonNull("transaction.objectStore('null')");
294 shouldNotThrow("transaction = db.transaction(undefined)"); 298 shouldNotThrow("transaction = db.transaction(undefined)");
295 shouldBeNonNull("transaction.objectStore('undefined')"); 299 shouldBeNonNull("transaction.objectStore('undefined')");
296 finishJSTest(); 300 finishJSTest();
297 } 301 }
298 } 302 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698