#include "third_party/blink/renderer/core/inspector/inspector_dom_debugger_agent.h"
#include "third_party/blink/renderer/bindings/core/v8/js_based_event_listener.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_event_target.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_node.h"
#include "third_party/blink/renderer/core/dom/dom_node_ids.h"
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/dom/events/event.h"
#include "third_party/blink/renderer/core/dom/events/event_target.h"
#include "third_party/blink/renderer/core/dom/node.h"
#include "third_party/blink/renderer/core/frame/csp/content_security_policy.h"
#include "third_party/blink/renderer/core/frame/csp/content_security_policy_violation_type.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/inspector/inspector_dom_agent.h"
#include "third_party/blink/renderer/core/inspector/resolve_node.h"
#include "third_party/blink/renderer/core/inspector/v8_inspector_string.h"
#include "third_party/blink/renderer/core/probe/core_probes.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
#include "third_party/inspector_protocol/crdtp/json.h"
SpanFrom;
ConvertCBORToJSON;
namespace {
enum DOMBreakpointType { … };
const uint32_t inheritableDOMBreakpointTypesMask = …;
const int domBreakpointDerivedTypeShift = …;
const char kListenerEventCategoryType[] = …;
}
namespace blink {
Maybe;
namespace {
WTF::String EventListenerBreakpointKey(const WTF::String& event_name,
const WTF::String& target_name) { … }
}
void InspectorDOMDebuggerAgent::CollectEventListeners(
v8::Isolate* isolate,
EventTarget* target,
v8::Local<v8::Value> target_wrapper,
Node* target_node,
bool report_for_all_contexts,
V8EventListenerInfoList* event_information) { … }
void InspectorDOMDebuggerAgent::EventListenersInfoForTarget(
v8::Isolate* isolate,
v8::Local<v8::Value> value,
V8EventListenerInfoList* event_information) { … }
static bool FilterNodesWithListeners(Node* node) { … }
void InspectorDOMDebuggerAgent::EventListenersInfoForTarget(
v8::Isolate* isolate,
v8::Local<v8::Value> value,
int depth,
bool pierce,
InspectorDOMAgent::IncludeWhitespaceEnum include_whitespace,
V8EventListenerInfoList* event_information) { … }
InspectorDOMDebuggerAgent::InspectorDOMDebuggerAgent(
v8::Isolate* isolate,
InspectorDOMAgent* dom_agent,
v8_inspector::V8InspectorSession* v8_session)
: … { … }
InspectorDOMDebuggerAgent::~InspectorDOMDebuggerAgent() = default;
void InspectorDOMDebuggerAgent::Trace(Visitor* visitor) const { … }
protocol::Response InspectorDOMDebuggerAgent::disable() { … }
void InspectorDOMDebuggerAgent::Restore() { … }
protocol::Response InspectorDOMDebuggerAgent::setEventListenerBreakpoint(
const String& event_name,
Maybe<String> target_name) { … }
protocol::Response InspectorDOMDebuggerAgent::SetBreakpoint(
const String& event_name,
const String& target_name) { … }
protocol::Response InspectorDOMDebuggerAgent::removeEventListenerBreakpoint(
const String& event_name,
Maybe<String> target_name) { … }
protocol::Response InspectorDOMDebuggerAgent::RemoveBreakpoint(
const String& event_name,
const String& target_name) { … }
void InspectorDOMDebuggerAgent::DidInvalidateStyleAttr(Node* node) { … }
void InspectorDOMDebuggerAgent::DidInsertDOMNode(Node* node) { … }
void InspectorDOMDebuggerAgent::DidRemoveDOMNode(Node* node) { … }
static protocol::Response DomTypeForName(const String& type_string, int& type) { … }
static String DomTypeName(int type) { … }
bool IsValidViolationType(const String& violationString) { … }
protocol::Response InspectorDOMDebuggerAgent::setBreakOnCSPViolation(
std::unique_ptr<protocol::Array<String>> violationTypes) { … }
protocol::Response InspectorDOMDebuggerAgent::setDOMBreakpoint(
int node_id,
const String& type_string) { … }
protocol::Response InspectorDOMDebuggerAgent::removeDOMBreakpoint(
int node_id,
const String& type_string) { … }
protocol::Response InspectorDOMDebuggerAgent::getEventListeners(
const String& object_id,
Maybe<int> depth,
Maybe<bool> pierce,
std::unique_ptr<protocol::Array<protocol::DOMDebugger::EventListener>>*
listeners_array) { … }
std::unique_ptr<protocol::Array<protocol::DOMDebugger::EventListener>>
InspectorDOMDebuggerAgent::BuildObjectsForEventListeners(
const V8EventListenerInfoList& event_information,
v8::Local<v8::Context> context,
const v8_inspector::StringView& object_group_id) { … }
std::unique_ptr<protocol::DOMDebugger::EventListener>
InspectorDOMDebuggerAgent::BuildObjectForEventListener(
v8::Local<v8::Context> context,
const V8EventListenerInfo& info,
const v8_inspector::StringView& object_group_id) { … }
void InspectorDOMDebuggerAgent::WillInsertDOMNode(Node* parent) { … }
void InspectorDOMDebuggerAgent::CharacterDataModified(CharacterData* node) { … }
void InspectorDOMDebuggerAgent::WillRemoveDOMNode(Node* node) { … }
void InspectorDOMDebuggerAgent::WillModifyDOMAttr(Element* element,
const AtomicString&,
const AtomicString&) { … }
void InspectorDOMDebuggerAgent::BreakProgramOnDOMEvent(Node* target,
int breakpoint_type,
bool insertion) { … }
bool InspectorDOMDebuggerAgent::HasBreakpoint(Node* node, int type) const { … }
uint32_t InspectorDOMDebuggerAgent::FindBreakpointMask(Node* node) const { … }
void InspectorDOMDebuggerAgent::UpdateSubtreeBreakpoints(Node* node,
uint32_t root_mask,
bool set) { … }
void InspectorDOMDebuggerAgent::PauseOnNativeEventIfNeeded(
std::unique_ptr<protocol::DictionaryValue> event_data,
bool synchronous) { … }
std::unique_ptr<protocol::DictionaryValue>
InspectorDOMDebuggerAgent::PreparePauseOnNativeEventData(
const String& event_name,
const String& target_name) { … }
void InspectorDOMDebuggerAgent::CancelNativeBreakpoint() { … }
void InspectorDOMDebuggerAgent::Will(const probe::UserCallback& probe) { … }
void InspectorDOMDebuggerAgent::Did(const probe::UserCallback& probe) { … }
protocol::Response InspectorDOMDebuggerAgent::setXHRBreakpoint(
const String& url) { … }
protocol::Response InspectorDOMDebuggerAgent::removeXHRBreakpoint(
const String& url) { … }
String InspectorDOMDebuggerAgent::MatchXHRBreakpoints(const String& url) const { … }
void InspectorDOMDebuggerAgent::WillSendXMLHttpOrFetchNetworkRequest(
const String& url) { … }
void InspectorDOMDebuggerAgent::DidAddBreakpoint() { … }
void InspectorDOMDebuggerAgent::DidRemoveBreakpoint() { … }
void InspectorDOMDebuggerAgent::SetEnabled(bool enabled) { … }
void InspectorDOMDebuggerAgent::DidAddDocument(Document* document) { … }
void InspectorDOMDebuggerAgent::DidModifyDOMAttr(Element* element) { … }
void InspectorDOMDebuggerAgent::DidCommitLoadForLocalFrame(LocalFrame*) { … }
String ViolationTypeToString(const ContentSecurityPolicyViolationType type) { … }
void InspectorDOMDebuggerAgent::OnContentSecurityPolicyViolation(
const ContentSecurityPolicyViolationType violationType) { … }
}