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.sendCommand("Runtime.evaluate", { expression: "let a = 42;" }, ste
p2); | 5 Protocol.Runtime.evaluate({ expression: "let a = 42;" }).then(step2); |
6 | 6 |
7 function step2(response) | 7 function step2(response) |
8 { | 8 { |
9 failIfError(response); | 9 failIfError(response); |
10 InspectorTest.log("first \"let a = 1;\" result: wasThrown = " + !!response.res
ult.exceptionDetails); | 10 InspectorTest.log("first \"let a = 1;\" result: wasThrown = " + !!response.res
ult.exceptionDetails); |
11 InspectorTest.sendCommand("Runtime.evaluate", { expression: "let a = 239;" },
step3); | 11 Protocol.Runtime.evaluate({ expression: "let a = 239;" }).then(step3); |
12 } | 12 } |
13 | 13 |
14 function step3(response) | 14 function step3(response) |
15 { | 15 { |
16 failIfError(response); | 16 failIfError(response); |
17 InspectorTest.log("second \"let a = 1;\" result: wasThrown = " + !!response.re
sult.exceptionDetails); | 17 InspectorTest.log("second \"let a = 1;\" result: wasThrown = " + !!response.re
sult.exceptionDetails); |
18 if (response.result.exceptionDetails) | 18 if (response.result.exceptionDetails) |
19 InspectorTest.log("exception message: " + response.result.exceptionDetails.t
ext + " " + response.result.exceptionDetails.exception.description); | 19 InspectorTest.log("exception message: " + response.result.exceptionDetails.t
ext + " " + response.result.exceptionDetails.exception.description); |
20 InspectorTest.sendCommand("Runtime.evaluate", { expression: "a" }, step4); | 20 Protocol.Runtime.evaluate({ expression: "a" }).then(step4); |
21 } | 21 } |
22 | 22 |
23 function step4(response) | 23 function step4(response) |
24 { | 24 { |
25 failIfError(response); | 25 failIfError(response); |
26 InspectorTest.log(JSON.stringify(response.result)); | 26 InspectorTest.log(JSON.stringify(response.result)); |
27 checkMethod(null); | 27 checkMethod(null); |
28 } | 28 } |
29 | 29 |
30 var methods = [ "dir", "dirxml", "keys", "values", "profile", "profileEnd", | 30 var methods = [ "dir", "dirxml", "keys", "values", "profile", "profileEnd", |
31 "inspect", "copy", "clear", | 31 "inspect", "copy", "clear", |
32 "debug", "undebug", "monitor", "unmonitor", "table" ]; | 32 "debug", "undebug", "monitor", "unmonitor", "table" ]; |
33 | 33 |
34 function checkMethod(response) | 34 function checkMethod(response) |
35 { | 35 { |
36 failIfError(response); | 36 failIfError(response); |
37 | 37 |
38 if (response) | 38 if (response) |
39 InspectorTest.log(response.result.result.description); | 39 InspectorTest.log(response.result.result.description); |
40 | 40 |
41 var method = methods.shift(); | 41 var method = methods.shift(); |
42 if (!method) | 42 if (!method) |
43 InspectorTest.completeTest(); | 43 InspectorTest.completeTest(); |
44 | 44 |
45 InspectorTest.sendCommand("Runtime.evaluate", { expression: method, includeCom
mandLineAPI: true }, checkMethod); | 45 Protocol.Runtime.evaluate({ expression: method, includeCommandLineAPI: true })
.then(checkMethod); |
46 } | 46 } |
47 | 47 |
48 function failIfError(response) | 48 function failIfError(response) |
49 { | 49 { |
50 if (response && response.error) | 50 if (response && response.error) |
51 InspectorTest.log("FAIL: " + JSON.stringify(response.error)); | 51 InspectorTest.log("FAIL: " + JSON.stringify(response.error)); |
52 } | 52 } |
OLD | NEW |