⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 284861 in webkit


Ignore:
Timestamp:
Oct 26, 2021, 2:46:30 AM (5 years ago)
Author:
youenn@apple.com
Message:

Beef up worker termination handling in ReadableStream routines
https://bugs.webkit.org/show_bug.cgi?id=231500
<rdar://83687915>

Reviewed by Darin Adler.

Add some termination/exception checks after getting values from global objects.
Covered by existing tests.

  • bindings/js/ReadableStream.cpp:

(WebCore::ReadableStream::create):
(WebCore::ReadableStream::lock):

  • bindings/js/ReadableStreamDefaultController.cpp:

(WebCore::invokeReadableStreamDefaultControllerFunction):
(WebCore::ReadableStreamDefaultController::enqueue):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r284860 r284861  
     12021-10-26  Youenn Fablet  <youenn@apple.com>
     2
     3        Beef up worker termination handling in ReadableStream routines
     4        https://bugs.webkit.org/show_bug.cgi?id=231500
     5        <rdar://83687915>
     6
     7        Reviewed by Darin Adler.
     8
     9        Add some termination/exception checks after getting values from global objects.
     10        Covered by existing tests.
     11
     12        * bindings/js/ReadableStream.cpp:
     13        (WebCore::ReadableStream::create):
     14        (WebCore::ReadableStream::lock):
     15        * bindings/js/ReadableStreamDefaultController.cpp:
     16        (WebCore::invokeReadableStreamDefaultControllerFunction):
     17        (WebCore::ReadableStreamDefaultController::enqueue):
     18
    1192021-10-26  Youenn Fablet  <youenn@apple.com>
    220
  • trunk/Source/WebCore/bindings/js/ReadableStream.cpp

    r278253 r284861  
    4747
    4848    auto* constructor = JSC::asObject(globalObject.get(&lexicalGlobalObject, clientData.builtinNames().ReadableStreamPrivateName()));
     49    RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
    4950
    5051    auto constructData = getConstructData(vm, constructor);
     
    116117    auto& lexicalGlobalObject = *m_globalObject;
    117118    auto& vm = lexicalGlobalObject.vm();
    118 #if ENABLE(EXCEPTION_SCOPE_VERIFICATION)
    119119    auto scope = DECLARE_CATCH_SCOPE(vm);
    120 #endif
    121120
    122121    auto& clientData = *static_cast<JSVMClientData*>(vm.clientData);
    123122
    124123    auto* constructor = JSC::asObject(m_globalObject->get(&lexicalGlobalObject, clientData.builtinNames().ReadableStreamDefaultReaderPrivateName()));
     124    EXCEPTION_ASSERT(!scope.exception() || vm.hasPendingTerminationException());
     125    if (scope.exception())
     126        return;
    125127
    126128    auto constructData = getConstructData(vm, constructor);
  • trunk/Source/WebCore/bindings/js/ReadableStreamDefaultController.cpp

    r277068 r284861  
    4545    JSC::JSLockHolder lock(vm);
    4646
     47    auto scope = DECLARE_CATCH_SCOPE(vm);
    4748    auto function = lexicalGlobalObject.get(&lexicalGlobalObject, identifier);
     49
     50    EXCEPTION_ASSERT(!scope.exception() || vm.hasPendingTerminationException());
     51    RETURN_IF_EXCEPTION(scope, false);
     52
    4853    ASSERT(function.isCallable(lexicalGlobalObject.vm()));
    4954
    50     auto scope = DECLARE_CATCH_SCOPE(vm);
    5155    auto callData = JSC::getCallData(vm, function);
    5256    call(&lexicalGlobalObject, function, callData, JSC::jsUndefined(), arguments);
     
    121125    auto value = toJS(&lexicalGlobalObject, &lexicalGlobalObject, chunk.get());
    122126
    123     if (UNLIKELY(scope.exception())) {
    124         ASSERT(vm.hasPendingTerminationException());
    125         return false;
    126     }
     127    EXCEPTION_ASSERT(!scope.exception() || vm.hasPendingTerminationException());
     128    RETURN_IF_EXCEPTION(scope, false);
    127129
    128130    return enqueue(value);
Note: See TracChangeset for help on using the changeset viewer.