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

eric at webkit.org eric at webkit.org
Thu Oct 29 20:38:29 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit ee1c80ab7336e23c12ccdcbb1a07e1e546546664
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Oct 2 22:40:59 2009 +0000

    2009-10-02  Vitaly Repeshko  <vitalyr at chromium.org>
    
            Reviewed by Dimitri Glazkov.
    
            [V8] Disconnect event listeners on navigation.
            Fixes http://crbug.com/23597.
            https://bugs.webkit.org/show_bug.cgi?id=30027
    
            Added V8ListenerGuard that is shared by listeners and proxy. On
            navigation proxy sets a flag in the guard turning off listeners.
    
            * bindings/v8/V8AbstractEventListener.cpp:
            (WebCore::V8AbstractEventListener::V8AbstractEventListener):
            * bindings/v8/V8AbstractEventListener.h:
            (WebCore::V8ListenerGuard::create):
            (WebCore::V8ListenerGuard::isDisconnected):
            (WebCore::V8ListenerGuard::disconnectListeners):
            (WebCore::V8ListenerGuard::V8ListenerGuard):
            (WebCore::V8AbstractEventListener::disconnected):
            * bindings/v8/V8DOMWrapper.cpp:
            (WebCore::V8DOMWrapper::getEventListener):
            * bindings/v8/V8EventListenerList.h:
            (WebCore::V8EventListenerList::findOrCreateWrapper):
            * bindings/v8/V8LazyEventListener.cpp:
            (WebCore::V8LazyEventListener::V8LazyEventListener):
            * bindings/v8/V8Proxy.cpp:
            (WebCore::V8Proxy::V8Proxy):
            (WebCore::V8Proxy::disconnectFrame):
            (WebCore::V8Proxy::disconnectEventListeners):
            (WebCore::V8Proxy::clearForNavigation):
            * bindings/v8/V8Proxy.h:
            (WebCore::V8Proxy::listenerGuard):
            * bindings/v8/V8WorkerContextEventListener.cpp:
            (WebCore::V8WorkerContextEventListener::V8WorkerContextEventListener):
            * bindings/v8/V8WorkerContextEventListener.h:
            (WebCore::V8WorkerContextEventListener::create):
            * bindings/v8/WorkerContextExecutionProxy.cpp:
            (WebCore::WorkerContextExecutionProxy::WorkerContextExecutionProxy):
            (WebCore::WorkerContextExecutionProxy::dispose):
            (WebCore::WorkerContextExecutionProxy::findOrCreateEventListener):
            * bindings/v8/WorkerContextExecutionProxy.h:
            * bindings/v8/custom/V8CustomEventListener.cpp:
            (WebCore::V8EventListener::V8EventListener):
            * bindings/v8/custom/V8CustomEventListener.h:
            (WebCore::V8EventListener::create):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49050 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 2b7851d..6e34903 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,49 @@
