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 src=
"../debugger/resources/framework.js"></script>
9 function appendElement(parentId
, childId
)
11 var child
= document
.createElement("div");
13 var parent
= document
.getElementById(parentId
);
14 Framework
.appendChild(parent
, child
);
19 Framework
.sendXHR(url
);
22 function addListenerAndClick(stop
)
24 function testElementClicked()
29 var button
= document
.getElementById("test");
30 var remover
= Framework
.addEventListener(button
, "click", Framework
.bind(Framework
.empty
, null), true); // Should be ignored.
36 remover
= Framework
.addEventListener(button
, "click", Framework
.bind(testElementClicked
, null), true);
40 // Test both handlers together.
41 var remover1
= Framework
.addEventListener(button
, "click", Framework
.bind(Framework
.empty
, null), true); // Should be ignored.
42 var remover2
= Framework
.addEventListener(button
, "click", Framework
.bind(testElementClicked
, null), true);
48 function addFewBlackboxedListenersAndClick(addNonBlackboxedListener
)
50 function testElementClicked()
56 var button
= document
.getElementById("test");
57 var remover1
= Framework
.addEventListener(button
, "click", Framework
.empty
, true);
58 var remover2
= Framework
.addEventListener(button
, "click", Framework
.bind(Framework
.throwFrameworkException
, null, "EXPECTED"), true);
59 var remover3
= Framework
.addEventListener(button
, "click", Framework
.bind(Framework
.safeRun
, null, Framework
.empty
, Framework
.empty
, Framework
.empty
), true);
60 var remover4 = function() {};
61 if (addNonBlackboxedListener
)
62 remover4
= Framework
.addEventListener(button
, "click", Framework
.bind(Framework
.safeRun
, null, Framework
.empty
, testElementClicked
, Framework
.empty
), true);
76 var frameworkRegexString
= "/framework\\.js$";
77 WebInspector
.settingForTest("skipStackFramesPattern").set(frameworkRegexString
);
79 InspectorTest
.setQuiet(true);
81 InspectorTest
.runDebuggerTestSuite([
82 function testDOMBreakpoint(next
)
84 InspectorTest
.nodeWithId("rootElement", step1
);
88 var pane
= WebInspector
.domBreakpointsSidebarPane
;
89 pane
._setBreakpoint(node
, pane
._breakpointTypes
.SubtreeModified
, true);
90 InspectorTest
.evaluateInPageWithTimeout("appendElement('rootElement', 'childElement')");
91 InspectorTest
.waitUntilPausedAndDumpStackAndResume(next
);
95 function testXHRBreakpoint(next
)
97 var pane
= WebInspector
.panels
.sources
.sidebarPanes
.xhrBreakpoints
;
98 pane
._setBreakpoint("foo", true);
99 InspectorTest
.evaluateInPageWithTimeout("sendXHR('/foo?a=b')");
100 InspectorTest
.waitUntilPausedAndDumpStackAndResume(next
);
103 function testEventListenerBreakpoint(next
)
105 var pane
= WebInspector
.panels
.sources
.sidebarPanes
.eventListenerBreakpoints
;
106 pane
._setBreakpoint("listener:click");
107 InspectorTest
.evaluateInPageWithTimeout("addListenerAndClick(false)");
108 InspectorTest
.waitUntilPausedAndPerformSteppingActions([
114 function testSteppingThroughEventListenerBreakpoint(next
)
116 var pane
= WebInspector
.panels
.sources
.sidebarPanes
.eventListenerBreakpoints
;
117 pane
._setBreakpoint("listener:click");
118 InspectorTest
.evaluateInPageWithTimeout("addListenerAndClick(true)");
119 InspectorTest
.waitUntilPausedAndPerformSteppingActions([
121 "StepOver", "Print", // should break at the first "remover()"
122 "StepOver", "StepOver", "StepOver", "Print", // enter testElementClicked()
123 "StepOut", "StepOver", "StepOver", "StepOver", "StepOver", "Print", // enter testElementClicked()
124 "StepOver", "StepOver", "Print",
129 function testSteppingOutOnEventListenerBreakpoint(next
)
131 var pane
= WebInspector
.panels
.sources
.sidebarPanes
.eventListenerBreakpoints
;
132 pane
._setBreakpoint("listener:click");
133 InspectorTest
.evaluateInPageWithTimeout("addListenerAndClick(true)");
134 InspectorTest
.waitUntilPausedAndPerformSteppingActions([
135 "StepOut", "Print", // should be in testElementClicked()
136 "StepOut", "StepOut", "Print", // again in testElementClicked()
142 function testSteppingOutOnEventListenerBreakpointAllBlackboxed(next
)
144 var pane
= WebInspector
.panels
.sources
.sidebarPanes
.eventListenerBreakpoints
;
145 pane
._setBreakpoint("listener:click");
146 InspectorTest
.evaluateInPageWithTimeout("addFewBlackboxedListenersAndClick(false)");
147 InspectorTest
.waitUntilPausedAndPerformSteppingActions([
153 function testSteppingOutOnEventListenerBreakpointAllBlackboxedButOne(next
)
155 var pane
= WebInspector
.panels
.sources
.sidebarPanes
.eventListenerBreakpoints
;
156 pane
._setBreakpoint("listener:click");
157 InspectorTest
.evaluateInPageWithTimeout("addFewBlackboxedListenersAndClick(true)");
158 InspectorTest
.waitUntilPausedAndPerformSteppingActions([
166 function tearDown(next
)
168 WebInspector
.panels
.sources
.sidebarPanes
.xhrBreakpoints
._removeBreakpoint("foo");
169 WebInspector
.panels
.sources
.sidebarPanes
.eventListenerBreakpoints
._removeBreakpoint("listener:click");
178 <body onload=
"runTest()">
180 Tests framework black-boxing on DOM, XHR and Event breakpoints.
182 <div id=
"rootElement"></div>
183 <input type=button
id=
"test"></input>