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

Unified Diff: third_party/WebKit/LayoutTests/storage/indexeddb/window-onerror.html

Issue 1362953003: Fire window.onerror for uncaught IndexedDB errors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 3 years, 11 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: third_party/WebKit/LayoutTests/storage/indexeddb/window-onerror.html
diff --git a/third_party/WebKit/LayoutTests/storage/indexeddb/window-onerror.html b/third_party/WebKit/LayoutTests/storage/indexeddb/window-onerror.html
new file mode 100644
index 0000000000000000000000000000000000000000..afb050964e2471ef47fbd0ebbc4eb4344123284f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/storage/indexeddb/window-onerror.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<title>IndexedDB: Unprevented errors trigger window.onerror</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+
+setup({allow_uncaught_exception: true});
+
+var t = async_test('Unprevented error on request causes window.onerror to fire');
+t.step(function() {
+ var onerrorCalled = false;
+ var dbName = location.pathname;
+ var deleteRequest = indexedDB.deleteDatabase(dbName);
+ deleteRequest.onsuccess = t.step_func(function() {
+ var openRequest = indexedDB.open(dbName);
+ openRequest.onupgradeneeded = t.step_func(function() {
+ var db = openRequest.result;
+ var store = db.createObjectStore('store');
+ });
+ openRequest.onsuccess = t.step_func(function() {
+ var db = openRequest.result;
+ var tx = db.transaction('store', 'readwrite');
+ var store = tx.objectStore('store');
+ store.add({}, 'k1');
+ store.add({}, 'k1');
+ tx.oncomplete = t.step_func(function() {
+ assert_unreached('transaction should have aborted');
+ });
+ tx.onabort = t.step_func(function() {
+ assert_true(onerrorCalled, 'onerror should have been called');
+ t.done();
+ });
+ });
+ });
+
+ window.onerror = t.step_func(function(message, url, line, column) {
+ onerrorCalled = true;
+ assert_regexp_match(message, /ConstraintError/);
+ assert_equals(line, 25);
+ assert_equals(column, 19);
+ });
+});
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698