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

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

Issue 243523003: Fire window.onerror for uncaught IndexedDB errors (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased and linkage fix Created 5 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 | 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 event propogation on IDBTransaction."); 6 description("Test event propogation on IDBTransaction.");
7 7
8 indexedDBTest(prepareDatabase, startTest); 8 indexedDBTest(prepareDatabase, verifyAbort);
9 function prepareDatabase() 9 function prepareDatabase()
10 { 10 {
11 db = event.target.result; 11 db = event.target.result;
12 event.target.transaction.onabort = unexpectedAbortCallback; 12 event.target.transaction.onabort = unexpectedAbortCallback;
13 13
14 store = evalAndLog("store = db.createObjectStore('storeName', null)"); 14 store = evalAndLog("store = db.createObjectStore('storeName', null)");
15 request = evalAndLog("store.add({x: 'value', y: 'zzz'}, 'key')"); 15 request = evalAndLog("store.add({x: 'value', y: 'zzz'}, 'key')");
16 request.onerror = unexpectedErrorCallback; 16 request.onerror = unexpectedErrorCallback;
17 } 17 }
18 18
19 function startTest() 19 function verifyAbort()
20 { 20 {
21 debug("Verifing abort"); 21 debug("Verifing abort");
22 trans = evalAndLog("trans = db.transaction(['storeName'], 'readwrite')"); 22 trans = evalAndLog("trans = db.transaction(['storeName'], 'readwrite')");
23 evalAndLog("trans.onabort = abortFiredCallback"); 23 evalAndLog("trans.onabort = abortFiredCallback");
24 evalAndLog("trans.oncomplete = unexpectedAbortCallback"); 24 evalAndLog("trans.oncomplete = unexpectedAbortCallback");
25 evalAndLog("db.addEventListener('abort', dbAbortCaptureCallback, true)"); 25 evalAndLog("db.addEventListener('abort', dbAbortCaptureCallback, true)");
26 evalAndLog("db.addEventListener('abort', dbAbortBubbleCallback, false)"); 26 evalAndLog("db.addEventListener('abort', dbAbortBubbleCallback, false)");
27 evalAndLog("db.addEventListener('complete', unexpectedCompleteCallback, true )"); 27 evalAndLog("db.addEventListener('complete', unexpectedCompleteCallback, true )");
28 evalAndLog("db.addEventListener('complete', unexpectedCompleteCallback, fals e)"); 28 evalAndLog("db.addEventListener('complete', unexpectedCompleteCallback, fals e)");
29 store = evalAndLog("store = trans.objectStore('storeName')"); 29 store = evalAndLog("store = trans.objectStore('storeName')");
30 evalAndLog("store.add({x: 'value', y: 'zzz'}, 'key')"); 30 evalAndLog("store.add({x: 'value', y: 'zzz'}, 'key')");
31 expectError();
31 dbCaptureFired = false; 32 dbCaptureFired = false;
32 abortFired = false; 33 abortFired = false;
33 dbBubbleFired1 = false; 34 dbBubbleFired1 = false;
34 } 35 }
35 36
36 function dbAbortCaptureCallback() 37 function dbAbortCaptureCallback()
37 { 38 {
38 debug(""); 39 debug("");
39 debug("In IDBDatabase abort capture"); 40 debug("In IDBDatabase abort capture");
40 shouldBeFalse("dbCaptureFired"); 41 shouldBeFalse("dbCaptureFired");
(...skipping 19 matching lines...) Expand all
60 function dbAbortBubbleCallback() 61 function dbAbortBubbleCallback()
61 { 62 {
62 debug(""); 63 debug("");
63 debug("In IDBDatabase error bubble"); 64 debug("In IDBDatabase error bubble");
64 shouldBeTrue("dbCaptureFired"); 65 shouldBeTrue("dbCaptureFired");
65 shouldBeTrue("abortFired"); 66 shouldBeTrue("abortFired");
66 shouldBeFalse("dbBubbleFired1"); 67 shouldBeFalse("dbBubbleFired1");
67 shouldBe("event.target", "trans"); 68 shouldBe("event.target", "trans");
68 shouldBe("event.currentTarget", "db"); 69 shouldBe("event.currentTarget", "db");
69 dbBubbleFired1 = true; 70 dbBubbleFired1 = true;
71
70 debug(""); 72 debug("");
71 debug("Verifing success."); 73 debug("Verifing success.");
72 trans = evalAndLog("trans = db.transaction(['storeName'], 'readwrite')"); 74 trans = evalAndLog("trans = db.transaction(['storeName'], 'readwrite')");
73 evalAndLog("trans.oncomplete = completeFiredCallback"); 75 evalAndLog("trans.oncomplete = completeFiredCallback");
74 evalAndLog("trans.onabort = unexpectedAbortCallback"); 76 evalAndLog("trans.onabort = unexpectedAbortCallback");
75 evalAndLog("db.removeEventListener('abort', dbAbortCaptureCallback, true)"); 77 evalAndLog("db.removeEventListener('abort', dbAbortCaptureCallback, true)");
76 evalAndLog("db.removeEventListener('abort', dbAbortBubbleCallback, false)"); 78 evalAndLog("db.removeEventListener('abort', dbAbortBubbleCallback, false)");
77 evalAndLog("db.removeEventListener('complete', unexpectedCompleteCallback, t rue)"); 79 evalAndLog("db.removeEventListener('complete', unexpectedCompleteCallback, t rue)");
78 evalAndLog("db.removeEventListener('complete', unexpectedCompleteCallback, f alse)"); 80 evalAndLog("db.removeEventListener('complete', unexpectedCompleteCallback, f alse)");
79 evalAndLog("db.addEventListener('complete', dbCompleteCaptureCallback, true) "); 81 evalAndLog("db.addEventListener('complete', dbCompleteCaptureCallback, true) ");
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 finishJSTest(); 115 finishJSTest();
114 } 116 }
115 117
116 function dbCompleteBubbleCallback() 118 function dbCompleteBubbleCallback()
117 { 119 {
118 debug(""); 120 debug("");
119 debug("In IDBDatabase complete bubble"); 121 debug("In IDBDatabase complete bubble");
120 testFailed("Complete bubble callback should NOT fire"); 122 testFailed("Complete bubble callback should NOT fire");
121 dbBubbleFired2 = true; 123 dbBubbleFired2 = true;
122 } 124 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698