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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/IndexedDB/fire-success-event-exception.html

Issue 2734533002: IndexedDB: Align abort behavior on uncaught exception with Gecko (Closed)
Patch Set: Test refactors per review Created 3 years, 9 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <meta charset=utf-8>
3 <title>Fire success event - Exception thrown</title>
4 <link rel="help" href="https://w3c.github.io/IndexedDB/#fire-success-event">
5 <script src=/resources/testharness.js></script>
6 <script src=/resources/testharnessreport.js></script>
7 <script src=support.js></script>
8 <script>
9 setup({allow_uncaught_exception:true});
10
11 function fire_success_event_test(func, description) {
12 indexeddb_test(
13 (t, db) => {
14 db.createObjectStore('s');
15 },
16 (t, db) => {
17 const tx = db.transaction('s');
18 tx.oncomplete = t.unreached_func('transaction should abort');
19 const store = tx.objectStore('s');
20 const request = store.get(0);
21 func(t, db, tx, request);
22 },
23 description);
24 }
25
26 fire_success_event_test((t, db, tx, request) => {
27 request.onsuccess = () => {
28 throw Error();
29 };
30 tx.onabort = t.step_func_done(() => {
31 assert_equals(tx.error.name, 'AbortError');
32 });
33 }, 'Exception in success event handler on request');
34
35 fire_success_event_test((t, db, tx, request) => {
36 request.addEventListener('success', () => {
37 throw Error();
38 });
39 tx.onabort = t.step_func_done(() => {
40 assert_equals(tx.error.name, 'AbortError');
41 });
42 }, 'Exception in success event listener on request');
43
44 fire_success_event_test((t, db, tx, request) => {
45 request.addEventListener('success', () => {
46 // no-op
47 });
48 request.addEventListener('success', () => {
49 throw Error();
50 });
51 tx.onabort = t.step_func_done(() => {
52 assert_equals(tx.error.name, 'AbortError');
53 });
54 }, 'Exception in second success event listener on request');
55
56 fire_success_event_test((t, db, tx, request) => {
57 let second_listener_called = false;
58 request.addEventListener('success', () => {
59 throw Error();
60 });
61 request.addEventListener('success', t.step_func(() => {
62 second_listener_called = true;
63 assert_true(is_transaction_active(tx, 's'),
64 'Transaction should be active until dispatch completes');
65 }));
66 tx.onabort = t.step_func_done(() => {
67 assert_true(second_listener_called);
68 assert_equals(tx.error.name, 'AbortError');
69 });
70 }, 'Exception in first success event listener, tx active in second');
71
72 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698