Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: third_party/WebKit/LayoutTests/inspector-protocol/debugger/stepping-with-blackboxed-ranges.html

Issue 1902993002: [DevTools] Introduce provisional blackboxing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 scriptIdToHash = 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 scriptIdToHash.set(response.params.scriptId, 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 InspectorTest.sendCommand("Debugger.setScriptBlackboxed", {
35 scriptId: callFrames[1].location.scriptId, 43 hash: scriptIdToHash.get(callFrames[1].location.scriptId),
36 positions: [ { line: 0, column: 0 } ] // blackbox ranges for blackbo xed.js
37 }, setIncorrectRanges.bind(null, callFrames[2].location.scriptId)); 44 }, setIncorrectRanges.bind(null, callFrames[2].location.scriptId));
38 } 45 }
39 46
40 var incorrectPositions = [ 47 var incorrectRanges = [
41 [ { line: 0, column: 0 }, { line: 0, column: 0 } ], 48 [ { startLine: 0, startColumn: 0, endLine: 0, endColumn: 0 } ],
42 [ { line: 0, column: 1 }, { line: 0, column: 0 } ], 49 [ { startLine: 0, startColumn: 1, endLine: 0, endColumn: 0 } ]
43 [ { line: 0, column: -1 } ],
44 ]; 50 ];
45 51
46 function setIncorrectRanges(scriptId, response) 52 function setIncorrectRanges(scriptId, response)
47 { 53 {
48 if (response.error) 54 if (response.error)
49 InspectorTest.log(response.error.message); 55 InspectorTest.log(response.error.message);
50 var positions = incorrectPositions.shift(); 56 var ranges = incorrectRanges.shift();
51 if (!positions) { 57 if (!ranges) {
52 setMixedSourceRanges(scriptId); 58 setMixedSourceRanges(scriptId);
53 return; 59 return;
54 } 60 }
55 InspectorTest.log("Try to set positions: " + JSON.stringify(positions)); 61 InspectorTest.log("Try to set ranges: " + JSON.stringify(ranges));
56 InspectorTest.sendCommand("Debugger.setBlackboxedRanges", { 62 InspectorTest.sendCommand("Debugger.setScriptBlackboxed", {
57 scriptId: scriptId, 63 hash: scriptIdToHash.get(scriptId),
58 positions: positions 64 ranges: ranges
59 }, setIncorrectRanges.bind(null, scriptId)); 65 }, setIncorrectRanges.bind(null, scriptId));
60 } 66 }
61 67
62 function setMixedSourceRanges(scriptId) 68 function setMixedSourceRanges(scriptId)
63 { 69 {
64 InspectorTest.eventHandler["Debugger.paused"] = runAction; 70 InspectorTest.eventHandler["Debugger.paused"] = runAction;
65 InspectorTest.sendCommandOrDie("Debugger.setBlackboxedRanges", { 71 InspectorTest.sendCommandOrDie("Debugger.setScriptBlackboxed", {
66 scriptId: scriptId, 72 hash: scriptIdToHash.get(scriptId),
67 positions: [ { line: 8, column: 0 }, { line: 15, column: 0 } ] // bl ackbox ranges for mixed.js 73 ranges: [ { startLine: 8, startColumn: 0 , endLine: 15, endColumn: 0 } ] // blackbox ranges for mixed.js
68 }, runAction); 74 }, runAction);
69 } 75 }
70 76
71 var actions = [ "stepOut", "print", "stepOut", "print", "stepOut", "print", 77 var actions = [ "stepOut", "print", "stepOut", "print", "stepOut", "print",
72 "stepInto", "print", "stepOver", "stepInto", "print", "stepOver", "stepI nto", "print", 78 "stepInto", "print", "stepOver", "stepInto", "print", "stepOver", "stepI nto", "print",
73 "stepOver", "stepInto", "print" ]; 79 "stepOver", "stepInto", "print" ];
74 80
75 function runAction(response) 81 function runAction(response)
76 { 82 {
77 var action = actions.shift(); 83 var action = actions.shift();
(...skipping 17 matching lines...) Expand all
95 for (var callFrame of callFrames) 101 for (var callFrame of callFrames)
96 InspectorTest.log(callFrame.functionName + ': ' + callFrame.location .lineNumber + ":" + callFrame.location.columnNumber); 102 InspectorTest.log(callFrame.functionName + ': ' + callFrame.location .lineNumber + ":" + callFrame.location.columnNumber);
97 InspectorTest.log(""); 103 InspectorTest.log("");
98 } 104 }
99 } 105 }
100 </script> 106 </script>
101 </head> 107 </head>
102 <body onload="runTest()"> 108 <body onload="runTest()">
103 </body> 109 </body>
104 </html> 110 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698