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>
8 function testFunction()
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
27 eval("throwException()");
30 function throwException()
36 throw new Error("error message");
51 InspectorTest
.startDebuggerTest(step1
);
55 InspectorTest
.showScriptSource("skip-pauses-until-reload.html", didShowScriptSource
);
58 function didShowScriptSource(sourceFrame
)
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 debugger.
66 InspectorTest
.DebuggerAgent
.setPauseOnExceptions(WebInspector
.DebuggerModel
.PauseOnExceptionsState
.DontPauseOnExceptions
);
67 InspectorTest
.nodeWithId("element", didResolveNode
);
68 testRunner
.logToStderr("didShowScriptSource");
71 function didResolveNode(node
)
73 testRunner
.logToStderr("didResolveNode");
74 var pane
= WebInspector
.domBreakpointsSidebarPane
;
75 InspectorTest
.addResult("Set up DOM breakpoints.");
76 pane
._setBreakpoint(node
, pane
._breakpointTypes
.SubtreeModified
, true);
77 pane
._setBreakpoint(node
, pane
._breakpointTypes
.AttributeModified
, true);
78 pane
._setBreakpoint(node
, pane
._breakpointTypes
.NodeRemoved
, true);
79 setUpEventBreakpoints();
82 function setUpEventBreakpoints()
84 testRunner
.logToStderr("setUpEventBreakpoints");
85 var pane
= WebInspector
.panels
.sources
.sidebarPanes
.eventListenerBreakpoints
;
86 InspectorTest
.addResult("Set up Event breakpoints.");
87 pane
._setBreakpoint("listener:click");
88 InspectorTest
.runAfterPendingDispatches(didSetUp
);
93 testRunner
.logToStderr("didSetUp");
94 InspectorTest
.addResult("Did set up.");
95 InspectorTest
.runTestFunctionAndWaitUntilPaused(didPause
);
98 function didPause(callFrames
)
100 testRunner
.logToStderr("didPause");
101 InspectorTest
.captureStackTrace(callFrames
);
102 InspectorTest
.DebuggerAgent
.setSkipAllPauses(true, didSetSkipAllPauses
);
105 function didSetSkipAllPauses()
107 testRunner
.logToStderr("didSetSkipAllPauses");
108 InspectorTest
.addResult("Set up to skip all pauses.");
112 function doReloadPage()
114 testRunner
.logToStderr("doReloadPage");
115 InspectorTest
.addResult("Reloading the page...");
116 InspectorTest
.waitUntilPausedNextTime(didPauseAfterReload
);
117 InspectorTest
.reloadPage(didReloadPage
);
120 function didReloadPage()
122 testRunner
.logToStderr("didReloadPage");
123 InspectorTest
.addResult("PASS: Reloaded without hitting breakpoints.");
127 function didPauseAfterReload(callFrames
)
129 testRunner
.logToStderr("didPauseAfterReload");
130 InspectorTest
.addResult("FAIL: Should not pause while reloading the page!");
131 InspectorTest
.captureStackTrace(callFrames
);
132 InspectorTest
.waitUntilPausedNextTime(didPauseAfterReload
);
133 InspectorTest
.resumeExecution();
136 function completeTest()
138 testRunner
.logToStderr("completeTest");
139 var pane
= WebInspector
.panels
.sources
.sidebarPanes
.eventListenerBreakpoints
;
140 pane
._removeBreakpoint("listener:click");
141 InspectorTest
.completeDebuggerTest();
149 <body onload=
"runTest()">
150 <p>Tests that 'skip all pauses' mode blocks breakpoint and gets cancelled right at page reload.
153 <div id=
"element" onclick=
"return 0;"></div>