OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 InspectorTest.addScript( | 5 InspectorTest.addScript( |
6 `function *gen(a) { | 6 `function *gen(a) { |
7 var b = 42; | 7 var b = 42; |
8 yield a; | 8 yield a; |
9 return b; | 9 return b; |
10 } | 10 } |
11 function testSuspendedGenerator() | 11 function testSuspendedGenerator() |
12 { | 12 { |
13 var g = gen(420); | 13 var g = gen(420); |
14 g.next(); | 14 g.next(); |
15 | 15 |
16 debugger; | 16 debugger; |
| 17 return g; |
17 }`); | 18 }`); |
18 | 19 |
19 Protocol.Debugger.enable().then(testSuite); | 20 Protocol.Debugger.enable().then(testSuite); |
20 | 21 |
21 function dumpInnermostScope(msg) { | 22 function dumpInnermostScope(msg) { |
22 var scopes = msg.result.result; | 23 var scopes = msg.result.result; |
23 var inner_scope = scopes[0].value; | 24 var inner_scope = scopes[0].value; |
24 return Protocol.Runtime.getProperties({ objectId : inner_scope.objectId }) | 25 return Protocol.Runtime.getProperties({ objectId : inner_scope.objectId }) |
25 .then(InspectorTest.logMessage); | 26 .then(InspectorTest.logMessage); |
26 } | 27 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 }, | 70 }, |
70 | 71 |
71 function testScopesNonPaused(next) { | 72 function testScopesNonPaused(next) { |
72 Protocol.Runtime.evaluate({ expression : "gen(430)"}) | 73 Protocol.Runtime.evaluate({ expression : "gen(430)"}) |
73 .then(msg => fetchGeneratorProperties(msg.result.result.objectId)) | 74 .then(msg => fetchGeneratorProperties(msg.result.result.objectId)) |
74 .then(dumpGeneratorScopes) | 75 .then(dumpGeneratorScopes) |
75 .then(next); | 76 .then(next); |
76 }, | 77 }, |
77 ]); | 78 ]); |
78 } | 79 } |
OLD | NEW |