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

Side by Side Diff: test/debugger/debug/harmony/async-function-debug-evaluate.js

Issue 2621173002: Remove --harmony-async-await runtime flag (Closed)
Patch Set: Update test ref Created 3 years, 11 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 // 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: --harmony-async-await
6
7 var Debug = debug.Debug;
8 var breakPointCount = 0;
9
10 function listener(event, exec_state, event_data, data) {
11 if (event != Debug.DebugEvent.Break) return;
12 ++breakPointCount;
13 try {
14 if (breakPointCount === 1) {
15 assertEquals(
16 "inner", exec_state.frame(0).evaluate("inner").value());
17 assertThrows(() => exec_state.frame(0).evaluate("letInner").value(),
18 ReferenceError);
19 assertThrows(() => exec_state.frame(0).evaluate("constInner").value(),
20 ReferenceError);
21
22 assertEquals("outer", exec_state.frame(0).evaluate("outer").value());
23 assertEquals(
24 "const outer", exec_state.frame(0).evaluate("constOuter").value());
25 assertEquals(
26 "let outer", exec_state.frame(0).evaluate("letOuter").value());
27
28 assertEquals("outer", exec_state.frame(1).evaluate("outer").value());
29 assertEquals(
30 "const outer", exec_state.frame(1).evaluate("constOuter").value());
31 assertEquals(
32 "let outer", exec_state.frame(1).evaluate("letOuter").value());
33
34 assertThrows(() => exec_state.frame(0).evaluate("withVar").value(),
35 ReferenceError);
36
37 } else if (breakPointCount === 2) {
38 assertEquals(
39 "inner", exec_state.frame(0).evaluate("inner").value());
40 assertThrows(() => exec_state.frame(0).evaluate("letInner").value(),
41 ReferenceError);
42 assertThrows(() => exec_state.frame(0).evaluate("constInner").value(),
43 ReferenceError);
44
45 assertEquals(57, exec_state.frame(0).evaluate("x").value());
46 assertEquals(100, exec_state.frame(0).evaluate("y").value());
47
48 // From breakPointCount === 1 and later, it's not possible to access
49 // earlier framestates.
50 assertEquals("outer", exec_state.frame(0).evaluate("outer").value());
51 assertEquals(
52 "const outer", exec_state.frame(0).evaluate("constOuter").value());
53 assertEquals(
54 "let outer", exec_state.frame(0).evaluate("letOuter").value());
55
56 exec_state.frame(0).evaluate("x = `x later(${x})`");
57 exec_state.frame(0).evaluate("y = `y later(${y})`");
58 exec_state.frame(0).evaluate("z = `ZEE`");
59
60 } else if (breakPointCount === 3) {
61 assertEquals(
62 "inner", exec_state.frame(0).evaluate("inner").value());
63 assertEquals(
64 "let inner", exec_state.frame(0).evaluate("letInner").value());
65 assertEquals(
66 "const inner", exec_state.frame(0).evaluate("constInner").value());
67
68 } else if (breakPointCount === 4) {
69 assertEquals(
70 "oop", exec_state.frame(0).evaluate("error.message").value());
71 assertEquals(
72 "Error",
73 exec_state.frame(0).evaluate("error.constructor.name").value());
74 assertEquals("floof", exec_state.frame(0).evaluate("bun").value());
75 assertThrows(() => exec_state.frame(0).evaluate("cow").value(),
76 ReferenceError);
77
78 assertEquals("outer", exec_state.frame(0).evaluate("outer").value());
79 assertEquals(
80 "const outer", exec_state.frame(0).evaluate("constOuter").value());
81 assertEquals(
82 "let outer", exec_state.frame(0).evaluate("letOuter").value());
83 }
84 } catch (e) {
85 print(e.stack);
86 quit(1);
87 }
88 }
89
90 Debug.setListener(listener);
91
92 var outer = "outer";
93 const constOuter = "const outer";
94 let letOuter = "let outer"
95
96 async function thrower() {
97 return Promise.reject(new Error("oop"));
98 }
99
100 async function testLater() {
101 return { x: 57, y: 100 };
102 }
103
104 async function test() {
105 var inner = "inner";
106 debugger;
107
108 let withVar = await testLater();
109 with (withVar) {
110 debugger;
111 }
112
113 assertEquals("x later(57)", withVar.x);
114 assertEquals("y later(100)", withVar.y);
115 assertEquals(undefined, withVar.z);
116 assertEquals("ZEE", z);
117
118 let letInner = "let inner";
119 const constInner = "const inner";
120 debugger;
121
122 try {
123 await thrower();
124 } catch (error) {
125 const bun = "floof";
126 debugger;
127 let cow = "moo";
128 }
129 }
130
131 test().
132 then(x => {
133 Debug.setListener(null);
134 }).
135 catch(error => {
136 print(error.stack);
137 quit(1);
138 Debug.setListener(null);
139 });
OLDNEW
« no previous file with comments | « test/debugger/debug/harmony/async-debug-step-out.js ('k') | test/debugger/debug/harmony/async-function-debug-scopes.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698