[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

pfeldman at chromium.org pfeldman at chromium.org
Thu Oct 29 20:35:41 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit e42dfe8dae54c7ecc995c9a96fdcae38a0f5abf3
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Sep 29 09:53:24 2009 +0000

    2009-09-29  Pavel Feldman  <pfeldman at chromium.org>
    
            Reviewed by Timothy Hatcher.
    
            Web Inspector: Encapsulate JS listeners specifics into ScriptEventListener.
    
            https://bugs.webkit.org/show_bug.cgi?id=29816
    
            * bindings/js/ScriptEventListener.cpp:
            (WebCore::getEventListenerHandlerBody):
            * bindings/js/ScriptEventListener.h:
            * bindings/v8/ScriptEventListener.cpp:
            (WebCore::getEventListenerHandlerBody):
            * bindings/v8/ScriptEventListener.h:
            * inspector/InspectorDOMAgent.cpp:
            (WebCore::InspectorDOMAgent::buildObjectForEventListener):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48866 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 342d498..0cdf1a9 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2009-09-29  Pavel Feldman  <pfeldman at chromium.org>
+
+        Reviewed by Timothy Hatcher.
+
+        Web Inspector: Encapsulate JS listeners specifics into ScriptEventListener.
+
+        https://bugs.webkit.org/show_bug.cgi?id=29816
+
+        * bindings/js/ScriptEventListener.cpp:
+        (WebCore::getEventListenerHandlerBody):
+        * bindings/js/ScriptEventListener.h:
+        * bindings/v8/ScriptEventListener.cpp:
+        (WebCore::getEventListenerHandlerBody):
+        * bindings/v8/ScriptEventListener.h:
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::buildObjectForEventListener):
+
 2009-09-29  Xan Lopez  <xlopez at igalia.com>
 
         Unreviewed attempt to fix the build.
diff --git a/WebCore/bindings/js/ScriptEventListener.cpp b/WebCore/bindings/js/ScriptEventListener.cpp
index 878c535..fe9ffde 100644
--- a/WebCore/bindings/js/ScriptEventListener.cpp
+++ b/WebCore/bindings/js/ScriptEventListener.cpp
@@ -33,6 +33,7 @@
 
 #include "Attribute.h"
 #include "Document.h"
+#include "EventListener.h"
 #include "JSNode.h"
 #include "Frame.h"
 #include "XSSAuditor.h"
@@ -99,4 +100,12 @@ PassRefPtr<JSLazyEventListener> createAttributeEventListener(Frame* frame, Attri
     return JSLazyEventListener::create(attr->localName().string(), eventParameterName(frame->document()->isSVGDocument()), attr->value(), globalObject, 0, scriptController->eventHandlerLineNumber());
 }
 
+String getEventListenerHandlerBody(ScriptState* scriptState, EventListener* eventListener)
+{
+    JSC::JSObject* functionObject = eventListener->jsFunction();
+    if (!functionObject)
+        return "";
+    return functionObject->toString(scriptState);
+}
+
 } // namespace WebCore
diff --git a/WebCore/bindings/js/ScriptEventListener.h b/WebCore/bindings/js/ScriptEventListener.h
index 8299d29..ea1a5e5 100644
--- a/WebCore/bindings/js/ScriptEventListener.h
+++ b/WebCore/bindings/js/ScriptEventListener.h
@@ -32,17 +32,20 @@
 #define ScriptEventListener_h
 
 #include "JSLazyEventListener.h"
+#include "ScriptState.h"
 
 #include <wtf/PassRefPtr.h>
 
 namespace WebCore {
 
     class Attribute;
+    class EventListener;
     class Frame;
     class Node;
 
     PassRefPtr<JSLazyEventListener> createAttributeEventListener(Node*, Attribute*);
     PassRefPtr<JSLazyEventListener> createAttributeEventListener(Frame*, Attribute*);
+    String getEventListenerHandlerBody(ScriptState*, EventListener*);
 
 } // namespace WebCore
 
