REGRESSION(r188548): Some tests crash after r188548 because injected bundle messages...
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Sep 2015 12:12:09 +0000 (12:12 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Sep 2015 12:12:09 +0000 (12:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=148529

Reviewed by Darin Adler.

When there are pending EventSender messages after a test finishes,
they could be processed in the main loop started by the
resetStateToConsistentValues(), but the old EventSender has been
replaced by a new one at that point. The new Eventsender can crash
when processing messages that were sent to the old one. To avoid
this, we return early when receiving an EventSender message and
the TestController state is not RunningTest.

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::didReceiveKeyDownMessageFromInjectedBundle):
(WTR::TestController::didReceiveMessageFromInjectedBundle):

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

Tools/ChangeLog
Tools/WebKitTestRunner/TestController.cpp

index 74dd421..552e9bc 100644 (file)
@@ -1,5 +1,24 @@
 2015-09-02  Carlos Garcia Campos  <cgarcia@igalia.com>
 
+        REGRESSION(r188548): Some tests crash after r188548 because injected bundle messages are received after the test finishes
+        https://bugs.webkit.org/show_bug.cgi?id=148529
+
+        Reviewed by Darin Adler.
+
+        When there are pending EventSender messages after a test finishes,
+        they could be processed in the main loop started by the
+        resetStateToConsistentValues(), but the old EventSender has been
+        replaced by a new one at that point. The new Eventsender can crash
+        when processing messages that were sent to the old one. To avoid
+        this, we return early when receiving an EventSender message and
+        the TestController state is not RunningTest.
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::didReceiveKeyDownMessageFromInjectedBundle):
+        (WTR::TestController::didReceiveMessageFromInjectedBundle):
+
+2015-09-02  Carlos Garcia Campos  <cgarcia@igalia.com>
+
         REGRESSION(r188548): TestController state is Resseting while tests are running after r188548
         https://bugs.webkit.org/show_bug.cgi?id=148528
 
index 5a5e0f3..255ce0c 100644 (file)
@@ -1019,6 +1019,9 @@ void TestController::didReceiveKeyDownMessageFromInjectedBundle(WKDictionaryRef
 void TestController::didReceiveMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody)
 {
     if (WKStringIsEqualToUTF8CString(messageName, "EventSender")) {
+        if (m_state != RunningTest)
+            return;
+
         ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
         WKDictionaryRef messageBodyDictionary = static_cast<WKDictionaryRef>(messageBody);
 
@@ -1089,6 +1092,9 @@ void TestController::didReceiveMessageFromInjectedBundle(WKStringRef messageName
 WKRetainPtr<WKTypeRef> TestController::didReceiveSynchronousMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody)
 {
     if (WKStringIsEqualToUTF8CString(messageName, "EventSender")) {
+        if (m_state != RunningTest)
+            return nullptr;
+
         ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
         WKDictionaryRef messageBodyDictionary = static_cast<WKDictionaryRef>(messageBody);