Changeset 244273 in webkit


Ignore:
Timestamp:
Apr 15, 2019 11:27:06 AM (5 years ago)
Author:
pvollan@apple.com
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):

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r244260 r244273  
     12019-04-15  Per Arne Vollan  <pvollan@apple.com>
     2
     3        TestRunner::notifyDone() should be safely reentrant
     4        https://bugs.webkit.org/show_bug.cgi?id=196898
     5
     6        Reviewed by Darin Adler.
     7
     8        It is currently possible that TestRunner::notifyDone() will call itself, since
     9        notifyDone() will force a repaint, which can start executing JavaScript, which
     10        may call notifyDone() again. This can lead to test failures and flakiness.
     11        Fix this by setting the m_waitToDump flag before calling the dump() method.
     12
     13        * DumpRenderTree/mac/TestRunnerMac.mm:
     14        (TestRunner::notifyDone):
     15        (TestRunner::forceImmediateCompletion):
     16        * DumpRenderTree/win/TestRunnerWin.cpp:
     17        (TestRunner::notifyDone):
     18        (TestRunner::forceImmediateCompletion):
     19
    1202019-04-15  Philippe Normand  <pnormand@igalia.com>
    221
  • trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm

    r241597 r244273  
    294294void TestRunner::notifyDone()
    295295{
    296     if (m_waitToDump && !topLoadingFrame && !DRT::WorkQueue::singleton().count())
    297         dump();
    298     m_waitToDump = false;
     296    if (m_waitToDump) {
     297        m_waitToDump = false;
     298        if (!topLoadingFrame && !DRT::WorkQueue::singleton().count())
     299            dump();
     300    } else
     301        fprintf(stderr, "TestRunner::notifyDone() called unexpectedly.");
    299302}
    300303
    301304void TestRunner::forceImmediateCompletion()
    302305{
    303     if (m_waitToDump && !DRT::WorkQueue::singleton().count())
    304         dump();
    305     m_waitToDump = false;
     306    if (m_waitToDump) {
     307        m_waitToDump = false;
     308        if (!DRT::WorkQueue::singleton().count())
     309            dump();
     310    } else
     311        fprintf(stderr, "TestRunner::forceImmediateCompletion() called unexpectedly.");
    306312}
    307313
  • trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp

    r239832 r244273  
    305305{
    306306    // Same as on mac.  This can be shared.
    307     if (m_waitToDump && !topLoadingFrame && !DRT::WorkQueue::singleton().count())
    308         dump();
    309     m_waitToDump = false;
     307    if (m_waitToDump) {
     308        m_waitToDump = false;
     309        if (!topLoadingFrame && !DRT::WorkQueue::singleton().count())
     310            dump();
     311    } else
     312        fprintf(stderr, "TestRunner::notifyDone() called unexpectedly.");
    310313}
    311314
     
    313316{
    314317    // Same as on mac. This can be shared.
    315     if (m_waitToDump && !DRT::WorkQueue::singleton().count())
    316         dump();
    317     m_waitToDump = false;
     318    if (m_waitToDump) {
     319        m_waitToDump = false;
     320        if (!DRT::WorkQueue::singleton().count())
     321            dump();
     322    } else
     323        fprintf(stderr, "TestRunner::forceImmediateCompletion() called unexpectedly.");
    318324}
    319325
Note: See TracChangeset for help on using the changeset viewer.