Selaa lähdekoodia

LibWeb: Silence some debug spam about JS event handler invocations

Andreas Kling 5 vuotta sitten
vanhempi
commit
81e18a9b26
1 muutettua tiedostoa jossa 6 lisäystä ja 0 poistoa
  1. 6 0
      Libraries/LibWeb/DOM/Node.cpp

+ 6 - 0
Libraries/LibWeb/DOM/Node.cpp

@@ -43,6 +43,8 @@
 #include <LibWeb/Layout/LayoutNode.h>
 #include <LibWeb/Layout/LayoutNode.h>
 #include <LibWeb/Layout/LayoutText.h>
 #include <LibWeb/Layout/LayoutText.h>
 
 
+//#define EVENT_DEBUG
+
 namespace Web {
 namespace Web {
 
 
 Node::Node(Document& document, NodeType type)
 Node::Node(Document& document, NodeType type)
@@ -130,9 +132,13 @@ void Node::dispatch_event(NonnullRefPtr<Event> event)
     for (auto& listener : listeners()) {
     for (auto& listener : listeners()) {
         if (listener.event_name == event->name()) {
         if (listener.event_name == event->name()) {
             auto* function = const_cast<EventListener&>(*listener.listener).function();
             auto* function = const_cast<EventListener&>(*listener.listener).function();
+#ifdef EVENT_DEBUG
             static_cast<const JS::ScriptFunction*>(function)->body().dump(0);
             static_cast<const JS::ScriptFunction*>(function)->body().dump(0);
+#endif
             auto* this_value = wrap(function->heap(), *this);
             auto* this_value = wrap(function->heap(), *this);
+#ifdef EVENT_DEBUG
             dbg() << "calling event listener with this=" << this_value;
             dbg() << "calling event listener with this=" << this_value;
+#endif
             auto* event_wrapper = wrap(function->heap(), *event);
             auto* event_wrapper = wrap(function->heap(), *event);
             document().interpreter().call(function, this_value, { event_wrapper });
             document().interpreter().call(function, this_value, { event_wrapper });
         }
         }