Bug 1274922 part 7 - Fix a werror buglet. r=jorendorff
authorJan de Mooij <jdemooij@mozilla.com>
Thu, 02 Jun 2016 08:30:04 +0200
changeset 339110 44d925279d364d462f026f9fc68094290f8f3323
parent 339109 c6667fa95dff09f216fe345e1ffcf33b795a58ce
child 339111 bc8e2b503a967e9cfdfa16e5c689bc71c595d79e
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1274922
milestone49.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 1274922 part 7 - Fix a werror buglet. r=jorendorff
js/src/jit-test/tests/basic/werror.js
js/src/jsexn.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/basic/werror.js
@@ -0,0 +1,7 @@
+// |jit-test| error: unreachable code
+function f() {
+    return 1;
+    return 2;
+}
+options("werror");
+f();
--- a/js/src/jsexn.cpp
+++ b/js/src/jsexn.cpp
@@ -629,17 +629,20 @@ ErrorReportToString(JSContext* cx, JSErr
 {
     /*
      * We do NOT want to use GetErrorTypeName() here because it will not do the
      * "right thing" for JSEXN_INTERNALERR.  That is, the caller of this API
      * expects that "InternalError: " will be prepended but GetErrorTypeName
      * goes out of its way to avoid this.
      */
     JSExnType type = static_cast<JSExnType>(reportp->exnType);
-    RootedString str(cx, ClassName(GetExceptionProtoKey(type), cx));
+    RootedString str(cx);
+    if (type != JSEXN_WARN)
+        str = ClassName(GetExceptionProtoKey(type), cx);
+
     /*
      * If "str" is null at this point, that means we just want to use
      * reportp->ucmessage without prefixing it with anything.
      */
     if (str) {
         RootedString separator(cx, JS_NewUCStringCopyN(cx, MOZ_UTF16(": "), 2));
         if (!separator)
             return nullptr;