(r238246) [ MacOS Debug ] Layout Test http/wpt/webauthn/ctap-hid-failure.https.html...
authorjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Nov 2018 22:40:51 +0000 (22:40 +0000)
committerjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Nov 2018 22:40:51 +0000 (22:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=191757

Reviewed by Chris Dumez.

Wrong nonce error causes retransmission, which then trigger wrong nonce error. This is expected
behavior for mock testing. However, the main thread could time out when MockHidConnection::send
is excuting the block on another thread. The block will then return without invoking the callback,
which triggers this WTFCrash. The solution is always invoking the callback before return in the
block.

* UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
(WebKit::MockHidConnection::send):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238579 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.cpp

index 700baae..db82f96 100644 (file)
@@ -1,3 +1,19 @@
+2018-11-27  Jiewen Tan  <jiewen_tan@apple.com>
+
+        (r238246) [ MacOS Debug ] Layout Test http/wpt/webauthn/ctap-hid-failure.https.html is Crashing
+        https://bugs.webkit.org/show_bug.cgi?id=191757
+
+        Reviewed by Chris Dumez.
+
+        Wrong nonce error causes retransmission, which then trigger wrong nonce error. This is expected
+        behavior for mock testing. However, the main thread could time out when MockHidConnection::send
+        is excuting the block on another thread. The block will then return without invoking the callback,
+        which triggers this WTFCrash. The solution is always invoking the callback before return in the
+        block.
+
+        * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
+        (WebKit::MockHidConnection::send):
+
 2018-11-27  Keith Rollin  <krollin@apple.com>
 
         Better parsing of comments in generate-message*.py
index eb7f0ea..26c9966 100644 (file)
@@ -73,8 +73,10 @@ void MockHidConnection::send(Vector<uint8_t>&& data, DataSentCallback&& callback
     auto task = BlockPtr<void()>::fromCallable([weakThis = makeWeakPtr(*this), data = WTFMove(data), callback = WTFMove(callback)]() mutable {
         ASSERT(!RunLoop::isMain());
         RunLoop::main().dispatch([weakThis, data = WTFMove(data), callback = WTFMove(callback)]() mutable {
-            if (!weakThis)
+            if (!weakThis) {
+                callback(DataSent::No);
                 return;
+            }
 
             weakThis->assembleRequest(WTFMove(data));