Changeset 216246 in webkit


Ignore:
Timestamp:
May 5, 2017 9:14:49 AM (7 years ago)
Author:
mark.lam@apple.com
Message:

DRT's setAudioResultCallback() and IDBRequest::setResult() need to acquire the JSLock.
https://bugs.webkit.org/show_bug.cgi?id=171716
<rdar://problem/30878027>

Reviewed by Saam Barati.

Source/WebCore:

No new tests. This issue was caught by existing tests.

IDBRequest::setResult() needs to acquire the JSLock before calling toJS() (which
does JS conversion and therefore, potentially JS allocations).

  • Modules/indexeddb/IDBRequest.cpp:

(WebCore::IDBRequest::setResult):
(WebCore::IDBRequest::setResultToStructuredClone):

Tools:

setAudioResultCallback() needs to acquire the JSLock before calling toJS() (which
does JS conversion and therefore, potentially JS allocations) and accessing
methods of internal JS data structures (which may do JS invocation, etc).

  • DumpRenderTree/TestRunner.cpp:

(setAudioResultCallback):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r216240 r216246  
     12017-05-04  Mark Lam  <mark.lam@apple.com>
     2
     3        DRT's setAudioResultCallback() and IDBRequest::setResult() need to acquire the JSLock.
     4        https://bugs.webkit.org/show_bug.cgi?id=171716
     5        <rdar://problem/30878027>
     6
     7        Reviewed by Saam Barati.
     8
     9        No new tests.  This issue was caught by existing tests.
     10
     11        IDBRequest::setResult() needs to acquire the JSLock before calling toJS() (which
     12        does JS conversion and therefore, potentially JS allocations).
     13
     14        * Modules/indexeddb/IDBRequest.cpp:
     15        (WebCore::IDBRequest::setResult):
     16        (WebCore::IDBRequest::setResultToStructuredClone):
     17
    1182017-05-05  Carlos Garcia Campos  <cgarcia@igalia.com>
    219
  • trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp

    r212207 r216246  
    11/*
    2  * Copyright (C) 2015, 2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    371371    // FIXME: This conversion should be done lazily, when script needs the JSValues, so that global object
    372372    // of the IDBRequest wrapper can be used, rather than the lexicalGlobalObject.
    373     m_result = Result { JSC::Strong<JSC::Unknown> { context->vm(), toJS<IDLIDBKeyData>(*state, *jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), keyData) } };
     373    VM& vm = context->vm();
     374    JSLockHolder lock(vm);
     375    m_result = Result { JSC::Strong<JSC::Unknown> { vm, toJS<IDLIDBKeyData>(*state, *jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), keyData) } };
    374376}
    375377
     
    388390    // FIXME: This conversion should be done lazily, when script needs the JSValues, so that global object
    389391    // of the IDBRequest wrapper can be used, rather than the lexicalGlobalObject.
    390     Locker<JSLock> locker(context->vm().apiLock());
    391     m_result = Result { JSC::Strong<JSC::Unknown> { context->vm(), toJS<IDLSequence<IDLIDBKeyData>>(*state, *jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), keyDatas) } };
     392    VM& vm = context->vm();
     393    JSLockHolder lock(vm);
     394    m_result = Result { JSC::Strong<JSC::Unknown> { vm, toJS<IDLSequence<IDLIDBKeyData>>(*state, *jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), keyDatas) } };
    392395}
    393396
     
    406409    // FIXME: This conversion should be done lazily, when script needs the JSValues, so that global object
    407410    // of the IDBRequest wrapper can be used, rather than the lexicalGlobalObject.
    408     Locker<JSLock> locker(context->vm().apiLock());
    409     m_result = Result { JSC::Strong<JSC::Unknown> { context->vm(), toJS<IDLSequence<IDLIDBValue>>(*state, *jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), values) } };
     411    VM& vm = context->vm();
     412    JSLockHolder lock(vm);
     413    m_result = Result { JSC::Strong<JSC::Unknown> { vm, toJS<IDLSequence<IDLIDBValue>>(*state, *jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), values) } };
    410414}
    411415
     
    437441    // FIXME: This conversion should be done lazily, when script needs the JSValues, so that global object
    438442    // of the IDBRequest wrapper can be used, rather than the lexicalGlobalObject.
    439     m_result = Result { JSC::Strong<JSC::Unknown> { context->vm(), toJS<IDLIDBValue>(*state, *jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), value) } };
     443    VM& vm = context->vm();
     444    JSLockHolder lock(vm);
     445    m_result = Result { JSC::Strong<JSC::Unknown> { vm, toJS<IDLIDBValue>(*state, *jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), value) } };
    440446}
    441447
  • trunk/Tools/ChangeLog

    r216244 r216246  
     12017-05-04  Mark Lam  <mark.lam@apple.com>
     2
     3        DRT's setAudioResultCallback() and IDBRequest::setResult() need to acquire the JSLock.
     4        https://bugs.webkit.org/show_bug.cgi?id=171716
     5        <rdar://problem/30878027>
     6
     7        Reviewed by Saam Barati.
     8
     9        setAudioResultCallback() needs to acquire the JSLock before calling toJS() (which
     10        does JS conversion and therefore, potentially JS allocations) and accessing
     11        methods of internal JS data structures (which may do JS invocation, etc).
     12
     13        * DumpRenderTree/TestRunner.cpp:
     14        (setAudioResultCallback):
     15
    1162017-05-05  Jonathan Bedard  <jbedard@apple.com>
    217
  • trunk/Tools/DumpRenderTree/TestRunner.cpp

    r216219 r216246  
    348348
    349349    // FIXME (123058): Use a JSC API to get buffer contents once such is exposed.
    350     JSC::JSArrayBufferView* jsBufferView = JSC::jsDynamicCast<JSC::JSArrayBufferView*>(toJS(context)->vm(), toJS(toJS(context), arguments[0]));
     350    JSC::VM& vm = toJS(context)->vm();
     351    JSC::JSLockHolder lock(vm);
     352
     353    JSC::JSArrayBufferView* jsBufferView = JSC::jsDynamicCast<JSC::JSArrayBufferView*>(vm, toJS(toJS(context), arguments[0]));
    351354    ASSERT(jsBufferView);
    352355    RefPtr<JSC::ArrayBufferView> bufferView = jsBufferView->unsharedImpl();
Note: See TracChangeset for help on using the changeset viewer.