| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
r-protocol-test.js"></script> | |
| 4 <script type="text/javascript" src="resources/blackboxed.js"></script> | |
| 5 <script type="text/javascript" src="resources/mixed.js"></script> | |
| 6 <script> | |
| 7 function testFunction() | |
| 8 { | |
| 9 notBlackboxedBoo(); // for setup ranges and stepOut | |
| 10 notBlackboxedBoo(); // for stepIn | |
| 11 } | |
| 12 | |
| 13 function foo() | |
| 14 { | |
| 15 debugger; | |
| 16 return 239; | |
| 17 } | |
| 18 </script> | |
| 19 <script> | |
| 20 function test() | |
| 21 { | |
| 22 InspectorTest.eventHandler["Debugger.paused"] = setBlackboxedScriptRanges; | |
| 23 InspectorTest.sendCommandOrDie("Debugger.enable", {}, callTestFunction); | |
| 24 | |
| 25 function callTestFunction(response) | |
| 26 { | |
| 27 InspectorTest.evaluateInInspectedPage("setTimeout(testFunction, 0);"); | |
| 28 } | |
| 29 | |
| 30 function setBlackboxedScriptRanges(response) | |
| 31 { | |
| 32 var callFrames = response.params.callFrames; | |
| 33 printCallFrames(callFrames); | |
| 34 InspectorTest.sendCommand("Debugger.setBlackboxedRanges", { | |
| 35 scriptId: callFrames[1].location.scriptId, | |
| 36 positions: [ { line: 0, column: 0 } ] // blackbox ranges for blackbo
xed.js | |
| 37 }, setIncorrectRanges.bind(null, callFrames[2].location.scriptId)); | |
| 38 } | |
| 39 | |
| 40 var incorrectPositions = [ | |
| 41 [ { line: 0, column: 0 }, { line: 0, column: 0 } ], | |
| 42 [ { line: 0, column: 1 }, { line: 0, column: 0 } ], | |
| 43 [ { line: 0, column: -1 } ], | |
| 44 ]; | |
| 45 | |
| 46 function setIncorrectRanges(scriptId, response) | |
| 47 { | |
| 48 if (response.error) | |
| 49 InspectorTest.log(response.error.message); | |
| 50 var positions = incorrectPositions.shift(); | |
| 51 if (!positions) { | |
| 52 setMixedSourceRanges(scriptId); | |
| 53 return; | |
| 54 } | |
| 55 InspectorTest.log("Try to set positions: " + JSON.stringify(positions)); | |
| 56 InspectorTest.sendCommand("Debugger.setBlackboxedRanges", { | |
| 57 scriptId: scriptId, | |
| 58 positions: positions | |
| 59 }, setIncorrectRanges.bind(null, scriptId)); | |
| 60 } | |
| 61 | |
| 62 function setMixedSourceRanges(scriptId) | |
| 63 { | |
| 64 InspectorTest.eventHandler["Debugger.paused"] = runAction; | |
| 65 InspectorTest.sendCommandOrDie("Debugger.setBlackboxedRanges", { | |
| 66 scriptId: scriptId, | |
| 67 positions: [ { line: 8, column: 0 }, { line: 15, column: 0 } ] // bl
ackbox ranges for mixed.js | |
| 68 }, runAction); | |
| 69 } | |
| 70 | |
| 71 var actions = [ "stepOut", "print", "stepOut", "print", "stepOut", "print", | |
| 72 "stepInto", "print", "stepOver", "stepInto", "print", "stepOver", "stepI
nto", "print", | |
| 73 "stepOver", "stepInto", "print" ]; | |
| 74 | |
| 75 function runAction(response) | |
| 76 { | |
| 77 var action = actions.shift(); | |
| 78 if (!action) | |
| 79 InspectorTest.completeTest(); | |
| 80 | |
| 81 if (action === "print") { | |
| 82 printCallFrames(response.params.callFrames); | |
| 83 runAction({}); | |
| 84 } else { | |
| 85 InspectorTest.log("action: " + action); | |
| 86 InspectorTest.sendCommandOrDie("Debugger." + action, {}); | |
| 87 } | |
| 88 } | |
| 89 | |
| 90 function printCallFrames(callFrames) | |
| 91 { | |
| 92 var topCallFrame = callFrames[0]; | |
| 93 if (topCallFrame.functionName.startsWith("blackboxed")) | |
| 94 InspectorTest.log("FAIL: blackboxed function in top call frame"); | |
| 95 for (var callFrame of callFrames) | |
| 96 InspectorTest.log(callFrame.functionName + ': ' + callFrame.location
.lineNumber + ":" + callFrame.location.columnNumber); | |
| 97 InspectorTest.log(""); | |
| 98 } | |
| 99 } | |
| 100 </script> | |
| 101 </head> | |
| 102 <body onload="runTest()"> | |
| 103 </body> | |
| 104 </html> | |
| OLD | NEW |