+2009-10-02  Vitaly Repeshko  <vitalyr at chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        [V8] Disconnect event listeners on navigation.
+        Fixes http://crbug.com/23597.
+        https://bugs.webkit.org/show_bug.cgi?id=30027
+
+        Added V8ListenerGuard that is shared by listeners and proxy. On
+        navigation proxy sets a flag in the guard turning off listeners.
+
+        * bindings/v8/V8AbstractEventListener.cpp:
+        (WebCore::V8AbstractEventListener::V8AbstractEventListener):
+        * bindings/v8/V8AbstractEventListener.h:
+        (WebCore::V8ListenerGuard::create):
+        (WebCore::V8ListenerGuard::isDisconnected):
+        (WebCore::V8ListenerGuard::disconnectListeners):
+        (WebCore::V8ListenerGuard::V8ListenerGuard):
+        (WebCore::V8AbstractEventListener::disconnected):
+        * bindings/v8/V8DOMWrapper.cpp:
+        (WebCore::V8DOMWrapper::getEventListener):
+        * bindings/v8/V8EventListenerList.h:
+        (WebCore::V8EventListenerList::findOrCreateWrapper):
+        * bindings/v8/V8LazyEventListener.cpp:
+        (WebCore::V8LazyEventListener::V8LazyEventListener):
+        * bindings/v8/V8Proxy.cpp:
+        (WebCore::V8Proxy::V8Proxy):
+        (WebCore::V8Proxy::disconnectFrame):
+        (WebCore::V8Proxy::disconnectEventListeners):
+        (WebCore::V8Proxy::clearForNavigation):
+        * bindings/v8/V8Proxy.h:
+        (WebCore::V8Proxy::listenerGuard):
+        * bindings/v8/V8WorkerContextEventListener.cpp:
+        (WebCore::V8WorkerContextEventListener::V8WorkerContextEventListener):
+        * bindings/v8/V8WorkerContextEventListener.h:
+        (WebCore::V8WorkerContextEventListener::create):
+        * bindings/v8/WorkerContextExecutionProxy.cpp:
+        (WebCore::WorkerContextExecutionProxy::WorkerContextExecutionProxy):
+        (WebCore::WorkerContextExecutionProxy::dispose):
+        (WebCore::WorkerContextExecutionProxy::findOrCreateEventListener):
+        * bindings/v8/WorkerContextExecutionProxy.h:
+        * bindings/v8/custom/V8CustomEventListener.cpp:
+        (WebCore::V8EventListener::V8EventListener):
+        * bindings/v8/custom/V8CustomEventListener.h:
+        (WebCore::V8EventListener::create):
+
 2009-10-02  Kenneth Russell  <kbr at google.com>
 
         Reviewed by Dimitri Glazkov.
diff --git a/WebCore/bindings/v8/V8AbstractEventListener.cpp b/WebCore/bindings/v8/V8AbstractEventListener.cpp
index 3385791..12a2cd9 100644
--- a/WebCore/bindings/v8/V8AbstractEventListener.cpp
+++ b/WebCore/bindings/v8/V8AbstractEventListener.cpp
@@ -38,6 +38,7 @@
 #include "Tokenizer.h"
 #include "V8Binding.h"
 #include "V8EventListenerList.h"
