Index: third_party/WebKit/LayoutTests/storage/indexeddb/resources/observer.js |
diff --git a/third_party/WebKit/LayoutTests/storage/indexeddb/resources/observer.js b/third_party/WebKit/LayoutTests/storage/indexeddb/resources/observer.js |
index dfcf7295440e7e2788cec51475714d9e63e9bcbe..9445dbc0facae5e112b26a65da71694accf245a3 100644 |
--- a/third_party/WebKit/LayoutTests/storage/indexeddb/resources/observer.js |
+++ b/third_party/WebKit/LayoutTests/storage/indexeddb/resources/observer.js |
@@ -5,6 +5,7 @@ if (this.importScripts) { |
async_test(function(t) { |
var dbname = location.pathname + ' - ' + 'empty transaction'; |
+ indexedDB.deleteDatabase(dbname); |
var openRequest = indexedDB.open(dbname); |
var callback_count = 0; |
var obs = new IDBObserver(t.step_func(function() { callback_count++; })); |
@@ -32,6 +33,7 @@ async_test(function(t) { |
async_test(function(t) { |
var dbname = location.pathname + ' - ' + 'observer in version change'; |
+ indexedDB.deleteDatabase(dbname); |
var openRequest = indexedDB.open(dbname); |
var callback_count = 0; |
var obs; |
@@ -60,6 +62,7 @@ async_test(function(t) { |
async_test(function(t) { |
var dbname = location.pathname + ' - ' + 'ignore observe call'; |
+ indexedDB.deleteDatabase(dbname); |
var openRequest = indexedDB.open(dbname); |
var callback_count = 0; |
var obs = new IDBObserver(t.step_func(function() { callback_count++; })); |
@@ -82,6 +85,7 @@ async_test(function(t) { |
async_test(function(t) { |
var dbname = location.pathname + ' - ' + 'abort associated transaction'; |
+ indexedDB.deleteDatabase(dbname); |
var openRequest = indexedDB.open(dbname); |
var callback_count = 0; |
var obs = new IDBObserver(t.step_func(function() { callback_count++; })); |
@@ -90,6 +94,10 @@ async_test(function(t) { |
}); |
openRequest.onsuccess = t.step_func(function() { |
var db = openRequest.result; |
+ |
+ // Prevent propagation to global error handler. |
+ db.onerror = e => { e.preventDefault(); }; |
+ |
var tx1 = db.transaction('store', 'readwrite'); |
var tx2 = db.transaction('store', 'readwrite'); |
tx1.objectStore('store').get(1); |
@@ -111,6 +119,7 @@ async_test(function(t) { |
async_test(function(t) { |
var dbname = location.pathname + ' - ' + 'abort transaction'; |
+ indexedDB.deleteDatabase(dbname); |
var openRequest = indexedDB.open(dbname); |
var callback_count = 0; |
var obs = new IDBObserver(t.step_func(function() { callback_count++; })); |
@@ -119,6 +128,10 @@ async_test(function(t) { |
}); |
openRequest.onsuccess = t.step_func(function() { |
var db = openRequest.result; |
+ |
+ // Prevent propagation to global error handler. |
+ db.onerror = e => { e.preventDefault(); }; |
+ |
var tx1 = db.transaction('store', 'readwrite'); |
var tx2 = db.transaction('store', 'readwrite'); |
var tx3 = db.transaction('store', 'readwrite'); |
@@ -143,4 +156,4 @@ async_test(function(t) { |
}); |
}, 'Abort transaction recorded by observer'); |
-done(); |
+done(); |