Bug 1289050 - Part 2.1: Use JS_ReportErrorLatin1 in mozJSComponentLoader::LoadModule. r=jwalden
authorTooru Fujisawa <arai_a@mac.com>
Fri, 30 Sep 2016 12:34:43 +0900
changeset 315862 968d21d7f16d1790dd70365f81aa5ba18a4cf95b
parent 315861 1422dee77e6082162cbd2ec1372c6a1b089512fa
child 315863 b353e488f0eb8a6295db6275273157016963e31c
push id82302
push userarai_a@mac.com
push dateFri, 30 Sep 2016 03:35:30 +0000
treeherdermozilla-inbound@3b4b49952871 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwalden
bugs1289050
milestone52.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 1289050 - Part 2.1: Use JS_ReportErrorLatin1 in mozJSComponentLoader::LoadModule. r=jwalden
js/xpconnect/loader/mozJSComponentLoader.cpp
--- a/js/xpconnect/loader/mozJSComponentLoader.cpp
+++ b/js/xpconnect/loader/mozJSComponentLoader.cpp
@@ -399,18 +399,22 @@ mozJSComponentLoader::LoadModule(FileLoc
     if (!NSGetFactoryHolder ||
         !JS_GetProperty(cx, NSGetFactoryHolder, "NSGetFactory", &NSGetFactory_val) ||
         NSGetFactory_val.isUndefined())
     {
         return nullptr;
     }
 
     if (JS_TypeOfValue(cx, NSGetFactory_val) != JSTYPE_FUNCTION) {
-        JS_ReportError(cx, "%s has NSGetFactory property that is not a function",
-                       spec.get());
+        /*
+         * spec's encoding is ASCII unless it's zip file, otherwise it's
+         * random encoding.  Latin1 variant is safe for random encoding.
+         */
+        JS_ReportErrorLatin1(cx, "%s has NSGetFactory property that is not a function",
+                             spec.get());
         return nullptr;
     }
 
     RootedObject jsGetFactoryObj(cx);
     if (!JS_ValueToObject(cx, NSGetFactory_val, &jsGetFactoryObj) ||
         !jsGetFactoryObj) {
         /* XXX report error properly */
         return nullptr;