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

Unified Diff: LayoutTests/storage/indexeddb/resources/error-causes-abort-by-default.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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/storage/indexeddb/resources/error-causes-abort-by-default.js
diff --git a/LayoutTests/storage/indexeddb/resources/error-causes-abort-by-default.js b/LayoutTests/storage/indexeddb/resources/error-causes-abort-by-default.js
index e4126506ae31388a1dfe5fac1651d1c25fbcff99..c1edcb7b8ce96a487cb6644d9d5706e2967c1f84 100644
--- a/LayoutTests/storage/indexeddb/resources/error-causes-abort-by-default.js
+++ b/LayoutTests/storage/indexeddb/resources/error-causes-abort-by-default.js
@@ -5,7 +5,7 @@ if (this.importScripts) {
description("Verify that a transaction with an error aborts unless preventDefault() is called.");
-indexedDBTest(prepareDatabase, addData);
+indexedDBTest(prepareDatabase, testDefaultPreventedDoesNotAbort);
function prepareDatabase()
{
db = event.target.result;
@@ -16,23 +16,21 @@ function prepareDatabase()
evalAndLog("db.createObjectStore('storeName', null)");
}
-function addData()
+function testDefaultPreventedDoesNotAbort()
{
+ debug("");
+ debug("Test: prevent the default event behavior prevents the transaction from aborting");
trans = evalAndLog("trans = db.transaction(['storeName'], 'readwrite')");
evalAndLog("trans.onabort = unexpectedAbortCallback");
evalAndLog("trans.oncomplete = transactionCompleted");
store = evalAndLog("store = trans.objectStore('storeName')");
request = evalAndLog("store.add({x: 'value', y: 'zzz'}, 'key')");
- request.onsuccess = addMore;
request.onerror = unexpectedErrorCallback;
-}
-
-function addMore()
-{
-
- request = evalAndLog("event.target.source.add({x: 'value', y: 'zzz'}, 'key')");
- request.onsuccess = unexpectedSuccessCallback;
- request.addEventListener("error", preventTheDefault);
+ request.onsuccess = function() {
+ request = evalAndLog("event.target.source.add({x: 'value', y: 'zzz'}, 'key')");
+ request.onsuccess = unexpectedSuccessCallback;
+ request.addEventListener("error", preventTheDefault);
+ };
}
function preventTheDefault()
@@ -43,8 +41,13 @@ function preventTheDefault()
function transactionCompleted()
{
testPassed("Transaction completed");
+ testDefaultAllowedAborts();
+}
+
+function testDefaultAllowedAborts()
+{
debug("");
- debug("");
+ debug("Test: allowing the default event behavior, which aborts the transaction");
trans = evalAndLog("trans = db.transaction(['storeName'], 'readwrite')");
evalAndLog("trans.onabort = transactionAborted1");
evalAndLog("trans.oncomplete = unexpectedCompleteCallback");
@@ -52,6 +55,7 @@ function transactionCompleted()
request = evalAndLog("store.add({x: 'value', y: 'zzz'}, 'key')");
request.onsuccess = unexpectedSuccessCallback;
request.onerror = allowDefault;
+ expectError();
}
function allowDefault()
@@ -62,15 +66,20 @@ function allowDefault()
function transactionAborted1()
{
testPassed("Transaction aborted");
+ testNoErrorHandlerAborts();
+}
+
+function testNoErrorHandlerAborts() {
debug("");
- debug("");
+ debug("Test: no error handler implicitly allows allowing the default event behavior, which aborts the transaction");
trans = evalAndLog("trans = db.transaction(['storeName'], 'readwrite')");
evalAndLog("trans.onabort = transactionAborted2");
evalAndLog("trans.oncomplete = unexpectedCompleteCallback");
store = evalAndLog("store = trans.objectStore('storeName')");
request = evalAndLog("store.add({x: 'value', y: 'zzz'}, 'key')");
request.onsuccess = unexpectedSuccessCallback;
- debug("Omitting an onerror handler");
+ expectError();
+ debug("Omitting an onerror handler on request; transaction should abort");
}
function transactionAborted2()

Powered by Google App Engine
This is Rietveld 408576698