Title: [244273] trunk/Tools
Revision
244273
Author
[email protected]
Date
2019-04-15 11:27:06 -0700 (Mon, 15 Apr 2019)

Log Message

TestRunner::notifyDone() should be safely reentrant
https://bugs.webkit.org/show_bug.cgi?id=196898

Reviewed by Darin Adler.

It is currently possible that TestRunner::notifyDone() will call itself, since
notifyDone() will force a repaint, which can start executing _javascript_, which
may call notifyDone() again. This can lead to test failures and flakiness.
Fix this by setting the m_waitToDump flag before calling the dump() method.

* DumpRenderTree/mac/TestRunnerMac.mm:
(TestRunner::notifyDone):
(TestRunner::forceImmediateCompletion):
* DumpRenderTree/win/TestRunnerWin.cpp:
(TestRunner::notifyDone):
(TestRunner::forceImmediateCompletion):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (244272 => 244273)


--- trunk/Tools/ChangeLog	2019-04-15 17:36:34 UTC (rev 244272)
+++ trunk/Tools/ChangeLog	2019-04-15 18:27:06 UTC (rev 244273)
@@ -1,3 +1,22 @@
+2019-04-15  Per Arne Vollan  <[email protected]>
+
+        TestRunner::notifyDone() should be safely reentrant
+        https://bugs.webkit.org/show_bug.cgi?id=196898
+
+        Reviewed by Darin Adler.
+
+        It is currently possible that TestRunner::notifyDone() will call itself, since
+        notifyDone() will force a repaint, which can start executing _javascript_, which
+        may call notifyDone() again. This can lead to test failures and flakiness.
+        Fix this by setting the m_waitToDump flag before calling the dump() method.
+
+        * DumpRenderTree/mac/TestRunnerMac.mm:
+        (TestRunner::notifyDone):
+        (TestRunner::forceImmediateCompletion):
+        * DumpRenderTree/win/TestRunnerWin.cpp:
+        (TestRunner::notifyDone):
+        (TestRunner::forceImmediateCompletion):
+
 2019-04-15  Philippe Normand  <[email protected]>
 
         [GTK][WPE] Add enable-media websetting

Modified: trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm (244272 => 244273)


--- trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm	2019-04-15 17:36:34 UTC (rev 244272)
+++ trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm	2019-04-15 18:27:06 UTC (rev 244273)
@@ -293,16 +293,22 @@
 
 void TestRunner::notifyDone()
 {
-    if (m_waitToDump && !topLoadingFrame && !DRT::WorkQueue::singleton().count())
-        dump();
-    m_waitToDump = false;
+    if (m_waitToDump) {
+        m_waitToDump = false;
+        if (!topLoadingFrame && !DRT::WorkQueue::singleton().count())
+            dump();
+    } else
+        fprintf(stderr, "TestRunner::notifyDone() called unexpectedly.");
 }
 
 void TestRunner::forceImmediateCompletion()
 {
-    if (m_waitToDump && !DRT::WorkQueue::singleton().count())
-        dump();
-    m_waitToDump = false;
+    if (m_waitToDump) {
+        m_waitToDump = false;
+        if (!DRT::WorkQueue::singleton().count())
+            dump();
+    } else
+        fprintf(stderr, "TestRunner::forceImmediateCompletion() called unexpectedly.");
 }
 
 static inline std::string stringFromJSString(JSStringRef jsString)

Modified: trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp (244272 => 244273)


--- trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp	2019-04-15 17:36:34 UTC (rev 244272)
+++ trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp	2019-04-15 18:27:06 UTC (rev 244273)
@@ -304,17 +304,23 @@
 void TestRunner::notifyDone()
 {
     // Same as on mac.  This can be shared.
-    if (m_waitToDump && !topLoadingFrame && !DRT::WorkQueue::singleton().count())
-        dump();
-    m_waitToDump = false;
+    if (m_waitToDump) {
+        m_waitToDump = false;
+        if (!topLoadingFrame && !DRT::WorkQueue::singleton().count())
+            dump();
+    } else
+        fprintf(stderr, "TestRunner::notifyDone() called unexpectedly.");
 }
 
 void TestRunner::forceImmediateCompletion()
 {
     // Same as on mac. This can be shared.
-    if (m_waitToDump && !DRT::WorkQueue::singleton().count())
-        dump();
-    m_waitToDump = false;
+    if (m_waitToDump) {
+        m_waitToDump = false;
+        if (!DRT::WorkQueue::singleton().count())
+            dump();
+    } else
+        fprintf(stderr, "TestRunner::forceImmediateCompletion() called unexpectedly.");
 }
 
 static wstring jsStringRefToWString(JSStringRef jsStr)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to