| 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 let {session, contextGroup, Protocol} = InspectorTest.start('Tests that function
location in call frames is correct'); |
| 6 |
| 7 contextGroup.addScript( |
| 6 `function testFunction() | 8 `function testFunction() |
| 7 { | 9 { |
| 8 var a = 2; | 10 var a = 2; |
| 9 debugger; | 11 debugger; |
| 10 }`); | 12 }`); |
| 11 | 13 |
| 12 Protocol.Debugger.enable(); | 14 Protocol.Debugger.enable(); |
| 13 Protocol.Debugger.oncePaused().then(handleDebuggerPaused); | 15 Protocol.Debugger.oncePaused().then(handleDebuggerPaused); |
| 14 Protocol.Runtime.evaluate({ "expression": "setTimeout(testFunction, 0)" }); | 16 Protocol.Runtime.evaluate({ "expression": "setTimeout(testFunction, 0)" }); |
| 15 | 17 |
| 16 function handleDebuggerPaused(messageObject) | 18 function handleDebuggerPaused(messageObject) |
| 17 { | 19 { |
| 18 InspectorTest.log("Paused on 'debugger;'"); | 20 InspectorTest.log("Paused on 'debugger;'"); |
| 19 var topFrame = messageObject.params.callFrames[0]; | 21 var topFrame = messageObject.params.callFrames[0]; |
| 20 topFrame.location.scriptId = "42"; | 22 topFrame.location.scriptId = "42"; |
| 21 topFrame.functionLocation.scriptId = "42"; | 23 topFrame.functionLocation.scriptId = "42"; |
| 22 InspectorTest.log("Top frame location: " + JSON.stringify(topFrame.location)); | 24 InspectorTest.log("Top frame location: " + JSON.stringify(topFrame.location)); |
| 23 InspectorTest.log("Top frame functionLocation: " + JSON.stringify(topFrame.fun
ctionLocation)); | 25 InspectorTest.log("Top frame functionLocation: " + JSON.stringify(topFrame.fun
ctionLocation)); |
| 24 InspectorTest.completeTest(); | 26 InspectorTest.completeTest(); |
| 25 } | 27 } |
| OLD | NEW |