(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 700baae0646507837b5f9d529a41151deae52350..db82f96b0c597551a5ab9aed9fd89999e65faf9e 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 eb7f0eadb2b3b5fe6ee970b1218948e491b582bc..26c996601cf499a87bb0c761a12daa4c3a392f55 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));