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

Side by Side Diff: LayoutTests/storage/indexeddb/resources/delete-in-upgradeneeded-close-in-versionchange.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 that a deleteDatabase called while handling an upgradeneeded e vent is queued and fires its events at the right time. The close() call to unblo ck the delete occurs in the connection's 'versionchange' event handler."); 6 description("Test that a deleteDatabase called while handling an upgradeneeded e vent is queued and fires its events at the right time. The close() call to unblo ck the delete occurs in the connection's 'versionchange' event handler.");
7 7
8 function test() 8 function test()
9 { 9 {
10 setDBNameFromPath(); 10 setDBNameFromPath();
11 11
12 request = evalAndLog("indexedDB.deleteDatabase(dbname)"); 12 request = evalAndLog("indexedDB.deleteDatabase(dbname)");
13 request.onsuccess = initiallyDeleted; 13 request.onsuccess = initiallyDeleted;
14 request.onerror = unexpectedErrorCallback; 14 request.onerror = unexpectedErrorCallback;
15 } 15 }
16 16
17 var sawUpgradeNeeded = false; 17 var sawUpgradeNeeded = false;
18 var sawVersionChange = false; 18 var sawVersionChange = false;
19 var sawOpenError = false;
19 20
20 function initiallyDeleted(evt) { 21 function initiallyDeleted(evt) {
21 preamble(evt); 22 preamble(evt);
22 evalAndLog("request = indexedDB.open(dbname, 1)"); 23 evalAndLog("request = indexedDB.open(dbname, 1)");
23 request.onupgradeneeded = upgradeNeededCallback; 24 request.onupgradeneeded = upgradeNeededCallback;
24 request.onsuccess = unexpectedSuccessCallback; 25 request.onsuccess = unexpectedSuccessCallback;
26 request.onerror = openError;
27 }
28
29 function openError(evt) {
30 preamble(evt);
31 shouldBeTrue("sawVersionChange");
32 evalAndLog("sawOpenError = true");
33 evt.preventDefault();
25 } 34 }
26 35
27 function upgradeNeededCallback(evt) 36 function upgradeNeededCallback(evt)
28 { 37 {
29 preamble(evt); 38 preamble(evt);
30 shouldBeFalse("sawUpgradeNeeded"); 39 shouldBeFalse("sawUpgradeNeeded");
31 evalAndLog("sawUpgradeNeeded = true"); 40 evalAndLog("sawUpgradeNeeded = true");
32 shouldBe("event.oldVersion", "0"); 41 shouldBe("event.oldVersion", "0");
33 shouldBe("event.newVersion", "1"); 42 shouldBe("event.newVersion", "1");
34 43
(...skipping 12 matching lines...) Expand all
47 evalAndLog("sawVersionChange = true"); 56 evalAndLog("sawVersionChange = true");
48 57
49 debug("Closing the connection before the IDBOpenDBRequest's success fires wi ll cause the open to fail."); 58 debug("Closing the connection before the IDBOpenDBRequest's success fires wi ll cause the open to fail.");
50 evalAndLog("db.close()"); 59 evalAndLog("db.close()");
51 } 60 }
52 61
53 function deleteSuccessCallback(evt) 62 function deleteSuccessCallback(evt)
54 { 63 {
55 preamble(evt); 64 preamble(evt);
56 shouldBeTrue("sawVersionChange"); 65 shouldBeTrue("sawVersionChange");
66 shouldBeTrue("sawOpenError");
57 shouldBeTrue("sawUpgradeNeeded"); 67 shouldBeTrue("sawUpgradeNeeded");
58 finishJSTest(); 68 finishJSTest();
59 } 69 }
60 70
61 test(); 71 test();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698