| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
r-protocol-test.js"></script> | 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
r-protocol-test.js"></script> |
| 4 <script type="text/javascript" src="resources/framework-with-inline-sourcemap.js
"></script> | 4 <script type="text/javascript" src="resources/framework-with-sourcemap.js"></scr
ipt> |
| 5 <script> | 5 <script> |
| 6 function boo() | 6 function boo(m) |
| 7 { | 7 { |
| 8 return 239; | 8 var i = 42 * m; |
| 9 return i + 239; |
| 9 } | 10 } |
| 10 | 11 |
| 11 function testFunction() | 12 function testFunction() |
| 12 { | 13 { |
| 13 debugger; | 14 debugger; |
| 14 foo(boo); | 15 foo(boo.bind(null, 2)); |
| 15 } | 16 } |
| 16 | 17 |
| 17 function test() | 18 function test() |
| 18 { | 19 { |
| 19 var actions = [ "stepInto", "stepInto", "stepOut" ]; | 20 var actions = [ "stepInto", "stepInto", "stepOut" ]; |
| 20 | 21 |
| 22 var sourceMap = { |
| 23 version: 3, |
| 24 sources: [ "foo.js" ], |
| 25 names: [], |
| 26 mappings: ";;AAAA,SAAS,GAAG,CAAC,GAAG,EAChB;AACI,QAAI,CAAC,GAAG,EAAE,CAA
C;AACX,QAAI,GAAG,GAAG,GAAG,EAAE,CAAC;AAChB,WAAO,CAAE,GAAG,CAAC;CAChB" |
| 27 }; |
| 28 |
| 21 InspectorTest.eventHandler["Debugger.paused"] = printStackTraceAndMakeNextSt
ep; | 29 InspectorTest.eventHandler["Debugger.paused"] = printStackTraceAndMakeNextSt
ep; |
| 22 InspectorTest.sendCommand("Debugger.enable", {}, setSkipStackFrames); | 30 InspectorTest.eventHandler["Debugger.scriptParsed"] = scriptParsed; |
| 31 InspectorTest.sendCommand("Debugger.enable"); |
| 32 |
| 33 function scriptParsed(response) |
| 34 { |
| 35 failIfError(response); |
| 36 |
| 37 if (response.params.url.endsWith("/framework-with-sourcemap.js")) |
| 38 setSourceMapContent(response.params.scriptId); |
| 39 } |
| 40 |
| 41 function setSourceMapContent(scriptId) |
| 42 { |
| 43 InspectorTest.sendCommand("Debugger.setSourceMapContent", { |
| 44 scriptId: scriptId, |
| 45 sourceMapURL: "source.map", |
| 46 content: JSON.stringify(sourceMap) |
| 47 }, setSkipStackFrames); |
| 48 } |
| 23 | 49 |
| 24 function setSkipStackFrames(response) | 50 function setSkipStackFrames(response) |
| 25 { | 51 { |
| 26 failIfError(response); | 52 failIfError(response); |
| 27 InspectorTest.sendCommand("Debugger.skipStackFrames", { script: "foo\\.j
s$"}, callTestFunction); | 53 InspectorTest.sendCommand("Debugger.skipStackFrames", { script: "foo\\.j
s$"}, callTestFunction); |
| 28 } | 54 } |
| 29 | 55 |
| 30 function callTestFunction(response) | 56 function callTestFunction(response) |
| 31 { | 57 { |
| 32 failIfError(response); | 58 failIfError(response); |
| 33 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "setTimeou
t(testFunction, 0)"}); | 59 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "setTimeou
t(testFunction, 0)"}); |
| 34 } | 60 } |
| 35 | 61 |
| 36 function printStackTraceAndMakeNextStep(response) | 62 function printStackTraceAndMakeNextStep(response) |
| 37 { | 63 { |
| 38 failIfError(response); | 64 failIfError(response); |
| 39 var callFrames = response.params.callFrames; | 65 var callFrames = response.params.callFrames; |
| 40 InspectorTest.log("Stack trace:") | 66 InspectorTest.log("Stack trace:") |
| 41 for (var callFrame of callFrames) { | 67 for (var callFrame of callFrames) |
| 42 var location = callFrame.functionLocation.lineNumber + ":" + callFra
me.functionLocation.columnNumber; | 68 InspectorTest.log(callFrame.functionName + ":" + callFrame.functionL
ocation.lineNumber + ":" + callFrame.functionLocation.columnNumber); |
| 43 InspectorTest.log(callFrame.functionName + ":" + location); | |
| 44 } | |
| 45 | 69 |
| 46 var action = actions.shift(); | 70 var action = actions.shift(); |
| 47 if (!action) | 71 if (!action) |
| 48 InspectorTest.completeTest(); | 72 InspectorTest.completeTest(); |
| 49 else | 73 else |
| 50 InspectorTest.sendCommand("Debugger." + action); | 74 InspectorTest.sendCommand("Debugger." + action); |
| 51 } | 75 } |
| 52 | 76 |
| 53 function failIfError(response) | 77 function failIfError(response) |
| 54 { | 78 { |
| 55 if (response.error) { | 79 if (response.error) { |
| 56 InspectorTest.log(JSON.stringify(response)); | 80 InspectorTest.log(JSON.stringify(response)); |
| 57 InspectorTest.completeTest(); | 81 InspectorTest.completeTest(); |
| 58 } | 82 } |
| 59 } | 83 } |
| 60 } | 84 } |
| 61 </script> | 85 </script> |
| 62 </head> | 86 </head> |
| 63 <body onload="runTest()"> | 87 <body onload="runTest()"> |
| 64 </body> | 88 </body> |
| 65 </html> | 89 </html> |
| OLD | NEW |