| 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/blackboxed.js"></script> | 4 <script type="text/javascript" src="resources/blackboxed.js"></script> |
| 5 <script type="text/javascript" src="resources/mixed.js"></script> | 5 <script type="text/javascript" src="resources/mixed.js"></script> |
| 6 <script> | 6 <script> |
| 7 function testFunction() | 7 function testFunction() |
| 8 { | 8 { |
| 9 notBlackboxedBoo(); // for setup ranges and stepOut | 9 notBlackboxedBoo(); // for setup ranges and stepOut |
| 10 notBlackboxedBoo(); // for stepIn | 10 notBlackboxedBoo(); // for stepIn |
| 11 } | 11 } |
| 12 | 12 |
| 13 function foo() | 13 function foo() |
| 14 { | 14 { |
| 15 debugger; | 15 debugger; |
| 16 return 239; | 16 return 239; |
| 17 } | 17 } |
| 18 </script> | 18 </script> |
| 19 <script> | 19 <script> |
| 20 function test() | 20 function test() |
| 21 { | 21 { |
| 22 var scriptIdToPattern = new Map(); |
| 23 |
| 22 InspectorTest.eventHandler["Debugger.paused"] = setBlackboxedScriptRanges; | 24 InspectorTest.eventHandler["Debugger.paused"] = setBlackboxedScriptRanges; |
| 25 InspectorTest.eventHandler["Debugger.scriptParsed"] = scriptParsed; |
| 23 InspectorTest.sendCommandOrDie("Debugger.enable", {}, callTestFunction); | 26 InspectorTest.sendCommandOrDie("Debugger.enable", {}, callTestFunction); |
| 24 | 27 |
| 28 function scriptParsed(response) |
| 29 { |
| 30 scriptIdToPattern.set(response.params.scriptId, response.params.hasSourc
eURL ? { url: response.params.url } : { hash: response.params.hash }); |
| 31 } |
| 32 |
| 25 function callTestFunction(response) | 33 function callTestFunction(response) |
| 26 { | 34 { |
| 27 InspectorTest.evaluateInInspectedPage("setTimeout(testFunction, 0);"); | 35 InspectorTest.evaluateInInspectedPage("setTimeout(testFunction, 0);"); |
| 28 } | 36 } |
| 29 | 37 |
| 30 function setBlackboxedScriptRanges(response) | 38 function setBlackboxedScriptRanges(response) |
| 31 { | 39 { |
| 32 var callFrames = response.params.callFrames; | 40 var callFrames = response.params.callFrames; |
| 33 printCallFrames(callFrames); | 41 printCallFrames(callFrames); |
| 34 InspectorTest.sendCommand("Debugger.setBlackboxedRanges", { | 42 var pattern = scriptIdToPattern.get(callFrames[1].location.scriptId); |
| 35 scriptId: callFrames[1].location.scriptId, | 43 pattern.positions = [ { line: 0, column: 0 } ]; // blackbox ranges for b
lackboxed.js |
| 36 positions: [ { line: 0, column: 0 } ] // blackbox ranges for blackbo
xed.js | 44 InspectorTest.sendCommand("Debugger.addBlackboxPatterns", { |
| 45 patterns: [ pattern ] |
| 37 }, setIncorrectRanges.bind(null, callFrames[2].location.scriptId)); | 46 }, setIncorrectRanges.bind(null, callFrames[2].location.scriptId)); |
| 38 } | 47 } |
| 39 | 48 |
| 40 var incorrectPositions = [ | 49 var incorrectPositions = [ |
| 41 [ { line: 0, column: 0 }, { line: 0, column: 0 } ], | 50 [ { line: 0, column: 0 }, { line: 0, column: 0 } ], |
| 42 [ { line: 0, column: 1 }, { line: 0, column: 0 } ], | 51 [ { line: 0, column: 1 }, { line: 0, column: 0 } ], |
| 43 [ { line: 0, column: -1 } ], | 52 [ { line: 0, column: -1 } ], |
| 44 ]; | 53 ]; |
| 45 | 54 |
| 46 function setIncorrectRanges(scriptId, response) | 55 function setIncorrectRanges(scriptId, response) |
| 47 { | 56 { |
| 48 if (response.error) | 57 if (response.error) |
| 49 InspectorTest.log(response.error.message); | 58 InspectorTest.log(response.error.message); |
| 50 var positions = incorrectPositions.shift(); | 59 var positions = incorrectPositions.shift(); |
| 51 if (!positions) { | 60 if (!positions) { |
| 52 setMixedSourceRanges(scriptId); | 61 setMixedSourceRanges(scriptId); |
| 53 return; | 62 return; |
| 54 } | 63 } |
| 55 InspectorTest.log("Try to set positions: " + JSON.stringify(positions)); | 64 InspectorTest.log("Try to set positions: " + JSON.stringify(positions)); |
| 56 InspectorTest.sendCommand("Debugger.setBlackboxedRanges", { | 65 var pattern = scriptIdToPattern.get(scriptId); |
| 57 scriptId: scriptId, | 66 pattern.positions = positions; |
| 58 positions: positions | 67 InspectorTest.sendCommand("Debugger.addBlackboxPatterns", { |
| 68 patterns: [ pattern ] |
| 59 }, setIncorrectRanges.bind(null, scriptId)); | 69 }, setIncorrectRanges.bind(null, scriptId)); |
| 60 } | 70 } |
| 61 | 71 |
| 62 function setMixedSourceRanges(scriptId) | 72 function setMixedSourceRanges(scriptId) |
| 63 { | 73 { |
| 64 InspectorTest.eventHandler["Debugger.paused"] = runAction; | 74 InspectorTest.eventHandler["Debugger.paused"] = runAction; |
| 65 InspectorTest.sendCommandOrDie("Debugger.setBlackboxedRanges", { | 75 var pattern = scriptIdToPattern.get(scriptId); |
| 66 scriptId: scriptId, | 76 pattern.positions = [ { line: 8, column: 0 }, { line: 15, column: 0 } ];
// blackbox ranges for mixed.js |
| 67 positions: [ { line: 8, column: 0 }, { line: 15, column: 0 } ] // bl
ackbox ranges for mixed.js | 77 InspectorTest.sendCommandOrDie("Debugger.addBlackboxPatterns", { |
| 78 patterns: [ pattern ] |
| 68 }, runAction); | 79 }, runAction); |
| 69 } | 80 } |
| 70 | 81 |
| 71 var actions = [ "stepOut", "print", "stepOut", "print", "stepOut", "print", | 82 var actions = [ "stepOut", "print", "stepOut", "print", "stepOut", "print", |
| 72 "stepInto", "print", "stepOver", "stepInto", "print", "stepOver", "stepI
nto", "print", | 83 "stepInto", "print", "stepOver", "stepInto", "print", "stepOver", "stepI
nto", "print", |
| 73 "stepOver", "stepInto", "print" ]; | 84 "stepOver", "stepInto", "print" ]; |
| 74 | 85 |
| 75 function runAction(response) | 86 function runAction(response) |
| 76 { | 87 { |
| 77 var action = actions.shift(); | 88 var action = actions.shift(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 95 for (var callFrame of callFrames) | 106 for (var callFrame of callFrames) |
| 96 InspectorTest.log(callFrame.functionName + ': ' + callFrame.location
.lineNumber + ":" + callFrame.location.columnNumber); | 107 InspectorTest.log(callFrame.functionName + ': ' + callFrame.location
.lineNumber + ":" + callFrame.location.columnNumber); |
| 97 InspectorTest.log(""); | 108 InspectorTest.log(""); |
| 98 } | 109 } |
| 99 } | 110 } |
| 100 </script> | 111 </script> |
| 101 </head> | 112 </head> |
| 102 <body onload="runTest()"> | 113 <body onload="runTest()"> |
| 103 </body> | 114 </body> |
| 104 </html> | 115 </html> |
| OLD | NEW |