diff --git a/WebCore/bindings/v8/ScriptEventListener.cpp b/WebCore/bindings/v8/ScriptEventListener.cpp
index 7a8aa64..3987fbc 100644
--- a/WebCore/bindings/v8/ScriptEventListener.cpp
+++ b/WebCore/bindings/v8/ScriptEventListener.cpp
@@ -33,7 +33,11 @@
 
 #include "Attribute.h"
 #include "Document.h"
+#include "EventListener.h"
 #include "Frame.h"
+#include "ScriptScope.h"
+#include "V8AbstractEventListener.h"
+#include "V8Binding.h"
 #include "XSSAuditor.h"
 
 namespace WebCore {
@@ -68,4 +72,18 @@ PassRefPtr<V8LazyEventListener> createAttributeEventListener(Frame* frame, Attri
     return V8LazyEventListener::create(frame, attr->value(), attr->localName().string(), frame->document()->isSVGDocument());
 }
 
+String getEventListenerHandlerBody(ScriptState* scriptState, EventListener* listener)
+{
+    if (listener->type() != EventListener::JSEventListenerType)
+        return "";
+
+    ScriptScope scope(scriptState);
+    V8AbstractEventListener* v8Listener = static_cast<V8AbstractEventListener*>(listener);
+    v8::Handle<v8::Object> function = v8Listener->getListenerObject();
+    if (function.IsEmpty())
+        return "";
+
+    return toWebCoreStringWithNullCheck(function);
+}
+
 } // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptEventListener.h b/WebCore/bindings/v8/ScriptEventListener.h
index 0171120..c99ab9e 100644
--- a/WebCore/bindings/v8/ScriptEventListener.h
+++ b/WebCore/bindings/v8/ScriptEventListener.h
@@ -38,11 +38,14 @@
 namespace WebCore {
 
     class Attribute;
+    class EventListener;
     class Frame;
     class Node;
+    class ScriptState;
 
     PassRefPtr<V8LazyEventListener> createAttributeEventListener(Node*, Attribute*);
     PassRefPtr<V8LazyEventListener> createAttributeEventListener(Frame*, Attribute*);
+    String getEventListenerHandlerBody(ScriptState*, EventListener*);
 
 } // namespace WebCore
 
diff --git a/WebCore/inspector/InspectorDOMAgent.cpp b/WebCore/inspector/InspectorDOMAgent.cpp
index db983a1..a064852 100644
--- a/WebCore/inspector/InspectorDOMAgent.cpp
+++ b/WebCore/inspector/InspectorDOMAgent.cpp
@@ -50,17 +50,13 @@
 #include "Node.h"
 #include "NodeList.h"
 #include "PlatformString.h"
+#include "ScriptEventListener.h"
 #include "ScriptObject.h"
 #include "Text.h"
 
 #include <wtf/OwnPtr.h>
 #include <wtf/Vector.h>
 
-#if USE(JSC)
-#include "JSDOMWindow.h"
-#include <runtime/JSObject.h>
-#endif
-
 namespace WebCore {
 
 InspectorDOMAgent::InspectorDOMAgent(InspectorFrontend* frontend)
@@ -549,11 +545,7 @@ ScriptObject InspectorDOMAgent::buildObjectForEventListener(const RegisteredEven
     value.set("useCapture", registeredEventListener.useCapture);
     value.set("isAttribute", eventListener->isAttribute());
     value.set("nodeId", static_cast<long long>(pushNodePathToFrontend(node)));
-#if USE(JSC)
-    JSC::JSObject* functionObject = eventListener->jsFunction();
-    if (functionObject)
-        value.set("listener", ScriptObject(m_frontend->scriptState(), functionObject));
-#endif
+    value.set("listener", getEventListenerHandlerBody(m_frontend->scriptState(), eventListener.get()));
     return value;
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list