Changeset 215487 in webkit


Ignore:
Timestamp:
Apr 18, 2017 4:34:17 PM (7 years ago)
Author:
Brent Fulgham
Message:

JSEventListener::m_isolatedWorld should be a Ref
https://bugs.webkit.org/show_bug.cgi?id=170910
<rdar://problem/30470332>

Reviewed by Alex Christensen.

Since m_isolatedWorld should never be nullptr, change the implementation of m_isolatedWorld
from a RefPtr to a Ref, and adjust the various call sites to support this change.

This should help us catch any changes that permit the isolatedWorld to be set to nullptr.

No new tests since there should be no change in behavior.

  • bindings/js/JSEventListener.cpp:

(WebCore::JSEventListener::JSEventListener):
(WebCore::JSEventListener::initializeJSFunction):
(WebCore::JSEventListener::handleEvent):

  • bindings/js/JSEventListener.h:

(WebCore::JSEventListener::cast):
(WebCore::JSEventListener::isolatedWorld):
(WebCore::JSEventListener::jsFunction):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r215486 r215487  
     12017-04-18  Brent Fulgham  <bfulgham@apple.com>
     2
     3        JSEventListener::m_isolatedWorld should be a Ref
     4        https://bugs.webkit.org/show_bug.cgi?id=170910
     5        <rdar://problem/30470332>
     6
     7        Reviewed by Alex Christensen.
     8
     9        Since m_isolatedWorld should never be nullptr, change the implementation of m_isolatedWorld
     10        from a RefPtr to a Ref, and adjust the various call sites to support this change.
     11
     12        This should help us catch any changes that permit the isolatedWorld to be set to nullptr.
     13
     14        No new tests since there should be no change in behavior.
     15
     16        * bindings/js/JSEventListener.cpp:
     17        (WebCore::JSEventListener::JSEventListener):
     18        (WebCore::JSEventListener::initializeJSFunction):
     19        (WebCore::JSEventListener::handleEvent):
     20        * bindings/js/JSEventListener.h:
     21        (WebCore::JSEventListener::cast):
     22        (WebCore::JSEventListener::isolatedWorld):
     23        (WebCore::JSEventListener::jsFunction):
     24
    1252017-04-18  Brent Fulgham  <bfulgham@apple.com>
    226
  • trunk/Source/WebCore/bindings/js/JSEventListener.cpp

    r215486 r215487  
    4848    , m_wrapper(wrapper)
    4949    , m_isAttribute(isAttribute)
    50     , m_isolatedWorld(&isolatedWorld)
     50    , m_isolatedWorld(isolatedWorld)
    5151{
    5252    if (wrapper) {
     
    102102        return;
    103103
    104     JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(scriptExecutionContext, *m_isolatedWorld);
     104    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(scriptExecutionContext, m_isolatedWorld);
    105105    if (!globalObject)
    106106        return;
  • trunk/Source/WebCore/bindings/js/JSEventListener.h

    r215486 r215487  
    5656        return listener->type() == JSEventListenerType
    5757            ? static_cast<const JSEventListener*>(listener)
    58             : 0;
     58            : nullptr;
    5959    }
    6060
     
    6767
    6868    JSC::JSObject* jsFunction(ScriptExecutionContext*) const;
    69     DOMWrapperWorld& isolatedWorld() const { return *m_isolatedWorld; }
     69    DOMWrapperWorld& isolatedWorld() const { return m_isolatedWorld; }
    7070
    7171    JSC::JSObject* wrapper() const { return m_wrapper.get(); }
     
    8989
    9090    bool m_isAttribute;
    91     RefPtr<DOMWrapperWorld> m_isolatedWorld;
     91    Ref<DOMWrapperWorld> m_isolatedWorld;
    9292};
    9393
     
    130130    // If m_wrapper is 0, then m_jsFunction is zombied, and should never be accessed.
    131131    if (!m_wrapper)
    132         return 0;
     132        return nullptr;
    133133
    134134    // Try to verify that m_jsFunction wasn't recycled. (Not exact, since an
Note: See TracChangeset for help on using the changeset viewer.