Index: third_party/WebKit/LayoutTests/external/wpt/IndexedDB/support.js |
diff --git a/third_party/WebKit/LayoutTests/external/wpt/IndexedDB/support.js b/third_party/WebKit/LayoutTests/external/wpt/IndexedDB/support.js |
index 63b23e5a73e7af363dd50a9cf407ffb04bc53f8d..9119d828e836ea55ad8f4c1c071a45f652222998 100644 |
--- a/third_party/WebKit/LayoutTests/external/wpt/IndexedDB/support.js |
+++ b/third_party/WebKit/LayoutTests/external/wpt/IndexedDB/support.js |
@@ -143,3 +143,21 @@ function expect(t, expected) { |
} |
}; |
} |
+ |
+// Checks to see if the passed transaction is active (by making |
+// requests against the named store). |
+function is_transaction_active(tx, store_name) { |
+ try { |
+ const request = tx.objectStore(store_name).get(0); |
+ request.onerror = e => { |
+ e.preventDefault(); |
+ e.stopPropagation(); |
+ }; |
+ return true; |
+ } catch (ex) { |
+ assert_equals(ex.name, 'TransactionInactiveError', |
+ 'Active check should either not throw anything, or throw ' + |
+ 'TransactionInactiveError'); |
+ return false; |
+ } |
+} |