Bug 890127 - Properly initialize and cleanup ICU, when enabled in JS engine builds. r=njn
authorJeff Walden <jwalden@mit.edu>
Fri, 19 Jul 2013 20:18:01 -0700
changeset 152548 c77439f57dfc0207490e9b450466dc7c421362df
parent 152547 e432690bf0fb21911ef15177d36902891f1f8415
child 152549 b0b60f193dec254045cff510f5ad200a64471448
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn
bugs890127
milestone25.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 890127 - Properly initialize and cleanup ICU, when enabled in JS engine builds. r=njn
js/src/jsapi.cpp
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -68,17 +68,17 @@
 #ifdef JS_ION
 #include "ion/Ion.h"
 #endif
 #include "ion/PcScriptCache.h"
 #include "js/CharacterEncoding.h"
 #if ENABLE_INTL_API
 #include "unicode/uclean.h"
 #include "unicode/utypes.h"
-#endif
+#endif // ENABLE_INTL_API
 #include "vm/DateObject.h"
 #include "vm/Debugger.h"
 #include "vm/ErrorObject.h"
 #include "vm/Interpreter.h"
 #include "vm/NumericConversions.h"
 #include "vm/Runtime.h"
 #include "vm/Shape.h"
 #include "vm/StopIterationObject.h"
@@ -693,30 +693,41 @@ JS_Init(void)
 #if defined(JS_ION)
     if (!ion::InitializeIon())
         return false;
 #endif
 
     if (!ForkJoinSlice::InitializeTLS())
         return false;
 
+#if ENABLE_INTL_API
+    UErrorCode err = U_ZERO_ERROR;
+    u_init(&err);
+    if (U_FAILURE(err))
+        return false;
+#endif // ENABLE_INTL_API
+
     jsInitState = Running;
     return true;
 }
 
 JS_PUBLIC_API(void)
 JS_ShutDown(void)
 {
     MOZ_ASSERT(jsInitState == Running,
                "JS_ShutDown must only be called after JS_Init and can't race with it");
     MOZ_ASSERT(!JSRuntime::hasLiveRuntimes(),
                "forgot to destroy a runtime before shutting down");
 
     PRMJ_NowShutdown();
 
+#if ENABLE_INTL_API
+    u_cleanup();
+#endif // ENABLE_INTL_API
+
     jsInitState = ShutDown;
 }
 
 #ifdef DEBUG
 JS_FRIEND_API(bool)
 JS::isGCEnabled()
 {
     return !TlsPerThreadData.get()->suppressGC;