aboutsummaryrefslogtreecommitdiff
path: root/www/firefox/files/patch-bug1414945
blob: 3b57e971dc90d0a24ae94c19f69d16c7694a4272 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
commit 26740772e0c9
Author: Philip Chimento <philip.chimento@gmail.com>
Date:   Mon Nov 6 15:49:15 2017 -0800

    Bug 1414945 - Don't use TimeDuration in static initializer. r=jandem
    
    On Darwin this would cause a race between two static initializers.
    
    --HG--
    extra : rebase_source : 0547c4018334f7112022f1893c5f36a47dc14501
---
 js/src/shell/js.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git js/src/shell/js.cpp js/src/shell/js.cpp
index afb4990ecc0f..f8f81446c7ae 100644
--- js/src/shell/js.cpp
+++ js/src/shell/js.cpp
@@ -150,7 +150,7 @@ static const size_t gMaxStackSize = 128 * sizeof(size_t) * 1024;
  * Limit the timeout to 30 minutes to prevent an overflow on platfoms
  * that represent the time internally in microseconds using 32-bit int.
  */
-static const TimeDuration MAX_TIMEOUT_INTERVAL = TimeDuration::FromSeconds(1800.0);
+static const double MAX_TIMEOUT_SECONDS = 1800.0;
 
 // SharedArrayBuffer and Atomics are enabled by default (tracking Firefox).
 #define SHARED_MEMORY_DEFAULT 1
@@ -3852,6 +3852,7 @@ Sleep_fn(JSContext* cx, unsigned argc, Value* vp)
         }
 
         duration = TimeDuration::FromSeconds(Max(0.0, t_secs));
+        const TimeDuration MAX_TIMEOUT_INTERVAL = TimeDuration::FromSeconds(MAX_TIMEOUT_SECONDS);
         if (duration > MAX_TIMEOUT_INTERVAL) {
             JS_ReportErrorASCII(cx, "Excessive sleep interval");
             return false;
@@ -4019,6 +4020,7 @@ SetTimeoutValue(JSContext* cx, double t)
         JS_ReportErrorASCII(cx, "timeout is not a number");
         return false;
     }
+    const TimeDuration MAX_TIMEOUT_INTERVAL = TimeDuration::FromSeconds(MAX_TIMEOUT_SECONDS);
     if (TimeDuration::FromSeconds(t) > MAX_TIMEOUT_INTERVAL) {
         JS_ReportErrorASCII(cx, "Excessive timeout value");
         return false;