| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | |
| 4 <script src="../../../http/tests/inspector/debugger-test.js"></script> | |
| 5 <script src="resources/framework.js"></script> | |
| 6 <script> | |
| 7 | |
| 8 var dummy = function FAIL_should_not_pause_here() { return 0; }; | |
| 9 | |
| 10 function testFunction() | |
| 11 { | |
| 12 debugger; // <- will turn on async call stacks here. | |
| 13 | |
| 14 setTimeout(dummy, 0); | |
| 15 setTimeout(dummy.bind(null), 10); | |
| 16 | |
| 17 setTimeout(callback1, 20); // <- StepIntoAsync | |
| 18 | |
| 19 setTimeout(dummy, 0); | |
| 20 setTimeout(dummy.bind(null), 10); | |
| 21 } | |
| 22 | |
| 23 function callback1() | |
| 24 { | |
| 25 var func = setTimeout.bind(null, callback2, 0); | |
| 26 func = setTimeout.bind(null, func, 0); | |
| 27 func = setTimeout.bind(null, func, 0); | |
| 28 debugger; | |
| 29 setTimeout(func); // <- StepIntoAsync | |
| 30 Promise.resolve().then(dummy).then(dummy).then(dummy); | |
| 31 return 1; | |
| 32 } | |
| 33 | |
| 34 function callback2() | |
| 35 { | |
| 36 var func = Framework.willSchedule(callback3); | |
| 37 func = Framework.willSchedule(func); | |
| 38 func = Framework.willSchedule(func); | |
| 39 debugger; | |
| 40 Framework.schedule(func); // <- StepIntoAsync | |
| 41 Promise.resolve().then(dummy).then(dummy).then(dummy); | |
| 42 setTimeout(dummy, 0); | |
| 43 return 2; | |
| 44 } | |
| 45 | |
| 46 function callback3() | |
| 47 { | |
| 48 var func = Framework.bind(Framework.safeRun, null, Framework.createButtonWit
hEventListenersAndClick, Framework.throwFrameworkException, callback4); | |
| 49 debugger; | |
| 50 Framework.schedule(func); // <- StepIntoAsync | |
| 51 return 3; | |
| 52 } | |
| 53 | |
| 54 function callback4() | |
| 55 { | |
| 56 var func = Framework.bind(Framework.createButtonWithEventListenersAndClick,
null, callback5); | |
| 57 debugger; | |
| 58 Framework.schedule(func); // <- StepIntoAsync | |
| 59 return 4; | |
| 60 } | |
| 61 | |
| 62 function callback5() | |
| 63 { | |
| 64 var resolve; | |
| 65 var promise = new Promise(function(a, b) { resolve = a; }); | |
| 66 promise | |
| 67 .then(JSON.stringify) | |
| 68 .then(JSON.parse) | |
| 69 .then(Framework.empty) | |
| 70 .then(Framework.createButtonWithEventListenersAndClick) | |
| 71 .then(callback6) | |
| 72 .then(dummy) | |
| 73 .catch(dummy); | |
| 74 debugger; | |
| 75 resolve({foo: 42}); // <- StepIntoAsync | |
| 76 setTimeout(dummy, 0); | |
| 77 return 5; | |
| 78 } | |
| 79 | |
| 80 function callback6() | |
| 81 { | |
| 82 var value = {foo: 43}; | |
| 83 debugger; | |
| 84 Promise.resolve(value) // <- StepIntoAsync | |
| 85 .then(JSON.stringify) | |
| 86 .then(JSON.parse) | |
| 87 .then(Framework.empty) | |
| 88 .then(Framework.createButtonWithEventListenersAndClick) | |
| 89 .then(callback7) | |
| 90 .then(dummy) | |
| 91 .catch(dummy); | |
| 92 setTimeout(dummy, 0); | |
| 93 return 6; | |
| 94 } | |
| 95 | |
| 96 function callback7() | |
| 97 { | |
| 98 return 7; | |
| 99 } | |
| 100 | |
| 101 function test() | |
| 102 { | |
| 103 var maxAsyncCallStackDepth = 4; | |
| 104 var frameworkRegexString = "/framework\\.js$"; | |
| 105 WebInspector.settingForTest("skipStackFramesPattern").set(frameworkRegexStri
ng); | |
| 106 | |
| 107 InspectorTest.startDebuggerTest(step1, true); | |
| 108 | |
| 109 function step1() | |
| 110 { | |
| 111 InspectorTest.runTestFunctionAndWaitUntilPaused(step2); | |
| 112 } | |
| 113 | |
| 114 function step2() | |
| 115 { | |
| 116 InspectorTest.DebuggerAgent.setAsyncCallStackDepth(maxAsyncCallStackDept
h, step3); | |
| 117 } | |
| 118 | |
| 119 function step3() | |
| 120 { | |
| 121 var actions = [ | |
| 122 "StepOver", "StepOver", "StepOver", "Print", // on setTimeout(callba
ck1) | |
| 123 "StepIntoAsync", "Print", // at callback1 | |
| 124 "Resume", "StepOver", "StepIntoAsync", "Print", // at callback2 | |
| 125 "Resume", "StepOver", "StepIntoAsync", "Print", // at callback3 | |
| 126 "Resume", "StepOver", "StepIntoAsync", "Print", // at callback4 | |
| 127 "Resume", "StepOver", "StepIntoAsync", "Print", // at callback5 | |
| 128 "Resume", "StepOver", "StepIntoAsync", "Print", // at callback6 | |
| 129 "Resume", "StepOver", "StepInto", "StepIntoAsync", "Print", // at ca
llback7 | |
| 130 ]; | |
| 131 InspectorTest.waitUntilPausedAndPerformSteppingActions(actions, step4); | |
| 132 } | |
| 133 | |
| 134 function step4() | |
| 135 { | |
| 136 InspectorTest.completeDebuggerTest(); | |
| 137 } | |
| 138 } | |
| 139 | |
| 140 </script> | |
| 141 </head> | |
| 142 | |
| 143 <body onload="runTest()"> | |
| 144 <p> | |
| 145 Tests debugger StepIntoAsync action (part 1). | |
| 146 </p> | |
| 147 </body> | |
| 148 </html> | |
| OLD | NEW |