V8AbstractEventListener::~V8AbstractEventListener()
{
    if (!m_listener.IsEmpty()) {
        v8::HandleScope scope;
        v8::Local<v8::Object> listener = v8::Local<v8::Object>::New(m_listener);
        V8EventListenerList::clearWrapper(listener, m_isAttribute);
    }
    disposeListenerObject();
}
void V8AbstractEventListener::setListenerObject(v8::Handle<v8::Object> listener)
{
    disposeListenerObject();
    m_listener = v8::Persistent<v8::Object>::New(listener);
#ifndef NDEBUG
    V8GCController::registerGlobalHandle(EVENT_LISTENER, this, m_listener);
#endif
    if (m_isWeak)
        m_listener.MakeWeak(this, &weakEventListenerCallback);
}
V8ObjectEventListener::~V8ObjectEventListener()
{
    if (m_frame) {
        ASSERT(!m_listener.IsEmpty());
        V8Proxy* proxy = V8Proxy::retrieve(m_frame);
        if (proxy)
            proxy->objectListeners()->remove(this);
    }

    disposeListenerObject();
}
V8AbstractEventListener::~V8AbstractEventListener()
{
    if (!m_listener.IsEmpty())
        V8EventListenerList::clearWrapper(m_listener, m_isAttribute);
    disposeListenerObject();
}