| Index: third_party/WebKit/LayoutTests/external/wpt/IndexedDB/fire-success-event-exception.html
|
| diff --git a/third_party/WebKit/LayoutTests/external/wpt/IndexedDB/fire-success-event-exception.html b/third_party/WebKit/LayoutTests/external/wpt/IndexedDB/fire-success-event-exception.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..b4b867e7719938ff767f3d58ec74a53c13a75c7f
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/external/wpt/IndexedDB/fire-success-event-exception.html
|
| @@ -0,0 +1,92 @@
|
| +<!DOCTYPE html>
|
| +<meta charset=utf-8>
|
| +<title>Fire success event - Exception thrown</title>
|
| +<script src=/resources/testharness.js></script>
|
| +<script src=/resources/testharnessreport.js></script>
|
| +<script src=support.js></script>
|
| +<script>
|
| +setup({allow_uncaught_exception:true});
|
| +
|
| +indexeddb_test(
|
| + (t, db) => {
|
| + db.createObjectStore('s');
|
| + },
|
| + (t, db) => {
|
| + const tx = db.transaction('s');
|
| + const store = tx.objectStore('s');
|
| + const request = store.get(0);
|
| + request.onsuccess = () => {
|
| + throw Error();
|
| + };
|
| + tx.oncomplete = t.unreached_func('transaction should abort');
|
| + tx.onabort = t.step_func_done(() => {
|
| + assert_equals(tx.error.name, 'AbortError');
|
| + });
|
| + },
|
| + 'Exception in success event handler on request');
|
| +
|
| +indexeddb_test(
|
| + (t, db) => {
|
| + db.createObjectStore('s');
|
| + },
|
| + (t, db) => {
|
| + const tx = db.transaction('s');
|
| + const store = tx.objectStore('s');
|
| + const request = store.get(0);
|
| + request.addEventListener('success', () => {
|
| + throw Error();
|
| + });
|
| + tx.oncomplete = t.unreached_func('transaction should abort');
|
| + tx.onabort = t.step_func_done(() => {
|
| + assert_equals(tx.error.name, 'AbortError');
|
| + });
|
| + },
|
| + 'Exception in success event listener on request');
|
| +
|
| +indexeddb_test(
|
| + (t, db) => {
|
| + db.createObjectStore('s');
|
| + },
|
| + (t, db) => {
|
| + const tx = db.transaction('s');
|
| + const store = tx.objectStore('s');
|
| + const request = store.get(0);
|
| + request.addEventListener('success', () => {
|
| + // no-op
|
| + });
|
| + request.addEventListener('success', () => {
|
| + throw Error();
|
| + });
|
| + tx.oncomplete = t.unreached_func('transaction should abort');
|
| + tx.onabort = t.step_func_done(() => {
|
| + assert_equals(tx.error.name, 'AbortError');
|
| + });
|
| + },
|
| + 'Exception in second success event listener on request');
|
| +
|
| +indexeddb_test(
|
| + (t, db) => {
|
| + db.createObjectStore('s');
|
| + },
|
| + (t, db) => {
|
| + const tx = db.transaction('s');
|
| + const store = tx.objectStore('s');
|
| + const request = store.get(0);
|
| + let second_listener_called = false;
|
| + request.addEventListener('success', () => {
|
| + throw Error();
|
| + });
|
| + request.addEventListener('success', t.step_func(() => {
|
| + second_listener_called = true;
|
| + assert_true(is_transaction_active(tx, 's'),
|
| + 'Transaction should be active until dispatch completes');
|
| + }));
|
| + tx.oncomplete = t.unreached_func('transaction should abort');
|
| + tx.onabort = t.step_func_done(() => {
|
| + assert_true(second_listener_called);
|
| + assert_equals(tx.error.name, 'AbortError');
|
| + });
|
| + },
|
| + 'Exception in first success event listener, tx active in second');
|
| +
|
| +</script>
|
|
|