Title: [294811] trunk/Source/_javascript_Core/API/tests/testapi.cpp
- Revision
- 294811
- Author
- [email protected]
- Date
- 2022-05-25 11:13:09 -0700 (Wed, 25 May 2022)
Log Message
[JSC] TestAPI::promiseUnhandledRejection() predominantly fails on MacOS 12.3 in --debug
https://bugs.webkit.org/show_bug.cgi?id=240243
<rdar://92975620>
Reviewed by Mark Lam.
The failures are caused by an unhandled rejection, that was originated in
TestAPI::promiseDrainDoesNotEatExceptions() and ended up in the callback of
TestAPI::promiseUnhandledRejection(), with an unexpected promise and reason.
That is, the callback of TestAPI::promiseUnhandledRejection() is called twice,
with only the first invocation being successful.
The failures weren't observed before MacOS 12.3 because TestAPI::promiseDrainDoesNotEatExceptions()
is a DYLD_MACOSX_VERSION-conditional test.
To fix the tests, this change ensures that TestAPI::promiseUnhandledRejection() performs assertions
only on the first run, aligning it with TestAPI::promiseUnhandledRejectionFromUnhandledRejectionCallback().
* Source/_javascript_Core/API/tests/testapi.cpp:
(TestAPI::promiseUnhandledRejection):
Canonical link: https://commits.webkit.org/250965@main
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/API/tests/testapi.cpp (294810 => 294811)
--- trunk/Source/_javascript_Core/API/tests/testapi.cpp 2022-05-25 18:11:10 UTC (rev 294810)
+++ trunk/Source/_javascript_Core/API/tests/testapi.cpp 2022-05-25 18:13:09 UTC (rev 294811)
@@ -555,6 +555,8 @@
static TestAPI* tester = this;
static bool callbackCalled = false;
auto callback = [](JSContextRef ctx, JSObjectRef, JSObjectRef, size_t argumentCount, const JSValueRef arguments[], JSValueRef*) -> JSValueRef {
+ if (callbackCalled)
+ return JSValueMakeUndefined(ctx);
tester->check(argumentCount && JSValueIsStrictEqual(ctx, arguments[0], promise), "callback should receive rejected promise as first argument");
tester->check(argumentCount > 1 && JSValueIsStrictEqual(ctx, arguments[1], reason), "callback should receive rejection reason as second argument");
tester->check(argumentCount == 2, "callback should not receive a third argument");
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes