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