Bug 1490605 - Part 4: Return UTF-8 encoded strings from GetFunctionNameBytes. r=arai
authorAndré Bargull <andre.bargull@gmail.com>
Wed, 12 Sep 2018 01:02:27 -0700
changeset 492248 28bebbb1d4cb139792e5ddd225f4f156edbec35e
parent 492247 1d626fdff4f36e157c317791534b902771faa94d
child 492249 096c2c7d43265e6eb2bc44be67459b849d781cec
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersarai
bugs1490605
milestone64.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 1490605 - Part 4: Return UTF-8 encoded strings from GetFunctionNameBytes. r=arai
js/src/vm/JSFunction-inl.h
js/src/vm/JSFunction.cpp
js/src/vm/SelfHosting.cpp
--- a/js/src/vm/JSFunction-inl.h
+++ b/js/src/vm/JSFunction-inl.h
@@ -17,17 +17,17 @@
 #include "vm/JSObject-inl.h"
 
 namespace js {
 
 inline const char*
 GetFunctionNameBytes(JSContext* cx, JSFunction* fun, UniqueChars* bytes)
 {
     if (JSAtom* name = fun->explicitName()) {
-        *bytes = EncodeLatin1(cx, name);
+        *bytes = StringToNewUTF8CharsZ(cx, *name);
         return bytes->get();
     }
     return js_anonymous_str;
 }
 
 inline bool
 CanReuseFunctionForClone(JSContext* cx, HandleFunction fun)
 {
--- a/js/src/vm/JSFunction.cpp
+++ b/js/src/vm/JSFunction.cpp
@@ -2701,30 +2701,30 @@ js::ReportIncompatibleMethod(JSContext* 
     } else {
         MOZ_ASSERT(thisv.isUndefined() || thisv.isNull());
     }
 #endif
 
     if (JSFunction* fun = ReportIfNotFunction(cx, args.calleev())) {
         UniqueChars funNameBytes;
         if (const char* funName = GetFunctionNameBytes(cx, fun, &funNameBytes)) {
-            JS_ReportErrorNumberLatin1(cx, GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
-                                       clasp->name, funName, InformalValueTypeName(thisv));
+            JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
+                                     clasp->name, funName, InformalValueTypeName(thisv));
         }
     }
 }
 
 void
 js::ReportIncompatible(JSContext* cx, const CallArgs& args)
 {
     if (JSFunction* fun = ReportIfNotFunction(cx, args.calleev())) {
         UniqueChars funNameBytes;
         if (const char* funName = GetFunctionNameBytes(cx, fun, &funNameBytes)) {
-            JS_ReportErrorNumberLatin1(cx, GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_METHOD,
-                                       funName, "method", InformalValueTypeName(args.thisv()));
+            JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_METHOD,
+                                     funName, "method", InformalValueTypeName(args.thisv()));
         }
     }
 }
 
 namespace JS {
 namespace detail {
 
 JS_PUBLIC_API(void)
--- a/js/src/vm/SelfHosting.cpp
+++ b/js/src/vm/SelfHosting.cpp
@@ -1919,18 +1919,18 @@ js::ReportIncompatibleSelfHostedMethod(J
         MOZ_ASSERT(iter.callee(cx)->isSelfHostedOrIntrinsic() &&
                    !iter.callee(cx)->isBoundFunction());
         UniqueChars funNameBytes;
         const char* funName = GetFunctionNameBytes(cx, iter.callee(cx), &funNameBytes);
         if (!funName) {
             return false;
         }
         if (strcmp(funName, "IsTypedArrayEnsuringArrayBuffer") != 0) {
-            JS_ReportErrorNumberLatin1(cx, GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_METHOD,
-                                       funName, "method", InformalValueTypeName(args.thisv()));
+            JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_METHOD,
+                                     funName, "method", InformalValueTypeName(args.thisv()));
             return false;
         }
         ++iter;
     }
 
     MOZ_ASSERT_UNREACHABLE("How did we not find a useful self-hosted frame?");
     return false;
 }