2 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #ifndef InspectorDOMDebuggerAgent_h
32 #define InspectorDOMDebuggerAgent_h
34 #if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
36 #include "InspectorDebuggerAgent.h"
37 #include "InspectorWebAgentBase.h"
38 #include "InspectorWebBackendDispatchers.h"
39 #include <wtf/HashMap.h>
40 #include <wtf/PassOwnPtr.h>
41 #include <wtf/RefCounted.h>
42 #include <wtf/text/WTFString.h>
45 class InspectorObject;
51 class InspectorDOMAgent;
52 class InspectorDebuggerAgent;
53 class InstrumentingAgents;
56 typedef String ErrorString;
58 class InspectorDOMDebuggerAgent : public InspectorAgentBase, public InspectorDebuggerAgent::Listener, public Inspector::InspectorDOMDebuggerBackendDispatcherHandler {
59 WTF_MAKE_NONCOPYABLE(InspectorDOMDebuggerAgent);
61 InspectorDOMDebuggerAgent(InstrumentingAgents*, InspectorDOMAgent*, InspectorDebuggerAgent*);
62 virtual ~InspectorDOMDebuggerAgent();
65 virtual void setXHRBreakpoint(ErrorString*, const String& url) override;
66 virtual void removeXHRBreakpoint(ErrorString*, const String& url) override;
67 virtual void setEventListenerBreakpoint(ErrorString*, const String& eventName) override;
68 virtual void removeEventListenerBreakpoint(ErrorString*, const String& eventName) override;
69 virtual void setInstrumentationBreakpoint(ErrorString*, const String& eventName) override;
70 virtual void removeInstrumentationBreakpoint(ErrorString*, const String& eventName) override;
71 virtual void setDOMBreakpoint(ErrorString*, int nodeId, const String& type) override;
72 virtual void removeDOMBreakpoint(ErrorString*, int nodeId, const String& type) override;
74 // InspectorInstrumentation API
75 void willInsertDOMNode(Node* parent);
76 void didInvalidateStyleAttr(Node*);
77 void didInsertDOMNode(Node*);
78 void willRemoveDOMNode(Node*);
79 void didRemoveDOMNode(Node*);
80 void willModifyDOMAttr(Element*);
81 void willSendXMLHttpRequest(const String& url);
82 void pauseOnNativeEventIfNeeded(bool isDOMEvent, const String& eventName, bool synchronous);
84 virtual void didCreateFrontendAndBackend(Inspector::InspectorFrontendChannel*, Inspector::InspectorBackendDispatcher*) override;
85 virtual void willDestroyFrontendAndBackend(Inspector::InspectorDisconnectReason) override;
86 virtual void discardAgent() override;
89 // InspectorDebuggerAgent::Listener implementation.
90 virtual void debuggerWasEnabled() override;
91 virtual void debuggerWasDisabled() override;
92 virtual void stepInto() override;
93 virtual void didPause() override;
96 void descriptionForDOMEvent(Node* target, int breakpointType, bool insertion, Inspector::InspectorObject* description);
97 void updateSubtreeBreakpoints(Node*, uint32_t rootMask, bool set);
98 bool hasBreakpoint(Node*, int type);
99 void discardBindings();
100 void setBreakpoint(ErrorString*, const String& eventName);
101 void removeBreakpoint(ErrorString*, const String& eventName);
105 InspectorDOMAgent* m_domAgent;
106 InspectorDebuggerAgent* m_debuggerAgent;
107 RefPtr<Inspector::InspectorDOMDebuggerBackendDispatcher> m_backendDispatcher;
108 HashMap<Node*, uint32_t> m_domBreakpoints;
109 HashSet<String> m_eventListenerBreakpoints;
110 HashSet<String> m_xhrBreakpoints;
111 bool m_pauseInNextEventListener;
112 bool m_pauseOnAllXHRsEnabled;
115 } // namespace WebCore
117 #endif // ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
119 #endif // !defined(InspectorDOMDebuggerAgent_h)