OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../http/tests/inspector/elements-test.js"></script> |
| 5 <script src="../../http/tests/inspector/debugger-test.js"></script> |
| 6 <script> |
| 7 |
| 8 function testFunction() |
| 9 { |
| 10 console.log("Begin"); |
| 11 debugger; // Reload follows, nothing below should break. |
| 12 console.log("Middle: Breakpoint 1"); // Breakpoint |
| 13 console.log("Middle: Breakpoint 2"); // Breakpoint |
| 14 console.assert(false, "Assertion failed!"); |
| 15 console.error("Some console.error message"); |
| 16 debugger; // Should skip this also. |
| 17 var element = document.getElementById("element"); |
| 18 var parent = element.parentElement; |
| 19 var child = document.createElement("span"); |
| 20 element.setAttribute("foo", "bar"); // DOM breakpoint: AttributeModified |
| 21 element.appendChild(child); // DOM breakpoint: SubtreeModified |
| 22 parent.removeChild(element); // DOM breakpoint: NodeRemoved |
| 23 parent.appendChild(element); |
| 24 element.click(); // Event breakpoint |
| 25 console.log("End"); |
| 26 // Should be last. |
| 27 eval("throwException()"); |
| 28 } |
| 29 |
| 30 function throwException() |
| 31 { |
| 32 function inner() |
| 33 { |
| 34 try { |
| 35 if (window.foo === 1) |
| 36 throw new Error("error message"); |
| 37 } finally { |
| 38 ++window.foo; |
| 39 } |
| 40 } |
| 41 try { |
| 42 window.foo = 1; |
| 43 inner(); |
| 44 } finally { |
| 45 ++window.foo; |
| 46 } |
| 47 } |
| 48 |
| 49 function test() |
| 50 { |
| 51 InspectorTest.startDebuggerTest(step1); |
| 52 |
| 53 function step1() |
| 54 { |
| 55 InspectorTest.showScriptSource("skip-pauses-until-reload.html", didShowS
criptSource); |
| 56 } |
| 57 |
| 58 function didShowScriptSource(sourceFrame) |
| 59 { |
| 60 InspectorTest.addResult("Script source was shown."); |
| 61 InspectorTest.addResult("Set up breakpoints."); |
| 62 InspectorTest.setBreakpoint(sourceFrame, 11, "", true); |
| 63 InspectorTest.setBreakpoint(sourceFrame, 12, "", true); |
| 64 InspectorTest.addResult("Set up to pause on all exceptions."); |
| 65 // FIXME: Test is flaky with PauseOnAllExceptions due to races in debugg
er. |
| 66 DebuggerAgent.setPauseOnExceptions(WebInspector.DebuggerModel.PauseOnExc
eptionsState.DontPauseOnExceptions); |
| 67 InspectorTest.nodeWithId("element", didResolveNode); |
| 68 } |
| 69 |
| 70 function didResolveNode(node) |
| 71 { |
| 72 WebInspector.showPanel("elements"); |
| 73 var pane = WebInspector.domBreakpointsSidebarPane; |
| 74 InspectorTest.addResult("Set up DOM breakpoints."); |
| 75 pane._setBreakpoint(node, pane._breakpointTypes.SubtreeModified, true); |
| 76 pane._setBreakpoint(node, pane._breakpointTypes.AttributeModified, true)
; |
| 77 pane._setBreakpoint(node, pane._breakpointTypes.NodeRemoved, true); |
| 78 setUpEventBreakpoints(); |
| 79 } |
| 80 |
| 81 function setUpEventBreakpoints() |
| 82 { |
| 83 WebInspector.showPanel("sources"); |
| 84 var pane = WebInspector.panels.sources.sidebarPanes.eventListenerBreakpo
ints; |
| 85 InspectorTest.addResult("Set up Event breakpoints."); |
| 86 pane._setBreakpoint("listener:click"); |
| 87 InspectorTest.runAfterPendingDispatches(didSetUp); |
| 88 } |
| 89 |
| 90 function didSetUp() |
| 91 { |
| 92 InspectorTest.addResult("Did set up."); |
| 93 InspectorTest.runTestFunctionAndWaitUntilPaused(didPause); |
| 94 } |
| 95 |
| 96 function didPause(callFrames) |
| 97 { |
| 98 InspectorTest.captureStackTrace(callFrames); |
| 99 DebuggerAgent.setSkipAllPauses(true, true, didSetSkipAllPauses); |
| 100 } |
| 101 |
| 102 function didSetSkipAllPauses() |
| 103 { |
| 104 InspectorTest.addResult("Set up to skip all pauses."); |
| 105 doReloadPage(); |
| 106 } |
| 107 |
| 108 function doReloadPage() |
| 109 { |
| 110 InspectorTest.addResult("Reloading the page..."); |
| 111 InspectorTest.waitUntilPausedNextTime(didPauseAfterReload); |
| 112 InspectorTest.reloadPage(didReloadPage); |
| 113 } |
| 114 function didReloadPage() |
| 115 { |
| 116 InspectorTest.addResult("PASS: Reloaded without hitting breakpoints."); |
| 117 InspectorTest.completeDebuggerTest(); |
| 118 } |
| 119 |
| 120 function didPauseAfterReload(callFrames) |
| 121 { |
| 122 InspectorTest.addResult("FAIL: Should not pause while reloading the page
!"); |
| 123 InspectorTest.captureStackTrace(callFrames); |
| 124 InspectorTest.waitUntilPausedNextTime(didPauseAfterReload); |
| 125 InspectorTest.resumeExecution(); |
| 126 } |
| 127 }; |
| 128 |
| 129 </script> |
| 130 |
| 131 </head> |
| 132 |
| 133 <body onload="runTest()"> |
| 134 <p>Tests that 'skip all pauses' mode blocks breakpoint and gets cancelled right
at page reload. |
| 135 </p> |
| 136 |
| 137 <div id="element" onclick="return 0;"></div> |
| 138 </body> |
| 139 </html> |
OLD | NEW |