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

Side by Side Diff: test/mjsunit/harmony/async-debug-caught-exception.js

Issue 2124813002: [debugger] omit exception events for rethrown exceptions in async. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressed comments Created 4 years, 5 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
« no previous file with comments | « src/parsing/preparser.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --allow-natives-syntax --harmony-async-await --expose-debug-as debug
6
7 Debug = debug.Debug
8
9 var exception = null;
10 var log;
11
12 function listener(event, exec_state, event_data, data) {
13 if (event != Debug.DebugEvent.Exception) return;
14 try {
15 var line = exec_state.frame(0).sourceLineText();
16 var match = /Exception (\w)/.exec(line);
17 assertNotNull(match);
18 log.push(match[1]);
19 } catch (e) {
20 exception = e;
21 }
22 }
23
24 async function thrower() {
25 throw "a"; // Exception a
26 }
27
28 async function caught_throw() {
29 try {
30 await thrower();
31 } catch (e) {
32 assertEquals("a", e);
33 }
34 }
35
36
37 // Caught throw, events on any exception.
38 log = [];
39 Debug.setListener(listener);
40 Debug.setBreakOnException();
41 caught_throw();
42 %RunMicrotasks();
43 Debug.setListener(null);
44 Debug.clearBreakOnException();
45 assertEquals(["a"], log);
46 assertNull(exception);
47
48 // Caught throw, events on uncaught exception.
49 log = [];
50 Debug.setListener(listener);
51 Debug.setBreakOnUncaughtException();
52 caught_throw();
53 %RunMicrotasks();
54 Debug.setListener(null);
55 Debug.clearBreakOnUncaughtException();
56 assertEquals([], log);
57 assertNull(exception);
58
59 var reject = Promise.reject("b");
60
61 async function caught_reject() {
62 try {
63 await reject;
64 } catch (e) {
65 assertEquals("b", e);
66 }
67 }
68
69 // Caught reject, events on any exception.
70 log = [];
71 Debug.setListener(listener);
72 Debug.setBreakOnException();
73 caught_reject();
74 %RunMicrotasks();
75 Debug.setListener(null);
76 Debug.clearBreakOnException();
77 assertEquals([], log);
78 assertNull(exception);
79
80 // Caught reject, events on uncaught exception.
81 log = [];
82 Debug.setListener(listener);
83 Debug.setBreakOnUncaughtException();
84 caught_reject();
85 %RunMicrotasks();
86 Debug.setListener(null);
87 Debug.clearBreakOnUncaughtException();
88 assertEquals([], log);
89 assertNull(exception);
OLDNEW
« no previous file with comments | « src/parsing/preparser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698