components/desktop/firefox/patches/firefox-55-terminator.patch
changeset 7846 eaed6d702f04
equal deleted inserted replaced
7845:04bd13eb1a17 7846:eaed6d702f04
       
     1 https://bugzilla.mozilla.org/show_bug.cgi?id=1232285
       
     2 https://bugzilla.mozilla.org/show_bug.cgi?id=1252382
       
     3 
       
     4 And a fix to 1232285, which introduced division of crashAfterMS
       
     5 by PR_MillisecondsToInterval(1000). crashAfterMS has to be divided
       
     6 by 1000 to get number of seconds.
       
     7 
       
     8 --- a/toolkit/components/terminator/nsTerminator.cpp
       
     9 +++ b/toolkit/components/terminator/nsTerminator.cpp
       
    10 @@ -33,6 +33,12 @@
       
    11  #include "nsExceptionHandler.h"
       
    12  #endif
       
    13  
       
    14 +#if defined(XP_WIN)
       
    15 +#include <windows.h>
       
    16 +#else
       
    17 +#include <unistd.h>
       
    18 +#endif
       
    19 +
       
    20  #include "mozilla/ArrayUtils.h"
       
    21  #include "mozilla/Attributes.h"
       
    22  #include "mozilla/DebugOnly.h"
       
    23 @@ -53,9 +59,6 @@
       
    24  // forcefully.
       
    25  #define ADDITIONAL_WAIT_BEFORE_CRASH_MS 3000
       
    26  
       
    27 -// One second, in ticks.
       
    28 -#define TICK_DURATION 1000
       
    29 -
       
    30  namespace mozilla {
       
    31  
       
    32  namespace {
       
    33 @@ -141,7 +144,11 @@
       
    34      // we have lost at most one second, which is much
       
    35      // more reasonable.
       
    36      //
       
    37 -    PR_Sleep(TICK_DURATION);
       
    38 +#if defined(XP_WIN)
       
    39 +        Sleep(1000 /* ms */);
       
    40 +#else
       
    41 +        usleep(1000000 /* usec */);
       
    42 +#endif
       
    43  
       
    44      if (gHeartbeat++ < timeToLive) {
       
    45        continue;
       
    46 @@ -378,7 +385,7 @@
       
    47    }
       
    48  
       
    49    UniquePtr<Options> options(new Options());
       
    50 -  options->crashAfterTicks = crashAfterMS / TICK_DURATION;
       
    51 +  options->crashAfterTicks = crashAfterMS / 1000;
       
    52  
       
    53    DebugOnly<PRThread*> watchdogThread = CreateSystemThread(RunWatchdog,
       
    54                                                  options.release());