Changeset 273222 in webkit


Ignore:
Timestamp:
Feb 21, 2021 1:08:03 PM (3 years ago)
Author:
ysuzuki@apple.com
Message:

[JSC] JSInternalPromise::then can fail if execution is terminated
https://bugs.webkit.org/show_bug.cgi?id=222244

Reviewed by Mark Lam.

JSInternalPromise::then assumed that call's result is always JSInternalPromise.
But this is wrong if termination exception is thrown. In that case, this call fails.
This patch makes it robust against this behavior.

  • runtime/JSInternalPromise.cpp:

(JSC::JSInternalPromise::then):

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r273217 r273222  
     12021-02-21  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [JSC] JSInternalPromise::then can fail if execution is terminated
     4        https://bugs.webkit.org/show_bug.cgi?id=222244
     5
     6        Reviewed by Mark Lam.
     7
     8        JSInternalPromise::then assumed that call's result is always JSInternalPromise.
     9        But this is wrong if termination exception is thrown. In that case, this call fails.
     10        This patch makes it robust against this behavior.
     11
     12        * runtime/JSInternalPromise.cpp:
     13        (JSC::JSInternalPromise::then):
     14
    1152021-02-21  Yusuke Suzuki  <ysuzuki@apple.com>
    216
  • trunk/Source/JavaScriptCore/runtime/JSInternalPromise.cpp

    r271766 r273222  
    7070    arguments.append(onRejected ? onRejected : jsUndefined());
    7171    ASSERT(!arguments.hasOverflowed());
    72 
    73     RELEASE_AND_RETURN(scope, jsCast<JSInternalPromise*>(call(globalObject, function, callData, this, arguments)));
     72    JSValue result = call(globalObject, function, callData, this, arguments);
     73    RETURN_IF_EXCEPTION(scope, nullptr);
     74    return jsCast<JSInternalPromise*>(result);
    7475}
    7576
Note: See TracChangeset for help on using the changeset viewer.