| 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(callback7, 20); // <- StepIntoAsync | |
| 16 } | |
| 17 | |
| 18 function callback7() | |
| 19 { | |
| 20 Promise.resolve(42) | |
| 21 .then( | |
| 22 function inner() | |
| 23 { | |
| 24 var p = Promise.reject(new Error("my error")); | |
| 25 p.catch(function() {}); | |
| 26 debugger; | |
| 27 return p; // <- StepIntoAsync | |
| 28 } | |
| 29 ) | |
| 30 .then(dummy) | |
| 31 .catch(Framework.throwFrameworkException) | |
| 32 .catch(callback8); | |
| 33 return 7; | |
| 34 } | |
| 35 | |
| 36 function callback8() | |
| 37 { | |
| 38 var obj = {}; | |
| 39 Object.observe(obj, callback9); | |
| 40 debugger; | |
| 41 obj.foo = 1; // <- StepIntoAsync | |
| 42 setTimeout(dummy); | |
| 43 return 8; | |
| 44 } | |
| 45 | |
| 46 function callback9() | |
| 47 { | |
| 48 var iframe = document.getElementById("iframe"); | |
| 49 var win = iframe.contentWindow; | |
| 50 window.addEventListener("message", callback10, false); | |
| 51 debugger; | |
| 52 win.postMessage("skip debugger", "*"); // <- StepIntoAsync | |
| 53 setTimeout(dummy, 0); | |
| 54 Promise.resolve().then(dummy); | |
| 55 return 9; | |
| 56 } | |
| 57 | |
| 58 function callback10() | |
| 59 { | |
| 60 window.removeEventListener("message", callback10, false); | |
| 61 debugger; | |
| 62 Promise.resolve({foo: 44}) // <- StepIntoAsync | |
| 63 .then( | |
| 64 function inner1() // <- StepIntoAsync when in inner1 should lead de
bugger to the | |
| 65 { // next promise handler in the chain, i.e. the on
e, which will | |
| 66 } // receive the result returned by inner1, that is
inner2. | |
| 67 ) | |
| 68 .then(Framework.empty) | |
| 69 .then( | |
| 70 function inner2() | |
| 71 { | |
| 72 return callback11(); | |
| 73 } | |
| 74 ) | |
| 75 .then(dummy); | |
| 76 setTimeout(dummy, 0); | |
| 77 return 10; | |
| 78 } | |
| 79 | |
| 80 function callback11() | |
| 81 { | |
| 82 return 11; | |
| 83 } | |
| 84 | |
| 85 function test() | |
| 86 { | |
| 87 var maxAsyncCallStackDepth = 4; | |
| 88 var frameworkRegexString = "/framework\\.js$"; | |
| 89 WebInspector.settingForTest("skipStackFramesPattern").set(frameworkRegexStri
ng); | |
| 90 | |
| 91 InspectorTest.startDebuggerTest(step1, true); | |
| 92 | |
| 93 function step1() | |
| 94 { | |
| 95 InspectorTest.runTestFunctionAndWaitUntilPaused(step2); | |
| 96 } | |
| 97 | |
| 98 function step2() | |
| 99 { | |
| 100 InspectorTest.DebuggerAgent.setAsyncCallStackDepth(maxAsyncCallStackDept
h, step3); | |
| 101 } | |
| 102 | |
| 103 function step3() | |
| 104 { | |
| 105 var actions = [ | |
| 106 "StepOver", "StepOver", "Print", // on setTimeout(callback1) | |
| 107 "StepIntoAsync", "Print", // at callback7 | |
| 108 "Resume", // now paused at debugger in inner() | |
| 109 "StepOver", "StepOver", "StepIntoAsync", "Print", // at callback8 | |
| 110 "Resume", "StepOver", "StepIntoAsync", "Print", // at callback9 | |
| 111 "Resume", "StepOver", "StepIntoAsync", "Print", // at onmessage hand
ler in iframe | |
| 112 "Resume", // now paused at debugger in callback10 | |
| 113 "StepInto", "StepInto", "StepIntoAsync", "Print", // in inner1 | |
| 114 "StepIntoAsync", "Print", // in inner2 | |
| 115 // Test that StepIntoAsync is StepInto when there are no Async opera
tions. | |
| 116 "StepIntoAsync", "StepIntoAsync", "Print", // in callback11 | |
| 117 ]; | |
| 118 InspectorTest.waitUntilPausedAndPerformSteppingActions(actions, step4); | |
| 119 } | |
| 120 | |
| 121 function step4() | |
| 122 { | |
| 123 InspectorTest.completeDebuggerTest(); | |
| 124 } | |
| 125 } | |
| 126 | |
| 127 </script> | |
| 128 </head> | |
| 129 | |
| 130 <body onload="runTest()"> | |
| 131 <p> | |
| 132 Tests debugger StepIntoAsync action (part 2). | |
| 133 </p> | |
| 134 <div><iframe src="resources/post-message-listener.html" | |
| 135 id="iframe" width="800" height="100" style="border: 1px solid black;"> | |
| 136 </iframe></div> | |
| 137 </body> | |
| 138 </html> | |
| OLD | NEW |