Changeset 164089 in webkit


Ignore:
Timestamp:
Feb 13, 2014 6:42:10 PM (10 years ago)
Author:
mark.lam@apple.com
Message:

The JSContainerConvertor and ObjcContainerConvertor need to protect JSValueRefs. Part 2.
<https://webkit.org/b/128764>

Reviewed by Mark Hahnenberg.

toJS() is the wrong cast function to use. We need to use toJSForGC() instead.
Also we need to acquire the JSLock to prevent concurrent accesses to the
Strong handle list.

  • API/JSValue.mm:

(JSContainerConvertor::add):
(containerValueToObject):
(ObjcContainerConvertor::add):
(objectToValue):

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSValue.mm

    r164085 r164089  
    616616{
    617617    JSC::ExecState* exec = toJS(m_context);
    618     m_jsValues.append(JSC::Strong<JSC::Unknown>(exec->vm(), toJS(exec, task.js)));
     618    m_jsValues.append(JSC::Strong<JSC::Unknown>(exec->vm(), toJSForGC(exec, task.js)));
    619619    m_objectMap.add(task.js, task.objc);
    620620    if (task.type != ContainerNone)
     
    673673{
    674674    ASSERT(task.type != ContainerNone);
     675    JSC::APIEntryShim entryShim(toJS(context));
    675676    JSContainerConvertor convertor(context);
    676677    convertor.add(task);
     
    842843{
    843844    JSC::ExecState* exec = toJS(m_context.JSGlobalContextRef);
    844     m_jsValues.append(JSC::Strong<JSC::Unknown>(exec->vm(), toJS(exec, task.js)));
     845    m_jsValues.append(JSC::Strong<JSC::Unknown>(exec->vm(), toJSForGC(exec, task.js)));
    845846    m_objectMap.add(task.objc, task.js);
    846847    if (task.type != ContainerNone)
     
    922923        return task.js;
    923924
     925    JSC::APIEntryShim entryShim(toJS(contextRef));
    924926    ObjcContainerConvertor convertor(context);
    925927    convertor.add(task);
  • trunk/Source/JavaScriptCore/ChangeLog

    r164088 r164089  
     12014-02-13  Mark Lam  <mark.lam@apple.com>
     2
     3        The JSContainerConvertor and ObjcContainerConvertor need to protect JSValueRefs. Part 2.
     4        <https://webkit.org/b/128764>
     5
     6        Reviewed by Mark Hahnenberg.
     7
     8        toJS() is the wrong cast function to use. We need to use toJSForGC() instead.
     9        Also we need to acquire the JSLock to prevent concurrent accesses to the
     10        Strong handle list.
     11
     12        * API/JSValue.mm:
     13        (JSContainerConvertor::add):
     14        (containerValueToObject):
     15        (ObjcContainerConvertor::add):
     16        (objectToValue):
     17
    1182014-02-13  Mark Hahnenberg  <mhahnenberg@apple.com>
    219
Note: See TracChangeset for help on using the changeset viewer.