mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 23:05:42 +00:00
Bug 1274922 part 5 - Remove JSEXN_NONE and add JSEXN_WARN. r=jorendorff
This commit is contained in:
parent
1543ead04a
commit
847b10eeb0
@ -5928,7 +5928,7 @@ WorkerPrivate::ReportError(JSContext* aCx, const char* aFallbackMessage,
|
||||
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 {
|
||||
|
@ -9,7 +9,7 @@
|
||||
* 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}")
|
||||
|
@ -5,7 +5,7 @@ function testWarn(code, lineNumber, columnNumber) {
|
||||
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);
|
||||
|
||||
@ -13,7 +13,7 @@ function testWarn(code, lineNumber, columnNumber) {
|
||||
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();
|
||||
|
@ -15,7 +15,7 @@ function testWarn(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)');
|
||||
@ -28,7 +28,7 @@ function testWarn(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);');
|
||||
|
@ -41,7 +41,7 @@
|
||||
* "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}")
|
||||
@ -71,7 +71,7 @@ MSG_DEF(JSMSG_UNDEFINED_PROP, 1, JSEXN_REFERENCEERR, "reference to unde
|
||||
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}")
|
||||
@ -92,7 +92,7 @@ MSG_DEF(JSMSG_BAD_GET_SET_FIELD, 1, JSEXN_TYPEERR, "property descriptor's
|
||||
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}")
|
||||
@ -235,11 +235,11 @@ MSG_DEF(JSMSG_CURLY_IN_COMPOUND, 0, JSEXN_SYNTAXERR, "missing } in compoun
|
||||
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")
|
||||
@ -305,7 +305,7 @@ MSG_DEF(JSMSG_SEMI_AFTER_FOR_COND, 0, JSEXN_SYNTAXERR, "missing ; after for-
|
||||
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}")
|
||||
@ -338,7 +338,7 @@ MSG_DEF(JSMSG_ESCAPED_KEYWORD, 0, JSEXN_SYNTAXERR, "keywords must be wri
|
||||
// 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}")
|
||||
|
@ -624,11 +624,14 @@ typedef void
|
||||
/**
|
||||
* 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,
|
||||
@ -637,7 +640,8 @@ typedef enum JSExnType {
|
||||
JSEXN_TYPEERR,
|
||||
JSEXN_URIERR,
|
||||
JSEXN_DEBUGGEEWOULDRUN,
|
||||
JSEXN_LIMIT
|
||||
JSEXN_WARN,
|
||||
JSEXN_LIMIT
|
||||
} JSExnType;
|
||||
|
||||
typedef struct JSErrorFormatString {
|
||||
|
@ -516,8 +516,8 @@ 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;
|
||||
}
|
||||
@ -546,13 +546,14 @@ js::ErrorToException(JSContext* cx, const char* message, JSErrorReport* reportp,
|
||||
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)
|
||||
@ -632,9 +633,7 @@ ErrorReportToString(JSContext* cx, JSErrorReport* reportp)
|
||||
* 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.
|
||||
@ -898,7 +897,7 @@ ErrorReport::init(JSContext* cx, HandleValue exn,
|
||||
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,
|
||||
|
@ -95,7 +95,8 @@ static_assert(JSEXN_ERR == 0 &&
|
||||
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");
|
||||
@ -104,7 +105,7 @@ 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));
|
||||
}
|
||||
|
||||
@ -113,7 +114,7 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -8,22 +8,19 @@
|
||||
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.")
|
||||
|
@ -5854,8 +5854,8 @@ CreateLastWarningObject(JSContext* cx, JSErrorReport* report)
|
||||
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)
|
||||
@ -5958,7 +5958,7 @@ js::shell::my_ErrorReporter(JSContext* cx, const char* message, JSErrorReport* r
|
||||
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
|
||||
|
@ -5,7 +5,7 @@ var summary = 'Add js shell functions to get last warning';
|
||||
|
||||
print(BUGNUMBER + ": " + summary);
|
||||
|
||||
// Warning with JSEXN_NONE.
|
||||
// Warning with JSEXN_WARN.
|
||||
|
||||
enableLastWarning();
|
||||
|
||||
@ -13,7 +13,7 @@ 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);
|
||||
|
@ -60,8 +60,7 @@ class ErrorObject : public NativeObject
|
||||
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];
|
||||
}
|
||||
|
||||
|
@ -8,10 +8,5 @@
|
||||
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}")
|
||||
|
Loading…
Reference in New Issue
Block a user