Changeset 134666 in webkit


Ignore:
Timestamp:
Nov 14, 2012 2:07:13 PM (11 years ago)
Author:
mark.lam@apple.com
Message:

Fixed regressions due to adding JSEventListener::m_wrapper null checks.
https://bugs.webkit.org/show_bug.cgi?id=102183.

Reviewed by Geoffrey Garen.

Fixed JSEventListener::operator==() to work within the contract that
when m_wrapper is 0, m_jsFunction is also expected to be 0. Also fixed
some typos in comments.

No new tests.

  • bindings/js/JSEventListener.cpp:

(WebCore::JSEventListener::visitJSFunction):
(WebCore::JSEventListener::operator==):

  • bindings/js/JSEventListener.h:

(WebCore::JSEventListener::jsFunction):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r134665 r134666  
     12012-11-14  Mark Lam  <mark.lam@apple.com>
     2
     3        Fixed regressions due to adding JSEventListener::m_wrapper null checks.
     4        https://bugs.webkit.org/show_bug.cgi?id=102183.
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Fixed JSEventListener::operator==() to work within the contract that
     9        when m_wrapper is 0, m_jsFunction is also expected to be 0. Also fixed
     10        some typos in comments.
     11
     12        No new tests.
     13
     14        * bindings/js/JSEventListener.cpp:
     15        (WebCore::JSEventListener::visitJSFunction):
     16        (WebCore::JSEventListener::operator==):
     17        * bindings/js/JSEventListener.h:
     18        (WebCore::JSEventListener::jsFunction):
     19
    1202012-11-14  Nate Chapin  <japhet@chromium.org>
    221
  • trunk/Source/WebCore/bindings/js/JSEventListener.cpp

    r134495 r134666  
    6565void JSEventListener::visitJSFunction(SlotVisitor& visitor)
    6666{
    67     // If m_wrapper is 0, then jsFunction is zombied, and should never be accessed.
     67    // If m_wrapper is 0, then m_jsFunction is zombied, and should never be accessed.
    6868    if (!m_wrapper)
    6969        return;
     
    164164bool JSEventListener::operator==(const EventListener& listener)
    165165{
    166     // If m_wrapper is 0, then jsFunction is zombied, and should never be accessed.
    167     if (!m_wrapper)
    168         return false;
    169 
    170     if (const JSEventListener* jsEventListener = JSEventListener::cast(&listener))
    171         return m_jsFunction == jsEventListener->m_jsFunction && m_isAttribute == jsEventListener->m_isAttribute;
     166    if (const JSEventListener* jsEventListener = JSEventListener::cast(&listener)) {
     167        // If m_wrapper is 0, then m_jsFunction is zombied, and should never be
     168        // accessed. m_jsFunction should effectively be 0 in that case.
     169        JSC::JSObject* jsFunction = m_wrapper ? m_jsFunction.get() : 0;
     170        JSC::JSObject* otherJSFunction = jsEventListener->m_wrapper ?
     171            jsEventListener->m_jsFunction.get() : 0;
     172        return jsFunction == otherJSFunction && m_isAttribute == jsEventListener->m_isAttribute;
     173    }
    172174    return false;
    173175}
  • trunk/Source/WebCore/bindings/js/JSEventListener.h

    r134508 r134666  
    9191        ASSERT(!m_isolatedWorld->isNormal() || m_wrapper || !m_jsFunction);
    9292
    93         // If m_wrapper is 0, then jsFunction is zombied, and should never be accessed.
     93        // If m_wrapper is 0, then m_jsFunction is zombied, and should never be accessed.
    9494        if (!m_wrapper)
    9595            return 0;
Note: See TracChangeset for help on using the changeset viewer.