| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../../http/tests/inspector/debugger-test.js"></script> | 4 <script src="../../../http/tests/inspector/debugger-test.js"></script> |
| 5 <script src="resources/framework.js"></script> | 5 <script src="resources/framework.js"></script> |
| 6 <script> | 6 <script> |
| 7 | 7 |
| 8 function testFunction() | 8 function testFunction() |
| 9 { | 9 { |
| 10 debugger; | 10 Framework.safeRun(Framework.breakInFramework, Framework.empty) |
| 11 Framework.safeRun(function callback1() { | 11 Framework.safeRun(Framework.empty); // should not step inside |
| 12 Framework.safeRun(Framework.empty, callback2); | 12 Framework.empty(); // dummy call |
| 13 }); | 13 Framework.sendXHR('/foo?a=b'); |
| 14 } | |
| 15 | |
| 16 function callback2() | |
| 17 { | |
| 18 Framework.safeRun(Framework.empty, Framework.empty); // Should be skipped: a
ll callbacks are inside frameworks. | |
| 19 Framework.safeRun(Framework.empty, Framework.throwFrameworkException, callba
ck3); // Should be enough to step into callback3 | |
| 20 } | |
| 21 | |
| 22 function callback3() | |
| 23 { | |
| 24 var func = Framework.bind(callback4, null, 1); | |
| 25 func = Framework.bind(func, null, 2); | |
| 26 func = Framework.bind(func, null, 3); | |
| 27 Framework.safeRun(func, Framework.doSomeWork); | |
| 28 } | |
| 29 | |
| 30 function callback4() | |
| 31 { | |
| 32 Framework.safeRun(Framework.doSomeWork, function() { | |
| 33 return 0; // Should NOT step into this callback (otherwise too many Step
Ins) | |
| 34 }); | |
| 35 try { | |
| 36 Framework.throwFrameworkException("message"); | |
| 37 } catch (e) { | |
| 38 window.ex = e; | |
| 39 } | |
| 40 } | 14 } |
| 41 | 15 |
| 42 function test() | 16 function test() |
| 43 { | 17 { |
| 44 var frameworkRegexString = "/framework\\.js$"; | 18 var frameworkRegexString = "/framework\\.js$"; |
| 45 WebInspector.experimentsSettings.frameworksDebuggingSupport.enableForTest(); | 19 WebInspector.experimentsSettings.frameworksDebuggingSupport.enableForTest(); |
| 46 WebInspector.settings.skipStackFramesSwitch.set(true); | 20 WebInspector.settings.skipStackFramesSwitch.set(true); |
| 47 WebInspector.settings.skipStackFramesPattern.set(frameworkRegexString); | 21 WebInspector.settings.skipStackFramesPattern.set(frameworkRegexString); |
| 48 | 22 |
| 49 InspectorTest.setQuiet(true); | 23 InspectorTest.setQuiet(true); |
| 50 InspectorTest.startDebuggerTest(step1); | 24 InspectorTest.startDebuggerTest(step1); |
| 51 | 25 |
| 26 var xhrPane; |
| 27 |
| 52 function step1() | 28 function step1() |
| 53 { | 29 { |
| 30 xhrPane = WebInspector.panels.sources.sidebarPanes.xhrBreakpoints; |
| 31 xhrPane._setBreakpoint("foo", true); |
| 54 InspectorTest.runTestFunctionAndWaitUntilPaused(didPause); | 32 InspectorTest.runTestFunctionAndWaitUntilPaused(didPause); |
| 55 } | 33 } |
| 56 | 34 |
| 57 var actions = [ | 35 var actions = [ |
| 58 "Print", // debugger; | 36 "Print", // debugger; |
| 59 "StepInto", "StepInto", "Print", // callback1 | 37 "StepInto", "Print", |
| 60 "StepInto", "Print", // callback2 | 38 "StepOver", "Print", |
| 61 "StepInto", "Print", // callback2, skipped | 39 "StepOut", "Print", |
| 62 "StepInto", "Print", // callback3 | 40 "StepInto", "Print", // should not step inside |
| 63 "StepInto", "StepInto", "StepInto", "StepInto", "Print", // callback4 | 41 "Resume", "Print", // should stop on XHR.send() |
| 64 "StepInto", "Print", // callback4, skipped | 42 "StepInto", "Print", // should step inside framework |
| 65 "StepInto", "Print", // callback4, inside catch | |
| 66 "StepOut", "Print", // return to callback3 | |
| 67 "StepOver", "Print", // return to callback2 | |
| 68 "StepInto", "Print", // return to callback1 | |
| 69 ]; | 43 ]; |
| 70 | 44 |
| 71 function didPause(callFrames, reason, breakpointIds, asyncStackTrace) | 45 function didPause(callFrames, reason, breakpointIds, asyncStackTrace) |
| 72 { | 46 { |
| 73 var action = actions.shift(); | 47 var action = actions.shift(); |
| 74 if (action === "Print") { | 48 if (action === "Print") { |
| 75 InspectorTest.captureStackTrace(callFrames); | 49 InspectorTest.captureStackTrace(callFrames); |
| 76 InspectorTest.addResult(""); | 50 InspectorTest.addResult(""); |
| 77 while (action === "Print") | 51 while (action === "Print") |
| 78 action = actions.shift(); | 52 action = actions.shift(); |
| 79 } | 53 } |
| 80 | 54 |
| 81 if (!action) { | 55 if (!action) { |
| 82 InspectorTest.completeDebuggerTest(); | 56 completeTest() |
| 83 return; | 57 return; |
| 84 } | 58 } |
| 85 | 59 |
| 86 InspectorTest.addResult("Executing " + action + "..."); | 60 InspectorTest.addResult("Executing " + action + "..."); |
| 87 switch (action) { | 61 switch (action) { |
| 88 case "StepInto": | 62 case "StepInto": |
| 89 WebInspector.panels.sources._stepIntoButton.element.click(); | 63 WebInspector.panels.sources._stepIntoButton.element.click(); |
| 90 break; | 64 break; |
| 91 case "StepOver": | 65 case "StepOver": |
| 92 WebInspector.panels.sources._stepOverButton.element.click(); | 66 WebInspector.panels.sources._stepOverButton.element.click(); |
| 93 break; | 67 break; |
| 94 case "StepOut": | 68 case "StepOut": |
| 95 WebInspector.panels.sources._stepOutButton.element.click(); | 69 WebInspector.panels.sources._stepOutButton.element.click(); |
| 96 break; | 70 break; |
| 71 case "Resume": |
| 72 InspectorTest.resumeExecution(InspectorTest.waitUntilPaused.bind(Ins
pectorTest, didPause)); |
| 73 break; |
| 97 default: | 74 default: |
| 98 InspectorTest.addResult("FAIL: Unknown action: " + action); | 75 InspectorTest.addResult("FAIL: Unknown action: " + action); |
| 99 InspectorTest.completeDebuggerTest(); | 76 completeTest() |
| 100 return; | 77 return; |
| 101 } | 78 } |
| 102 InspectorTest.waitUntilResumed(InspectorTest.waitUntilPaused.bind(Inspec
torTest, didPause)); | 79 InspectorTest.waitUntilResumed(InspectorTest.waitUntilPaused.bind(Inspec
torTest, didPause)); |
| 103 } | 80 } |
| 81 |
| 82 function completeTest() |
| 83 { |
| 84 xhrPane._removeBreakpoint("foo"); |
| 85 InspectorTest.completeDebuggerTest(); |
| 86 } |
| 104 } | 87 } |
| 105 | 88 |
| 106 </script> | 89 </script> |
| 107 </head> | 90 </head> |
| 108 | 91 |
| 109 <body onload="runTest()"> | 92 <body onload="runTest()"> |
| 110 <input type='button' onclick='testFunction()' value='Test'/> | 93 <input type='button' onclick='testFunction()' value='Test'/> |
| 111 <p> | 94 <p> |
| 112 Tests stepping into/over/out with framework black-boxing. | 95 Tests stepping from framework call frames. |
| 113 </p> | 96 </p> |
| 114 </body> | 97 </body> |
| 115 </html> | 98 </html> |
| OLD | NEW |