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.log("Checks that inspector reports script compiled in Runtime.eval
uate," + | 5 InspectorTest.log("Checks that inspector reports script compiled in Runtime.eval
uate, " + |
6 "Runtime.callFunctionOn and Runtime.compileScript"); | 6 "Runtime.callFunctionOn and Runtime.compileScript"); |
7 | 7 |
| 8 InspectorTest.addScript(` |
| 9 function fooTop() { |
| 10 eval(\` |
| 11 function foo() { |
| 12 eval("({})") |
| 13 } |
| 14 foo() //# sourceURL=second-frame.js\`); |
| 15 } |
| 16 //# sourceURL=top-frame.js`, 8, 26); |
| 17 |
| 18 InspectorTest.addScript(` |
| 19 function fooTopFail() { |
| 20 eval(\` |
| 21 function fooFail() { |
| 22 eval("({}") |
| 23 } |
| 24 fooFail() //# sourceURL=second-frame-fail.js\`); |
| 25 } |
| 26 //# sourceURL=top-frame-fail.js`, 18, 26); |
| 27 |
8 Promise.prototype.thenLog = function log(message) { | 28 Promise.prototype.thenLog = function log(message) { |
9 return this.then(() => InspectorTest.log(message)); | 29 return this.then(() => InspectorTest.log(message)); |
10 } | 30 } |
11 | 31 |
12 var objectId; | 32 var objectId; |
13 Protocol.Runtime.enable(); | 33 Protocol.Runtime.enable(); |
14 Protocol.Debugger.enable() | 34 Protocol.Debugger.enable() |
15 .then(() => Protocol.Debugger.onScriptParsed(InspectorTest.logMessage)) | 35 .then(() => Protocol.Debugger.onScriptParsed(InspectorTest.logMessage)) |
16 .then(() => Protocol.Debugger.onScriptFailedToParse(InspectorTest.logMessage)) | 36 .then(() => Protocol.Debugger.onScriptFailedToParse(InspectorTest.logMessage)) |
17 | 37 |
(...skipping 21 matching lines...) Expand all Loading... |
39 .thenLog('Runtime.compileScript with syntax error') | 59 .thenLog('Runtime.compileScript with syntax error') |
40 .then(() => Protocol.Runtime.compileScript({ expression: "}", | 60 .then(() => Protocol.Runtime.compileScript({ expression: "}", |
41 sourceURL: "compile-script-syntax-error.js", persistScript: true })) | 61 sourceURL: "compile-script-syntax-error.js", persistScript: true })) |
42 | 62 |
43 .thenLog('Runtime.compileScript persistScript: false (should be no script even
ts)') | 63 .thenLog('Runtime.compileScript persistScript: false (should be no script even
ts)') |
44 .then(() => Protocol.Runtime.compileScript({ expression: "({})", | 64 .then(() => Protocol.Runtime.compileScript({ expression: "({})", |
45 sourceURL: "compile-script-syntax-error.js", persistScript: false })) | 65 sourceURL: "compile-script-syntax-error.js", persistScript: false })) |
46 .then(() => Protocol.Runtime.compileScript({ expression: "}", | 66 .then(() => Protocol.Runtime.compileScript({ expression: "}", |
47 sourceURL: "compile-script-syntax-error.js", persistScript: false })) | 67 sourceURL: "compile-script-syntax-error.js", persistScript: false })) |
48 | 68 |
| 69 .thenLog('Runtime.evaluate compiled script with stack trace') |
| 70 .then(() => Protocol.Runtime.evaluate({ |
| 71 expression: "fooTop()"})) |
| 72 .then(msg => objectId = msg.result.result.objectId) |
| 73 |
| 74 .thenLog('Runtime.evaluate compile script error with stack trace') |
| 75 .then(() => Protocol.Runtime.evaluate({ |
| 76 expression: "fooTopFail()"})) |
| 77 .then(msg => objectId = msg.result.result.objectId) |
| 78 |
49 .then(InspectorTest.completeTest); | 79 .then(InspectorTest.completeTest); |
OLD | NEW |