Bug 1274922 part 5 - Remove JSEXN_NONE and add JSEXN_WARN. r=jorendorff
authorJan de Mooij <jdemooij@mozilla.com>
Tue, 31 May 2016 08:07:00 +0200
changeset 340653 b2eb560ec7c8d35c8e0b65915e663e321bbc6b3a
parent 340652 502b474b0d6b3e705ae65b017d13063ad171e2c0
child 340654 7a5ff0cdea30f55b0972659ce300a3179633dc80
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [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 5 - Remove JSEXN_NONE and add JSEXN_WARN. r=jorendorff
dom/workers/WorkerPrivate.cpp
js/src/ctypes/ctypes.msg
js/src/jit-test/tests/basic/statement-after-return.js
js/src/jit-test/tests/parser/expr-closure-warn.js
js/src/js.msg
js/src/jsapi.h
js/src/jsexn.cpp
js/src/jsexn.h
js/src/jsshell.msg
js/src/shell/js.cpp
js/src/tests/shell/warning.js
js/src/vm/ErrorObject.h
js/xpconnect/src/jsshell.msg
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -5923,17 +5923,17 @@ WorkerPrivate::ReportError(JSContext* aC
     xpc::ErrorReport::ErrorReportToMessageString(aReport, message);
 
     filename = NS_ConvertUTF8toUTF16(aReport->filename);
     line.Assign(aReport->linebuf(), aReport->linebufLength());
     lineNumber = aReport->lineno;
     columnNumber = aReport->tokenOffset();
     flags = aReport->flags;
     errorNumber = aReport->errorNumber;
-    MOZ_ASSERT(aReport->exnType >= JSEXN_NONE && aReport->exnType < JSEXN_LIMIT);
+    MOZ_ASSERT(aReport->exnType >= JSEXN_FIRST && aReport->exnType < JSEXN_LIMIT);
     exnType = JSExnType(aReport->exnType);
   }
   else {
     lineNumber = columnNumber = errorNumber = 0;
     flags = nsIScriptError::errorFlag | nsIScriptError::exceptionFlag;
   }
 
   if (message.IsEmpty()) {
--- a/js/src/ctypes/ctypes.msg
+++ b/js/src/ctypes/ctypes.msg
@@ -4,17 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
  * This is the jsctypes error message file.
  *
  * For syntax details, see js/src/js.msg.
  */
 
-MSG_DEF(CTYPESMSG_PLACEHOLDER_0, 0, JSEXN_NONE, NULL)
+MSG_DEF(CTYPESMSG_PLACEHOLDER_0, 0, JSEXN_ERR, NULL)
 
 /* type conversion */
 MSG_DEF(CTYPESMSG_CONV_ERROR_ARG,3, JSEXN_TYPEERR, "can't pass {0} to argument {1} of {2}")
 MSG_DEF(CTYPESMSG_CONV_ERROR_ARRAY,3, JSEXN_TYPEERR, "can't convert {0} to element {1} of the type {2}")
 MSG_DEF(CTYPESMSG_CONV_ERROR_FIN,2, JSEXN_TYPEERR, "can't convert {0} to the type of argument 1 of {1}")
 MSG_DEF(CTYPESMSG_CONV_ERROR_RET,2, JSEXN_TYPEERR, "can't convert {0} to the return type of {1}")
 MSG_DEF(CTYPESMSG_CONV_ERROR_SET,2, JSEXN_TYPEERR, "can't convert {0} to the type {1}")
 MSG_DEF(CTYPESMSG_CONV_ERROR_STRUCT,5, JSEXN_TYPEERR, "can't convert {0} to the '{1}' field ({2}) of {3}{4}")
--- a/js/src/jit-test/tests/basic/statement-after-return.js
+++ b/js/src/jit-test/tests/basic/statement-after-return.js
@@ -1,24 +1,24 @@
 // Warning should be shown for unreachable statement after return (bug 1151931).
 
 function testWarn(code, lineNumber, columnNumber) {
   enableLastWarning();
   eval(code);
   var warning = getLastWarning();
   assertEq(warning !== null, true, "warning should be caught for " + code);
-  assertEq(warning.name, "None");
+  assertEq(warning.name, "Warning");
   assertEq(warning.lineNumber, lineNumber);
   assertEq(warning.columnNumber, columnNumber);
 
   clearLastWarning();
   Reflect.parse(code);
   warning = getLastWarning();
   assertEq(warning !== null, true, "warning should be caught for " + code);
-  assertEq(warning.name, "None");
+  assertEq(warning.name, "Warning");
   // Warning generated by Reflect.parse has line/column number for Reflect.parse
   // itself, not parsed code.
   disableLastWarning();
 }
 
 function testPass(code) {
   enableLastWarning();
   eval(code);
--- a/js/src/jit-test/tests/parser/expr-closure-warn.js
+++ b/js/src/jit-test/tests/parser/expr-closure-warn.js
@@ -10,30 +10,30 @@ function testWarn(code) {
   }
 
   enableLastWarning();
   var g = newGlobal();
   g.code = code;
   g.eval('eval(code)');
   var warning = getLastWarning();
   assertEq(warning !== null, true, "warning should be caught for " + code);
-  assertEq(warning.name, "None");
+  assertEq(warning.name, "Warning");
 
   clearLastWarning();
   g.eval('eval(code)');
   warning = getLastWarning();
   assertEq(warning, null, "warning should not be caught for 2nd ocurrence");
 
   clearLastWarning();
   g = newGlobal();
   g.code = code;
   g.eval('Reflect.parse(code);');
   warning = getLastWarning();
   assertEq(warning !== null, true, "warning should be caught for " + code);
-  assertEq(warning.name, "None");
+  assertEq(warning.name, "Warning");
 
   clearLastWarning();
   g.eval('Reflect.parse(code);');
   warning = getLastWarning();
   assertEq(warning, null, "warning should not be caught for 2nd ocurrence");
   disableLastWarning();
 }
 
--- a/js/src/js.msg
+++ b/js/src/js.msg
@@ -36,17 +36,17 @@
  *
  * JS_ReportErrorNumber(JSMSG_NOT_A_SUBSPECIES, "Rhino", "Monkey");
  *
  * to report:
  *
  * "Rhino is not a member of the Monkey family"
  */
 
-MSG_DEF(JSMSG_NOT_AN_ERROR,            0, JSEXN_NONE, "<Error #0 is reserved>")
+MSG_DEF(JSMSG_NOT_AN_ERROR,            0, JSEXN_ERR, "<Error #0 is reserved>")
 MSG_DEF(JSMSG_NOT_DEFINED,             1, JSEXN_REFERENCEERR, "{0} is not defined")
 MSG_DEF(JSMSG_MORE_ARGS_NEEDED,        3, JSEXN_TYPEERR, "{0} requires more than {1} argument{2}")
 MSG_DEF(JSMSG_INCOMPATIBLE_PROTO,      3, JSEXN_TYPEERR, "{0}.prototype.{1} called on incompatible {2}")
 MSG_DEF(JSMSG_NO_CONSTRUCTOR,          1, JSEXN_TYPEERR, "{0} has no constructor")
 MSG_DEF(JSMSG_BAD_SORT_ARG,            0, JSEXN_TYPEERR, "invalid Array.prototype.sort argument")
 MSG_DEF(JSMSG_CANT_WATCH,              1, JSEXN_TYPEERR, "can't watch non-native objects of class {0}")
 MSG_DEF(JSMSG_READ_ONLY,               1, JSEXN_TYPEERR, "{0} is read-only")
 MSG_DEF(JSMSG_CANT_DELETE,             1, JSEXN_TYPEERR, "property {0} is non-configurable and can't be deleted")
@@ -66,17 +66,17 @@ MSG_DEF(JSMSG_BAD_ARRAY_LENGTH,        0
 MSG_DEF(JSMSG_REDECLARED_VAR,          2, JSEXN_SYNTAXERR, "redeclaration of {0} {1}")
 MSG_DEF(JSMSG_UNDECLARED_VAR,          1, JSEXN_REFERENCEERR, "assignment to undeclared variable {0}")
 MSG_DEF(JSMSG_GETTER_ONLY,             0, JSEXN_TYPEERR, "setting a property that has only a getter")
 MSG_DEF(JSMSG_OVERWRITING_ACCESSOR,    1, JSEXN_TYPEERR, "can't overwrite accessor property {0}")
 MSG_DEF(JSMSG_UNDEFINED_PROP,          1, JSEXN_REFERENCEERR, "reference to undefined property {0}")
 MSG_DEF(JSMSG_INVALID_MAP_ITERABLE,    1, JSEXN_TYPEERR, "iterable for {0} should have array-like objects")
 MSG_DEF(JSMSG_NESTING_GENERATOR,       0, JSEXN_TYPEERR, "already executing generator")
 MSG_DEF(JSMSG_INCOMPATIBLE_METHOD,     3, JSEXN_TYPEERR, "{0} {1} called on incompatible {2}")
-MSG_DEF(JSMSG_OBJECT_WATCH_DEPRECATED, 0, JSEXN_NONE, "Object.prototype.watch and unwatch are very slow, non-standard, and deprecated; use a getter/setter instead")
+MSG_DEF(JSMSG_OBJECT_WATCH_DEPRECATED, 0, JSEXN_WARN, "Object.prototype.watch and unwatch are very slow, non-standard, and deprecated; use a getter/setter instead")
 MSG_DEF(JSMSG_BAD_SURROGATE_CHAR,      1, JSEXN_TYPEERR, "bad surrogate character {0}")
 MSG_DEF(JSMSG_UTF8_CHAR_TOO_LARGE,     1, JSEXN_TYPEERR, "UTF-8 character {0} too large")
 MSG_DEF(JSMSG_MALFORMED_UTF8_CHAR,     1, JSEXN_TYPEERR, "malformed UTF-8 character sequence at offset {0}")
 MSG_DEF(JSMSG_BUILTIN_CTOR_NO_NEW,     1, JSEXN_TYPEERR, "calling a builtin {0} constructor without new is forbidden")
 MSG_DEF(JSMSG_BAD_GENERATOR_YIELD,     1, JSEXN_TYPEERR, "yield from closing generator {0}")
 MSG_DEF(JSMSG_EMPTY_ARRAY_REDUCE,      0, JSEXN_TYPEERR, "reduce of empty array with no initial value")
 MSG_DEF(JSMSG_UNEXPECTED_TYPE,         2, JSEXN_TYPEERR, "{0} is {1}")
 MSG_DEF(JSMSG_MISSING_FUN_ARG,         2, JSEXN_TYPEERR, "missing argument {0} when calling function {1}")
@@ -87,17 +87,17 @@ MSG_DEF(JSMSG_OBJECT_NOT_EXTENSIBLE,   1
 MSG_DEF(JSMSG_CANT_DEFINE_PROP_OBJECT_NOT_EXTENSIBLE, 2, JSEXN_TYPEERR, "can't define property {1}: {0} is not extensible")
 MSG_DEF(JSMSG_CANT_REDEFINE_PROP,      1, JSEXN_TYPEERR, "can't redefine non-configurable property {0}")
 MSG_DEF(JSMSG_CANT_REDEFINE_ARRAY_LENGTH, 0, JSEXN_TYPEERR, "can't redefine array length")
 MSG_DEF(JSMSG_CANT_DEFINE_PAST_ARRAY_LENGTH, 0, JSEXN_TYPEERR, "can't define array index property past the end of an array with non-writable length")
 MSG_DEF(JSMSG_BAD_GET_SET_FIELD,       1, JSEXN_TYPEERR, "property descriptor's {0} field is neither undefined nor a function")
 MSG_DEF(JSMSG_THROW_TYPE_ERROR,        0, JSEXN_TYPEERR, "'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them")
 MSG_DEF(JSMSG_NOT_EXPECTED_TYPE,       3, JSEXN_TYPEERR, "{0}: expected {1}, got {2}")
 MSG_DEF(JSMSG_NOT_ITERABLE,            1, JSEXN_TYPEERR, "{0} is not iterable")
-MSG_DEF(JSMSG_ALREADY_HAS_PRAGMA,      2, JSEXN_NONE, "{0} is being assigned a {1}, but already has one")
+MSG_DEF(JSMSG_ALREADY_HAS_PRAGMA,      2, JSEXN_WARN, "{0} is being assigned a {1}, but already has one")
 MSG_DEF(JSMSG_NEXT_RETURNED_PRIMITIVE, 0, JSEXN_TYPEERR, "iterator.next() returned a non-object value")
 MSG_DEF(JSMSG_CANT_SET_PROTO,          0, JSEXN_TYPEERR, "can't set prototype of this object")
 MSG_DEF(JSMSG_CANT_SET_PROTO_OF,       1, JSEXN_TYPEERR, "can't set prototype of {0}")
 MSG_DEF(JSMSG_CANT_SET_PROTO_CYCLE,    0, JSEXN_TYPEERR, "can't set prototype: it would cause a prototype chain cycle")
 MSG_DEF(JSMSG_INVALID_ARG_TYPE,        3, JSEXN_TYPEERR, "Invalid type: {0} can't be a{1} {2}")
 MSG_DEF(JSMSG_TERMINATED,              1, JSEXN_ERR, "Script terminated by timeout at:\n{0}")
 MSG_DEF(JSMSG_PROTO_NOT_OBJORNULL,     1, JSEXN_TYPEERR, "{0}.prototype is not an object or null")
 MSG_DEF(JSMSG_CANT_CALL_CLASS_CONSTRUCTOR, 0, JSEXN_TYPEERR, "class constructors must be invoked with |new|")
@@ -230,21 +230,21 @@ MSG_DEF(JSMSG_CURLY_BEFORE_CATCH,      0
 MSG_DEF(JSMSG_CURLY_BEFORE_CLASS,      0, JSEXN_SYNTAXERR, "missing { before class body")
 MSG_DEF(JSMSG_CURLY_BEFORE_FINALLY,    0, JSEXN_SYNTAXERR, "missing { before finally block")
 MSG_DEF(JSMSG_CURLY_BEFORE_SWITCH,     0, JSEXN_SYNTAXERR, "missing { before switch body")
 MSG_DEF(JSMSG_CURLY_BEFORE_TRY,        0, JSEXN_SYNTAXERR, "missing { before try block")
 MSG_DEF(JSMSG_CURLY_IN_COMPOUND,       0, JSEXN_SYNTAXERR, "missing } in compound statement")
 MSG_DEF(JSMSG_DECLARATION_AFTER_EXPORT,0, JSEXN_SYNTAXERR, "missing declaration after 'export' keyword")
 MSG_DEF(JSMSG_DECLARATION_AFTER_IMPORT,0, JSEXN_SYNTAXERR, "missing declaration after 'import' keyword")
 MSG_DEF(JSMSG_DEPRECATED_DELETE_OPERAND, 0, JSEXN_SYNTAXERR, "applying the 'delete' operator to an unqualified name is deprecated")
-MSG_DEF(JSMSG_DEPRECATED_EXPR_CLOSURE, 0, JSEXN_NONE, "expression closures are deprecated")
-MSG_DEF(JSMSG_DEPRECATED_FOR_EACH,     0, JSEXN_NONE, "JavaScript 1.6's for-each-in loops are deprecated; consider using ES6 for-of instead")
+MSG_DEF(JSMSG_DEPRECATED_EXPR_CLOSURE, 0, JSEXN_WARN, "expression closures are deprecated")
+MSG_DEF(JSMSG_DEPRECATED_FOR_EACH,     0, JSEXN_WARN, "JavaScript 1.6's for-each-in loops are deprecated; consider using ES6 for-of instead")
 MSG_DEF(JSMSG_DEPRECATED_OCTAL,        0, JSEXN_SYNTAXERR, "\"0\"-prefixed octal literals and octal escape sequences are deprecated; for octal literals use the \"0o\" prefix instead")
-MSG_DEF(JSMSG_DEPRECATED_PRAGMA,       1, JSEXN_NONE, "Using //@ to indicate {0} pragmas is deprecated. Use //# instead")
-MSG_DEF(JSMSG_DEPRECATED_BLOCK_SCOPE_FUN_REDECL, 1, JSEXN_NONE, "redeclaration of block-scoped function `{0}' is deprecated")
+MSG_DEF(JSMSG_DEPRECATED_PRAGMA,       1, JSEXN_WARN, "Using //@ to indicate {0} pragmas is deprecated. Use //# instead")
+MSG_DEF(JSMSG_DEPRECATED_BLOCK_SCOPE_FUN_REDECL, 1, JSEXN_WARN, "redeclaration of block-scoped function `{0}' is deprecated")
 MSG_DEF(JSMSG_DUPLICATE_EXPORT_NAME,   1, JSEXN_SYNTAXERR, "duplicate export name '{0}'")
 MSG_DEF(JSMSG_DUPLICATE_FORMAL,        1, JSEXN_SYNTAXERR, "duplicate formal argument {0}")
 MSG_DEF(JSMSG_DUPLICATE_LABEL,         0, JSEXN_SYNTAXERR, "duplicate label")
 MSG_DEF(JSMSG_DUPLICATE_PROPERTY,      1, JSEXN_SYNTAXERR, "property name {0} appears more than once in object literal")
 MSG_DEF(JSMSG_EMPTY_CONSEQUENT,        0, JSEXN_SYNTAXERR, "mistyped ; after conditional?")
 MSG_DEF(JSMSG_EQUAL_AS_ASSIGN,         0, JSEXN_SYNTAXERR, "test for equality (==) mistyped as assignment (=)?")
 MSG_DEF(JSMSG_EXPORT_DECL_AT_TOP_LEVEL,0, JSEXN_SYNTAXERR, "export declarations may only appear at top level of a module")
 MSG_DEF(JSMSG_FINALLY_WITHOUT_TRY,     0, JSEXN_SYNTAXERR, "finally without try")
@@ -300,17 +300,17 @@ MSG_DEF(JSMSG_REDECLARED_PARAM,        1
 MSG_DEF(JSMSG_RESERVED_ID,             1, JSEXN_SYNTAXERR, "{0} is a reserved identifier")
 MSG_DEF(JSMSG_REST_WITH_DEFAULT,       0, JSEXN_SYNTAXERR, "rest parameter may not have a default")
 MSG_DEF(JSMSG_SELFHOSTED_TOP_LEVEL_LEXICAL, 1, JSEXN_SYNTAXERR, "self-hosted code cannot contain top-level {0} declarations")
 MSG_DEF(JSMSG_SELFHOSTED_UNBOUND_NAME, 0, JSEXN_TYPEERR, "self-hosted code may not contain unbound name lookups")
 MSG_DEF(JSMSG_SEMI_AFTER_FOR_COND,     0, JSEXN_SYNTAXERR, "missing ; after for-loop condition")
 MSG_DEF(JSMSG_SEMI_AFTER_FOR_INIT,     0, JSEXN_SYNTAXERR, "missing ; after for-loop initializer")
 MSG_DEF(JSMSG_SEMI_BEFORE_STMNT,       0, JSEXN_SYNTAXERR, "missing ; before statement")
 MSG_DEF(JSMSG_SOURCE_TOO_LONG,         0, JSEXN_RANGEERR, "source is too long")
-MSG_DEF(JSMSG_STMT_AFTER_RETURN,       0, JSEXN_NONE, "unreachable code after return statement")
+MSG_DEF(JSMSG_STMT_AFTER_RETURN,       0, JSEXN_WARN, "unreachable code after return statement")
 MSG_DEF(JSMSG_STRICT_CODE_WITH,        0, JSEXN_SYNTAXERR, "strict mode code may not contain 'with' statements")
 MSG_DEF(JSMSG_TEMPLSTR_UNTERM_EXPR,    0, JSEXN_SYNTAXERR, "missing } in template string")
 MSG_DEF(JSMSG_SIMD_NOT_A_VECTOR,       2, JSEXN_TYPEERR, "expecting a SIMD {0} object as argument {1}")
 MSG_DEF(JSMSG_TOO_MANY_CASES,          0, JSEXN_INTERNALERR, "too many switch cases")
 MSG_DEF(JSMSG_TOO_MANY_CATCH_VARS,     0, JSEXN_SYNTAXERR, "too many catch variables")
 MSG_DEF(JSMSG_TOO_MANY_CON_ARGS,       0, JSEXN_SYNTAXERR, "too many constructor arguments")
 MSG_DEF(JSMSG_TOO_MANY_DEFAULTS,       0, JSEXN_SYNTAXERR, "more than one switch default")
 MSG_DEF(JSMSG_TOO_MANY_FUN_ARGS,       0, JSEXN_SYNTAXERR, "too many function arguments")
@@ -333,17 +333,17 @@ MSG_DEF(JSMSG_BAD_COLUMN_NUMBER,       0
 MSG_DEF(JSMSG_COMPUTED_NAME_IN_PATTERN,0, JSEXN_SYNTAXERR, "computed property names aren't supported in this destructuring declaration")
 MSG_DEF(JSMSG_DEFAULT_IN_PATTERN,      0, JSEXN_SYNTAXERR, "destructuring defaults aren't supported in this destructuring declaration")
 MSG_DEF(JSMSG_BAD_NEWTARGET,           0, JSEXN_SYNTAXERR, "new.target only allowed within functions")
 MSG_DEF(JSMSG_ESCAPED_KEYWORD,         0, JSEXN_SYNTAXERR, "keywords must be written literally, without embedded escapes")
 
 // asm.js
 MSG_DEF(JSMSG_USE_ASM_TYPE_FAIL,       1, JSEXN_TYPEERR, "asm.js type error: {0}")
 MSG_DEF(JSMSG_USE_ASM_LINK_FAIL,       1, JSEXN_TYPEERR, "asm.js link error: {0}")
-MSG_DEF(JSMSG_USE_ASM_TYPE_OK,         1, JSEXN_NONE,    "Successfully compiled asm.js code ({0})")
+MSG_DEF(JSMSG_USE_ASM_TYPE_OK,         1, JSEXN_WARN,    "Successfully compiled asm.js code ({0})")
 
 // wasm
 MSG_DEF(JSMSG_WASM_FAIL,               1, JSEXN_TYPEERR,     "wasm error: {0}")
 MSG_DEF(JSMSG_WASM_DECODE_FAIL,        2, JSEXN_TYPEERR,     "wasm validation error at offset {0}: {1}")
 MSG_DEF(JSMSG_WASM_TEXT_FAIL,          1, JSEXN_SYNTAXERR,   "wasm text error: {0}")
 MSG_DEF(JSMSG_WASM_BAD_IND_CALL,       0, JSEXN_ERR,         "wasm indirect call signature mismatch")
 MSG_DEF(JSMSG_WASM_BAD_BUF_ARG,        0, JSEXN_TYPEERR,     "first argument must be a typed array")
 MSG_DEF(JSMSG_WASM_BAD_IMPORT_ARG,     0, JSEXN_TYPEERR,     "second argument, if present, must be an object")
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -619,30 +619,34 @@ typedef void
 (* JSProcessPromiseCallback)(JSContext* cx, JS::HandleObject promise);
 
 typedef void
 (* JSErrorReporter)(JSContext* cx, const char* message, JSErrorReport* report);
 
 /**
  * Possible exception types. These types are part of a JSErrorFormatString
  * structure. They define which error to throw in case of a runtime error.
- * JSEXN_NONE marks an unthrowable error.
+ *
+ * JSEXN_WARN is used for warnings in js.msg files (for instance because we
+ * don't want to prepend 'Error:' to warning messages). This value can go away
+ * if we ever decide to use an entirely separate mechanism for warnings.
  */
 typedef enum JSExnType {
-    JSEXN_NONE = -1,
-      JSEXN_ERR,
+    JSEXN_ERR,
+    JSEXN_FIRST = JSEXN_ERR,
         JSEXN_INTERNALERR,
         JSEXN_EVALERR,
         JSEXN_RANGEERR,
         JSEXN_REFERENCEERR,
         JSEXN_SYNTAXERR,
         JSEXN_TYPEERR,
         JSEXN_URIERR,
         JSEXN_DEBUGGEEWOULDRUN,
-        JSEXN_LIMIT
+    JSEXN_WARN,
+    JSEXN_LIMIT
 } JSExnType;
 
 typedef struct JSErrorFormatString {
      /** The error message name in ASCII. */
     const char* name;
 
     /** The error format string in ASCII. */
     const char* format;
--- a/js/src/jsexn.cpp
+++ b/js/src/jsexn.cpp
@@ -511,18 +511,18 @@ ErrorObject::createConstructor(JSContext
 
 JS_FRIEND_API(JSFlatString*)
 js::GetErrorTypeName(JSRuntime* rt, int16_t exnType)
 {
     /*
      * JSEXN_INTERNALERR returns null to prevent that "InternalError: "
      * is prepended before "uncaught exception: "
      */
-    if (exnType <= JSEXN_NONE || exnType >= JSEXN_LIMIT ||
-        exnType == JSEXN_INTERNALERR)
+    if (exnType < 0 || exnType >= JSEXN_LIMIT ||
+        exnType == JSEXN_INTERNALERR || exnType == JSEXN_WARN)
     {
         return nullptr;
     }
     JSProtoKey key = GetExceptionProtoKey(JSExnType(exnType));
     return ClassName(key, rt);
 }
 
 bool
@@ -541,23 +541,24 @@ js::ErrorToException(JSContext* cx, cons
     if (cx->runtime()->isSelfHostingCompartment(cx->compartment()))
         return false;
 
     // Find the exception index associated with this error.
     JSErrNum errorNumber = static_cast<JSErrNum>(reportp->errorNumber);
     if (!callback)
         callback = GetErrorMessage;
     const JSErrorFormatString* errorString = callback(userRef, errorNumber);
-    JSExnType exnType = errorString ? static_cast<JSExnType>(errorString->exnType) : JSEXN_NONE;
+    JSExnType exnType = errorString ? static_cast<JSExnType>(errorString->exnType) : JSEXN_ERR;
     MOZ_ASSERT(exnType < JSEXN_LIMIT);
 
-    // Return false (no exception raised) if no exception is associated
-    // with the given error number.
-    if (exnType == JSEXN_NONE)
-        return false;
+    if (exnType == JSEXN_WARN) {
+        // werror must be enabled, so we use JSEXN_ERR.
+        MOZ_ASSERT(cx->runtime()->options().werror());
+        exnType = JSEXN_ERR;
+    }
 
     // Prevent infinite recursion.
     if (cx->generatingError)
         return false;
     AutoScopedAssign<bool> asa(&cx->generatingError, true);
 
     // Create an exception object.
     RootedString messageStr(cx, reportp->ucmessage ? JS_NewUCStringCopyZ(cx, reportp->ucmessage)
@@ -627,19 +628,17 @@ 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);
-    if (type != JSEXN_NONE)
-        str = ClassName(GetExceptionProtoKey(type), cx);
+    RootedString str(cx, 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;
@@ -893,17 +892,17 @@ ErrorReport::init(JSContext* cx, HandleV
             cx->clearPendingException();
             column = 0;
         }
 
         reportp = &ownedReport;
         new (reportp) JSErrorReport();
         ownedReport.filename = filename.ptr();
         ownedReport.lineno = lineno;
-        ownedReport.exnType = int16_t(JSEXN_NONE);
+        ownedReport.exnType = JSEXN_INTERNALERR;
         ownedReport.column = column;
         if (str) {
             // Note that using |str| for |ucmessage| here is kind of wrong,
             // because |str| is supposed to be of the format
             // |ErrorName: ErrorMessage|, and |ucmessage| is supposed to
             // correspond to |ErrorMessage|. But this is what we've historically
             // done for duck-typed error objects.
             //
--- a/js/src/jsexn.h
+++ b/js/src/jsexn.h
@@ -90,35 +90,36 @@ static_assert(JSEXN_ERR == 0 &&
               JSProto_Error + JSEXN_INTERNALERR == JSProto_InternalError &&
               JSProto_Error + JSEXN_EVALERR == JSProto_EvalError &&
               JSProto_Error + JSEXN_RANGEERR == JSProto_RangeError &&
               JSProto_Error + JSEXN_REFERENCEERR == JSProto_ReferenceError &&
               JSProto_Error + JSEXN_SYNTAXERR == JSProto_SyntaxError &&
               JSProto_Error + JSEXN_TYPEERR == JSProto_TypeError &&
               JSProto_Error + JSEXN_URIERR == JSProto_URIError &&
               JSProto_Error + JSEXN_DEBUGGEEWOULDRUN == JSProto_DebuggeeWouldRun &&
-              JSEXN_DEBUGGEEWOULDRUN + 1 == JSEXN_LIMIT,
+              JSEXN_DEBUGGEEWOULDRUN + 1 == JSEXN_WARN &&
+              JSEXN_WARN + 1 == JSEXN_LIMIT,
               "GetExceptionProtoKey and ExnTypeFromProtoKey require that "
               "each corresponding JSExnType and JSProtoKey value be separated "
               "by the same constant value");
 
 static inline JSProtoKey
 GetExceptionProtoKey(JSExnType exn)
 {
     MOZ_ASSERT(JSEXN_ERR <= exn);
-    MOZ_ASSERT(exn < JSEXN_LIMIT);
+    MOZ_ASSERT(exn < JSEXN_WARN);
     return JSProtoKey(JSProto_Error + int(exn));
 }
 
 static inline JSExnType
 ExnTypeFromProtoKey(JSProtoKey key)
 {
     JSExnType type = static_cast<JSExnType>(key - JSProto_Error);
     MOZ_ASSERT(type >= JSEXN_ERR);
-    MOZ_ASSERT(type < JSEXN_LIMIT);
+    MOZ_ASSERT(type < JSEXN_WARN);
     return type;
 }
 
 class AutoClearPendingException
 {
     JSContext* cx;
 
   public:
--- a/js/src/jsshell.msg
+++ b/js/src/jsshell.msg
@@ -3,27 +3,24 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
 	Error messages for JSShell. See js.msg for format.
 */
 
-MSG_DEF(JSSMSG_NOT_AN_ERROR,            0, JSEXN_NONE, "<Error #0 is reserved>")
-MSG_DEF(JSSMSG_CANT_OPEN,               2, JSEXN_NONE, "can't open {0}: {1}")
-MSG_DEF(JSSMSG_TRAP_USAGE,              0, JSEXN_NONE, "usage: trap [fun] [pc] expr")
-MSG_DEF(JSSMSG_LINE2PC_USAGE,           0, JSEXN_NONE, "usage: line2pc [fun] line")
-MSG_DEF(JSSMSG_FILE_SCRIPTS_ONLY,       0, JSEXN_NONE, "only works on JS scripts read from files")
-MSG_DEF(JSSMSG_UNEXPECTED_EOF,          1, JSEXN_NONE, "unexpected EOF in {0}")
-MSG_DEF(JSSMSG_DOEXP_USAGE,             0, JSEXN_NONE, "usage: doexp obj id")
-MSG_DEF(JSSMSG_SCRIPTS_ONLY,            0, JSEXN_NONE, "only works on scripts")
-MSG_DEF(JSSMSG_NOT_ENOUGH_ARGS,         1, JSEXN_NONE, "{0}: not enough arguments")
-MSG_DEF(JSSMSG_TOO_MANY_ARGS,           1, JSEXN_NONE, "{0}: too many arguments")
-MSG_DEF(JSSMSG_ASSERT_EQ_FAILED,        2, JSEXN_NONE, "Assertion failed: got {0}, expected {1}")
-MSG_DEF(JSSMSG_ASSERT_EQ_FAILED_MSG,    3, JSEXN_NONE, "Assertion failed: got {0}, expected {1}: {2}")
-MSG_DEF(JSSMSG_INVALID_ARGS,            1, JSEXN_NONE, "{0}: invalid arguments")
-MSG_DEF(JSSMSG_BAD_ALIGNMENT,           0, JSEXN_NONE, "serialized data must be 8-byte-aligned")
-MSG_DEF(JSSMSG_BAD_ENV_VAR,             1, JSEXN_NONE, "unable to read getenv({0})")
-MSG_DEF(JSSMSG_NESTED_FAIL,             0, JSEXN_NONE, "error executing nested JS shell")
-MSG_DEF(JSSMSG_CACHE_EQ_SIZE_FAILED,    2, JSEXN_NONE, "cache does not have the same size: got {0}, expected {1}")
-MSG_DEF(JSSMSG_CACHE_EQ_CONTENT_FAILED, 0, JSEXN_NONE, "cache does not have the same content.")
-MSG_DEF(JSSMSG_CACHE_SINGLETON_FAILED,  0, JSEXN_NONE, "compartment cannot save singleton anymore.")
+MSG_DEF(JSSMSG_NOT_AN_ERROR,            0, JSEXN_ERR, "<Error #0 is reserved>")
+MSG_DEF(JSSMSG_CANT_OPEN,               2, JSEXN_ERR, "can't open {0}: {1}")
+MSG_DEF(JSSMSG_LINE2PC_USAGE,           0, JSEXN_ERR, "usage: line2pc [fun] line")
+MSG_DEF(JSSMSG_FILE_SCRIPTS_ONLY,       0, JSEXN_ERR, "only works on JS scripts read from files")
+MSG_DEF(JSSMSG_UNEXPECTED_EOF,          1, JSEXN_ERR, "unexpected EOF in {0}")
+MSG_DEF(JSSMSG_SCRIPTS_ONLY,            0, JSEXN_ERR, "only works on scripts")
+MSG_DEF(JSSMSG_NOT_ENOUGH_ARGS,         1, JSEXN_ERR, "{0}: not enough arguments")
+MSG_DEF(JSSMSG_TOO_MANY_ARGS,           1, JSEXN_ERR, "{0}: too many arguments")
+MSG_DEF(JSSMSG_ASSERT_EQ_FAILED,        2, JSEXN_ERR, "Assertion failed: got {0}, expected {1}")
+MSG_DEF(JSSMSG_ASSERT_EQ_FAILED_MSG,    3, JSEXN_ERR, "Assertion failed: got {0}, expected {1}: {2}")
+MSG_DEF(JSSMSG_INVALID_ARGS,            1, JSEXN_ERR, "{0}: invalid arguments")
+MSG_DEF(JSSMSG_BAD_ALIGNMENT,           0, JSEXN_ERR, "serialized data must be 8-byte-aligned")
+MSG_DEF(JSSMSG_NESTED_FAIL,             0, JSEXN_ERR, "error executing nested JS shell")
+MSG_DEF(JSSMSG_CACHE_EQ_SIZE_FAILED,    2, JSEXN_ERR, "cache does not have the same size: got {0}, expected {1}")
+MSG_DEF(JSSMSG_CACHE_EQ_CONTENT_FAILED, 0, JSEXN_ERR, "cache does not have the same content.")
+MSG_DEF(JSSMSG_CACHE_SINGLETON_FAILED,  0, JSEXN_ERR, "compartment cannot save singleton anymore.")
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -5849,18 +5849,18 @@ js::shell::my_GetErrorMessage(void* user
 static bool
 CreateLastWarningObject(JSContext* cx, JSErrorReport* report)
 {
     RootedObject warningObj(cx, JS_NewObject(cx, nullptr));
     if (!warningObj)
         return false;
 
     RootedString nameStr(cx);
-    if (report->exnType == JSEXN_NONE)
-        nameStr = JS_NewStringCopyZ(cx, "None");
+    if (report->exnType == JSEXN_WARN)
+        nameStr = JS_NewStringCopyZ(cx, "Warning");
     else
         nameStr = GetErrorTypeName(cx->runtime(), report->exnType);
     if (!nameStr)
         return false;
     RootedValue nameVal(cx, StringValue(nameStr));
     if (!DefineProperty(cx, warningObj, cx->names().name, nameVal))
         return false;
 
@@ -5953,17 +5953,17 @@ js::shell::my_ErrorReporter(JSContext* c
     (void) PrintError(cx, fp, message, report, reportWarnings);
     if (!exn.isUndefined()) {
         JS::AutoSaveExceptionState savedExc(cx);
         if (!PrintStackTrace(cx, exn))
             fputs("(Unable to print stack trace)\n", fp);
         savedExc.restore();
     }
 
-    if (report->exnType != JSEXN_NONE && !JSREPORT_IS_WARNING(report->flags)) {
+    if (!JSREPORT_IS_WARNING(report->flags)) {
         if (report->errorNumber == JSMSG_OUT_OF_MEMORY)
             sr->exitCode = EXITCODE_OUT_OF_MEMORY;
         else
             sr->exitCode = EXITCODE_RUNTIME_ERROR;
     }
 }
 
 static bool
--- a/js/src/tests/shell/warning.js
+++ b/js/src/tests/shell/warning.js
@@ -1,24 +1,24 @@
 // |reftest| skip-if(!xulRuntime.shell)
 
 var BUGNUMBER = 1170716;
 var summary = 'Add js shell functions to get last warning';
 
 print(BUGNUMBER + ": " + summary);
 
-// Warning with JSEXN_NONE.
+// Warning with JSEXN_WARN.
 
 enableLastWarning();
 
 eval(`{ function f() {} function f() {} }`);
 
 var warning = getLastWarning();
 assertEq(warning !== null, true);
-assertEq(warning.name, "None");
+assertEq(warning.name, "Warning");
 assertEq(warning.message.includes("deprecated"), true);
 assertEq(warning.lineNumber, 1);
 assertEq(warning.columnNumber, 27);
 
 // Clear last warning.
 
 clearLastWarning();
 warning = getLastWarning();
--- a/js/src/vm/ErrorObject.h
+++ b/js/src/vm/ErrorObject.h
@@ -55,18 +55,17 @@ class ErrorObject : public NativeObject
     static const uint32_t MESSAGE_SLOT          = COLUMNNUMBER_SLOT + 1;
 
     static const uint32_t RESERVED_SLOTS = MESSAGE_SLOT + 1;
 
   public:
     static const Class classes[JSEXN_LIMIT];
 
     static const Class * classForType(JSExnType type) {
-        MOZ_ASSERT(type != JSEXN_NONE);
-        MOZ_ASSERT(type < JSEXN_LIMIT);
+        MOZ_ASSERT(type < JSEXN_WARN);
         return &classes[type];
     }
 
     static bool isErrorClass(const Class* clasp) {
         return &classes[0] <= clasp && clasp < &classes[0] + mozilla::ArrayLength(classes);
     }
 
     // Create an error of the given type corresponding to the provided location
--- a/js/xpconnect/src/jsshell.msg
+++ b/js/xpconnect/src/jsshell.msg
@@ -3,15 +3,10 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
 	Error messages for JSShell. See js.msg for format.
 */
 
-MSG_DEF(JSSMSG_NOT_AN_ERROR,             0, 0, JSEXN_NONE, "<Error #0 is reserved>")
-MSG_DEF(JSSMSG_CANT_OPEN,                1, 2, JSEXN_NONE, "can't open {0}: {1}") 
-MSG_DEF(JSSMSG_TRAP_USAGE,               2, 0, JSEXN_NONE, "usage: trap [fun] [pc] expr") 
-MSG_DEF(JSSMSG_LINE2PC_USAGE,            3, 0, JSEXN_NONE, "usage: line2pc [fun] line") 
-MSG_DEF(JSSMSG_FILE_SCRIPTS_ONLY,        4, 0, JSEXN_NONE, "only works on JS scripts read from files") 
-MSG_DEF(JSSMSG_UNEXPECTED_EOF,           5, 1, JSEXN_NONE, "unexpected EOF in {0}") 
-MSG_DEF(JSSMSG_DOEXP_USAGE,              6, 0, JSEXN_NONE, "usage: doexp obj id") 
+MSG_DEF(JSSMSG_NOT_AN_ERROR,             0, 0, JSEXN_ERR, "<Error #0 is reserved>")
+MSG_DEF(JSSMSG_CANT_OPEN,                1, 2, JSEXN_ERR, "can't open {0}: {1}")