+#include "V8Proxy.h"
 #include "V8Utilities.h"
 
 namespace WebCore {
@@ -48,11 +49,12 @@ static void weakEventListenerCallback(v8::Persistent<v8::Value>, void* parameter
     listener->disposeListenerObject();
 }
 
-V8AbstractEventListener::V8AbstractEventListener(Frame* frame, bool isAttribute)
+V8AbstractEventListener::V8AbstractEventListener(Frame* frame, PassRefPtr<V8ListenerGuard> guard, bool isAttribute)
     : EventListener(JSEventListenerType)
     , m_isWeak(true)
     , m_isAttribute(isAttribute)
     , m_frame(frame)
+    , m_guard(guard)
     , m_lineNumber(0)
     , m_columnNumber(0)
 {
diff --git a/WebCore/bindings/v8/V8AbstractEventListener.h b/WebCore/bindings/v8/V8AbstractEventListener.h
index f6e58e2..c7736be 100644
--- a/WebCore/bindings/v8/V8AbstractEventListener.h
+++ b/WebCore/bindings/v8/V8AbstractEventListener.h
@@ -33,13 +33,39 @@
 
 #include "EventListener.h"
 #include "OwnHandle.h"
-#include "V8Proxy.h"
+#include "SharedPersistent.h"
 #include <v8.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
 
 namespace WebCore {
 
     class Event;
     class Frame;
+    class V8Proxy;
+
+    // Shared by listener objects and V8Proxy so that V8Proxy can
+    // silence listeners when needed.
+    class V8ListenerGuard : public RefCounted<V8ListenerGuard> {
+      public:
+        static PassRefPtr<V8ListenerGuard> create()
+        {
+            return adoptRef(new V8ListenerGuard);
+        }
+
+        bool isDisconnected() const { return m_disconnected; }
+
+        void disconnectListeners()
+        {
+            m_disconnected = true;
+        }
+
+      private:
+        V8ListenerGuard()
+            : m_disconnected(false) { }
+
+        bool m_disconnected;
+    };
 
     // There are two kinds of event listeners: HTML or non-HMTL. onload,
     // onfocus, etc (attributes) are always HTML event handler type; Event
@@ -99,10 +125,10 @@ namespace WebCore {
         // Detach the listener from its owner frame.
         void disconnectFrame() { m_frame = 0; }
 
-        virtual bool disconnected() const { return !m_frame; }
+        virtual bool disconnected() const { return m_guard && m_guard->isDisconnected(); }
 
     protected:
-        V8AbstractEventListener(Frame*, bool isAttribute);
+        V8AbstractEventListener(Frame*, PassRefPtr<V8ListenerGuard>, bool isAttribute);
 
         virtual void prepareListenerObject() { }
 
@@ -134,6 +160,7 @@ namespace WebCore {
         // FIXME: this could hold m_frame live until the event listener is deleted.
         Frame* m_frame;
         RefPtr<SharedPersistent<v8::Context> > m_context;
+        RefPtr<V8ListenerGuard> m_guard;
 
         // Position in the HTML source for HTML event listeners.
         int m_lineNumber;
diff --git a/WebCore/bindings/v8/V8DOMWrapper.cpp b/WebCore/bindings/v8/V8DOMWrapper.cpp
index ac36444..139e6ec 100644
--- a/WebCore/bindings/v8/V8DOMWrapper.cpp
+++ b/WebCore/bindings/v8/V8DOMWrapper.cpp
@@ -1398,7 +1398,7 @@ PassRefPtr<EventListener> V8DOMWrapper::getEventListener(Node* node, v8::Local<v
         proxy = V8Proxy::retrieve(V8Proxy::retrieveFrameForEnteredContext());
 
     if (proxy)
-        return (lookup == ListenerFindOnly) ? V8EventListenerList::findWrapper(value, isAttribute) : V8EventListenerList::findOrCreateWrapper<V8EventListener>(proxy->frame(), value, isAttribute);
+        return (lookup == ListenerFindOnly) ? V8EventListenerList::findWrapper(value, isAttribute) : V8EventListenerList::findOrCreateWrapper<V8EventListener>(proxy->frame(), proxy->listenerGuard(), value, isAttribute);
 
     return 0;
 }
@@ -1418,7 +1418,7 @@ PassRefPtr<EventListener> V8DOMWrapper::getEventListener(AbstractWorker* worker,
 
     V8Proxy* proxy = V8Proxy::retrieve(worker->scriptExecutionContext());
     if (proxy)
-        return (lookup == ListenerFindOnly) ? V8EventListenerList::findWrapper(value, isAttribute) : V8EventListenerList::findOrCreateWrapper<V8EventListener>(proxy->frame(), value, isAttribute);
+        return (lookup == ListenerFindOnly) ? V8EventListenerList::findWrapper(value, isAttribute) : V8EventListenerList::findOrCreateWrapper<V8EventListener>(proxy->frame(), proxy->listenerGuard(), value, isAttribute);
 
     return 0;
 }
@@ -1434,7 +1434,7 @@ PassRefPtr<EventListener> V8DOMWrapper::getEventListener(Notification* notificat
 
     V8Proxy* proxy = V8Proxy::retrieve(notification->scriptExecutionContext());
     if (proxy)
-        return (lookup == ListenerFindOnly) ? V8EventListenerList::findWrapper(value, isAttribute) : V8EventListenerList::findOrCreateWrapper<V8EventListener>(proxy->frame(), value, isAttribute);
+        return (lookup == ListenerFindOnly) ? V8EventListenerList::findWrapper(value, isAttribute) : V8EventListenerList::findOrCreateWrapper<V8EventListener>(proxy->frame(), proxy->listenerGuard(), value, isAttribute);
 
     return 0;
 }
@@ -1458,7 +1458,7 @@ PassRefPtr<EventListener> V8DOMWrapper::getEventListener(EventTarget* eventTarge
 {
     V8Proxy* proxy = V8Proxy::retrieve(eventTarget->scriptExecutionContext());
     if (proxy)
-        return (lookup == ListenerFindOnly) ? V8EventListenerList::findWrapper(value, isAttribute) : V8EventListenerList::findOrCreateWrapper<V8EventListener>(proxy->frame(), value, isAttribute);
+        return (lookup == ListenerFindOnly) ? V8EventListenerList::findWrapper(value, isAttribute) : V8EventListenerList::findOrCreateWrapper<V8EventListener>(proxy->frame(), proxy->listenerGuard(), value, isAttribute);
 
 #if ENABLE(WORKERS)
     WorkerContextExecutionProxy* workerContextProxy = WorkerContextExecutionProxy::retrieve();
@@ -1472,7 +1472,7 @@ PassRefPtr<EventListener> V8DOMWrapper::getEventListener(EventTarget* eventTarge
 PassRefPtr<EventListener> V8DOMWrapper::getEventListener(V8Proxy* proxy, v8::Local<v8::Value> value, bool isAttribute, ListenerLookupType lookup)
 {
     if (proxy)
-        return (lookup == ListenerFindOnly) ? V8EventListenerList::findWrapper(value, isAttribute) : V8EventListenerList::findOrCreateWrapper<V8EventListener>(proxy->frame(), value, isAttribute);
+        return (lookup == ListenerFindOnly) ? V8EventListenerList::findWrapper(value, isAttribute) : V8EventListenerList::findOrCreateWrapper<V8EventListener>(proxy->frame(), proxy->listenerGuard(), value, isAttribute);
 
     return 0;
 }
diff --git a/WebCore/bindings/v8/V8EventListenerList.h b/WebCore/bindings/v8/V8EventListenerList.h
index a863ed9..506e5dc 100644
--- a/WebCore/bindings/v8/V8EventListenerList.h
+++ b/WebCore/bindings/v8/V8EventListenerList.h
@@ -55,7 +55,7 @@ namespace WebCore {
         }
 
         template<typename WrapperType, typename ContextType>
-        static PassRefPtr<V8EventListener> findOrCreateWrapper(ContextType*, v8::Local<v8::Value>, bool isAttribute);
+        static PassRefPtr<V8EventListener> findOrCreateWrapper(ContextType*, PassRefPtr<V8ListenerGuard>, v8::Local<v8::Value>, bool isAttribute);
 
         static void clearWrapper(v8::Handle<v8::Object> listenerObject, bool isAttribute)
         {
@@ -81,7 +81,7 @@ namespace WebCore {
     };
 
     template<typename WrapperType, typename ContextType>
-    PassRefPtr<V8EventListener> V8EventListenerList::findOrCreateWrapper(ContextType* context, v8::Local<v8::Value> value, bool isAttribute)
+    PassRefPtr<V8EventListener> V8EventListenerList::findOrCreateWrapper(ContextType* context, PassRefPtr<V8ListenerGuard> guard, v8::Local<v8::Value> value, bool isAttribute)
     {
         ASSERT(v8::Context::InContext());
         if (!value->IsObject())
@@ -94,7 +94,7 @@ namespace WebCore {
         if (wrapper)
             return wrapper;
 
-        PassRefPtr<V8EventListener> wrapperPtr = WrapperType::create(context, object, isAttribute);
+        PassRefPtr<V8EventListener> wrapperPtr = WrapperType::create(context, guard, object, isAttribute);
         if (wrapperPtr)
             object->SetHiddenValue(wrapperProperty, v8::External::Wrap(wrapperPtr.get()));
 
diff --git a/WebCore/bindings/v8/V8LazyEventListener.cpp b/WebCore/bindings/v8/V8LazyEventListener.cpp
index 46f5649..120957a 100644
--- a/WebCore/bindings/v8/V8LazyEventListener.cpp
+++ b/WebCore/bindings/v8/V8LazyEventListener.cpp
@@ -38,7 +38,7 @@
 namespace WebCore {
 
 V8LazyEventListener::V8LazyEventListener(Frame* frame, const String& code, const String& functionName, bool isSVGEvent)
-    : V8AbstractEventListener(frame, true)
+    : V8AbstractEventListener(frame, 0, true)
     , m_code(code)
     , m_functionName(functionName)
     , m_isSVGEvent(isSVGEvent)
diff --git a/WebCore/bindings/v8/V8Proxy.cpp b/WebCore/bindings/v8/V8Proxy.cpp
index c16e5d3..1c4b1cc 100644
--- a/WebCore/bindings/v8/V8Proxy.cpp
+++ b/WebCore/bindings/v8/V8Proxy.cpp
@@ -211,6 +211,14 @@ static void reportFatalErrorInV8(const char* location, const char* message)
     handleFatalErrorInV8();
 }
 
+V8Proxy::V8Proxy(Frame* frame)
+    : m_frame(frame),
+      m_context(SharedPersistent<v8::Context>::create()),
+      m_listenerGuard(V8ListenerGuard::create()),
+      m_inlineCode(false),
+      m_timerCallback(false),
+      m_recursion(0) { }
+
 V8Proxy::~V8Proxy()
 {
     clearForClose();
@@ -561,6 +569,7 @@ V8Proxy* V8Proxy::retrieve(ScriptExecutionContext* context)
 
 void V8Proxy::disconnectFrame()
 {
+    disconnectEventListeners();
 }
 
 bool V8Proxy::isEnabled()
@@ -694,6 +703,12 @@ void V8Proxy::releaseStorageMutex()
         page->group().localStorage()->unlock();
 }
 
+void V8Proxy::disconnectEventListeners()
+{
+    m_listenerGuard->disconnectListeners();
+    m_listenerGuard = V8ListenerGuard::create();
+}
+
 void V8Proxy::clearForClose()
 {
     if (!context().IsEmpty()) {
@@ -706,6 +721,7 @@ void V8Proxy::clearForClose()
 
 void V8Proxy::clearForNavigation()
 {
+    disconnectEventListeners();
     if (!context().IsEmpty()) {
         v8::HandleScope handle;
         clearDocumentWrapper();
diff --git a/WebCore/bindings/v8/V8Proxy.h b/WebCore/bindings/v8/V8Proxy.h
index f14a903..04c113e 100644
--- a/WebCore/bindings/v8/V8Proxy.h
+++ b/WebCore/bindings/v8/V8Proxy.h
@@ -35,6 +35,7 @@
 #include "ScriptSourceCode.h" // for WebCore::ScriptSourceCode
 #include "SecurityOrigin.h" // for WebCore::SecurityOrigin
 #include "SharedPersistent.h"
+#include "V8AbstractEventListener.h"
 #include "V8DOMWrapper.h"
 #include "V8GCController.h"
 #include "V8Index.h"
@@ -57,7 +58,6 @@ namespace WebCore {
     class ScriptExecutionContext;
     class String;
     class V8EventListener;
-    class V8ObjectEventListener;
 
     // FIXME: use standard logging facilities in WebCore.
     void logInfo(Frame*, const String& message, const String& url);
@@ -116,12 +116,7 @@ namespace WebCore {
             GeneralError
         };
 
-        explicit V8Proxy(Frame* frame)
-            : m_frame(frame),
-              m_context(SharedPersistent<v8::Context>::create()),
-              m_inlineCode(false),
-              m_timerCallback(false),
-              m_recursion(0) { }
+        explicit V8Proxy(Frame*);
 
         ~V8Proxy();
 
@@ -302,6 +297,11 @@ namespace WebCore {
             return m_context;
         }
 
+        PassRefPtr<V8ListenerGuard> listenerGuard()
+        {
+            return m_listenerGuard;
+        }
+
         bool setContextDebugId(int id);
         static int contextDebugId(v8::Handle<v8::Context>);
 
@@ -347,6 +347,8 @@ namespace WebCore {
         // the storage mutex.
         void releaseStorageMutex();
 
+        void disconnectEventListeners();
+
         static bool canAccessPrivate(DOMWindow*);
 
         static const char* rangeExceptionName(int exceptionCode);
@@ -381,6 +383,8 @@ namespace WebCore {
 
         RefPtr<SharedPersistent<v8::Context> > m_context;
 
+        RefPtr<V8ListenerGuard> m_listenerGuard;
+
         // For each possible type of wrapper, we keep a boilerplate object.
         // The boilerplate is used to create additional wrappers of the same
         // type.  We keep a single persistent handle to an array of the
diff --git a/WebCore/bindings/v8/V8WorkerContextEventListener.cpp b/WebCore/bindings/v8/V8WorkerContextEventListener.cpp
index 6fa7869..70df885 100644
--- a/WebCore/bindings/v8/V8WorkerContextEventListener.cpp
+++ b/WebCore/bindings/v8/V8WorkerContextEventListener.cpp
@@ -40,8 +40,8 @@
 
 namespace WebCore {
 
-V8WorkerContextEventListener::V8WorkerContextEventListener(WorkerContextExecutionProxy* proxy, v8::Local<v8::Object> listener, bool isInline)
-    : V8EventListener(0, listener, isInline)
+V8WorkerContextEventListener::V8WorkerContextEventListener(WorkerContextExecutionProxy* proxy, PassRefPtr<V8ListenerGuard> guard, v8::Local<v8::Object> listener, bool isInline)
+    : V8EventListener(0, guard, listener, isInline)
     , m_proxy(proxy)
 {
 }
diff --git a/WebCore/bindings/v8/V8WorkerContextEventListener.h b/WebCore/bindings/v8/V8WorkerContextEventListener.h
index d448601..3752533 100644
--- a/WebCore/bindings/v8/V8WorkerContextEventListener.h
+++ b/WebCore/bindings/v8/V8WorkerContextEventListener.h
@@ -44,20 +44,19 @@ namespace WebCore {
 
     class V8WorkerContextEventListener : public V8EventListener {
     public:
-        static PassRefPtr<V8WorkerContextEventListener> create(WorkerContextExecutionProxy* proxy, v8::Local<v8::Object> listener, bool isInline)
+        static PassRefPtr<V8WorkerContextEventListener> create(WorkerContextExecutionProxy* proxy, PassRefPtr<V8ListenerGuard> guard, v8::Local<v8::Object> listener, bool isInline)
         {
-            return adoptRef(new V8WorkerContextEventListener(proxy, listener, isInline));
+            return adoptRef(new V8WorkerContextEventListener(proxy, guard, listener, isInline));
         }
-        V8WorkerContextEventListener(WorkerContextExecutionProxy*, v8::Local<v8::Object> listener, bool isInline);
 
         virtual void handleEvent(ScriptExecutionContext*, Event*);
         virtual bool reportError(const String& message, const String& url, int lineNumber);
-        virtual bool disconnected() const { return !m_proxy; }
 
         WorkerContextExecutionProxy* proxy() const { return m_proxy; }
-        void disconnect() { m_proxy = 0; }
 
     private:
+        V8WorkerContextEventListener(WorkerContextExecutionProxy*, PassRefPtr<V8ListenerGuard>, v8::Local<v8::Object> listener, bool isInline);
+
         virtual v8::Local<v8::Value> callListenerFunction(v8::Handle<v8::Value> jsEvent, Event*);
         v8::Local<v8::Object> getReceiverObject(Event*);
         WorkerContextExecutionProxy* m_proxy;
diff --git a/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp b/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp
index 68d938e..37c65cd 100644
--- a/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp
+++ b/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp
@@ -70,6 +70,7 @@ static void reportFatalErrorInV8(const char* location, const char* message)
 WorkerContextExecutionProxy::WorkerContextExecutionProxy(WorkerContext* workerContext)
     : m_workerContext(workerContext)
     , m_recursion(0)
+    , m_listenerGuard(V8ListenerGuard::create())
 {
     initV8IfNeeded();
 }
@@ -81,6 +82,8 @@ WorkerContextExecutionProxy::~WorkerContextExecutionProxy()
 
 void WorkerContextExecutionProxy::dispose()
 {
+    m_listenerGuard->disconnectListeners();
+
     // Detach all events from their JS wrappers.
     for (size_t eventIndex = 0; eventIndex < m_events.size(); ++eventIndex) {
         Event* event = m_events[eventIndex];
@@ -396,7 +399,7 @@ v8::Local<v8::Value> WorkerContextExecutionProxy::runScript(v8::Handle<v8::Scrip
 
 PassRefPtr<V8EventListener> WorkerContextExecutionProxy::findOrCreateEventListener(v8::Local<v8::Value> object, bool isInline, bool findOnly)
 {
-    return findOnly ? V8EventListenerList::findWrapper(object, isInline) : V8EventListenerList::findOrCreateWrapper<V8WorkerContextEventListener>(this, object, isInline);
+    return findOnly ? V8EventListenerList::findWrapper(object, isInline) : V8EventListenerList::findOrCreateWrapper<V8WorkerContextEventListener>(this, m_listenerGuard, object, isInline);
 }
 
 void WorkerContextExecutionProxy::trackEvent(Event* event)
diff --git a/WebCore/bindings/v8/WorkerContextExecutionProxy.h b/WebCore/bindings/v8/WorkerContextExecutionProxy.h
index 11f15d6..a08395c 100644
--- a/WebCore/bindings/v8/WorkerContextExecutionProxy.h
+++ b/WebCore/bindings/v8/WorkerContextExecutionProxy.h
@@ -110,6 +110,7 @@ namespace WebCore {
         WorkerContext* m_workerContext;
         v8::Persistent<v8::Context> m_context;
         int m_recursion;
+        RefPtr<V8ListenerGuard> m_listenerGuard;
 
         Vector<Event*> m_events;
     };
diff --git a/WebCore/bindings/v8/custom/V8CustomEventListener.cpp b/WebCore/bindings/v8/custom/V8CustomEventListener.cpp
index 6a4ede2..91abecd 100644
--- a/WebCore/bindings/v8/custom/V8CustomEventListener.cpp
+++ b/WebCore/bindings/v8/custom/V8CustomEventListener.cpp
@@ -35,8 +35,8 @@
 
 namespace WebCore {
 
-V8EventListener::V8EventListener(Frame* frame, v8::Local<v8::Object> listener, bool isAttribute)
-    : V8AbstractEventListener(frame, isAttribute)
+V8EventListener::V8EventListener(Frame* frame, PassRefPtr<V8ListenerGuard> guard, v8::Local<v8::Object> listener, bool isAttribute)
+    : V8AbstractEventListener(frame, guard, isAttribute)
 {
     setListenerObject(listener);
 }
diff --git a/WebCore/bindings/v8/custom/V8CustomEventListener.h b/WebCore/bindings/v8/custom/V8CustomEventListener.h
index 3f9790c..e34f24f 100644
--- a/WebCore/bindings/v8/custom/V8CustomEventListener.h
+++ b/WebCore/bindings/v8/custom/V8CustomEventListener.h
@@ -44,13 +44,13 @@ namespace WebCore {
     // that can handle the event.
     class V8EventListener : public V8AbstractEventListener {
     public:
-        static PassRefPtr<V8EventListener> create(Frame* frame, v8::Local<v8::Object> listener, bool isAttribute)
+        static PassRefPtr<V8EventListener> create(Frame* frame, PassRefPtr<V8ListenerGuard> guard, v8::Local<v8::Object> listener, bool isAttribute)
         {
-            return adoptRef(new V8EventListener(frame, listener, isAttribute));
+            return adoptRef(new V8EventListener(frame, guard, listener, isAttribute));
         }
 
     protected:
-        V8EventListener(Frame*, v8::Local<v8::Object> listener, bool isAttribute);
+        V8EventListener(Frame*, PassRefPtr<V8ListenerGuard>, v8::Local<v8::Object> listener, bool isAttribute);
 
         v8::Local<v8::Function> getListenerFunction();
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list