| Index: src/messages.js
|
| diff --git a/src/messages.js b/src/messages.js
|
| index ca2da30472effb406677e912e6e6225dd5a175e7..e26a7440edb106c1e6bd1c700d65359c8a7306fb 100644
|
| --- a/src/messages.js
|
| +++ b/src/messages.js
|
| @@ -129,10 +129,10 @@ var kMessages = {
|
| invalid_data_view_length: ["Invalid data view length"],
|
| invalid_data_view_accessor_offset:
|
| ["Offset is outside the bounds of the DataView"],
|
| -
|
| - stack_overflow: ["Maximum call stack size exceeded"],
|
| invalid_time_value: ["Invalid time value"],
|
| invalid_count_value: ["Invalid count value"],
|
| + // StackOverflowError
|
| + stack_overflow: ["Maximum call stack size exceeded"],
|
| // SyntaxError
|
| paren_in_arg_string: ["Function arg string contains parenthesis"],
|
| not_isvar: ["builtin %IS_VAR: not a variable"],
|
| @@ -252,6 +252,7 @@ function CanBeSafelyTreatedAsAnErrorObject(obj) {
|
| case 'SyntaxError':
|
| case 'TypeError':
|
| case 'URIError':
|
| + case 'StackOverflowError':
|
| return true;
|
| }
|
|
|
| @@ -345,6 +346,11 @@ function MakeRangeError(type, args) {
|
| }
|
|
|
|
|
| +function MakeStackOverflowError() {
|
| + return MakeGenericError($StackOverflowError, 'stack_overflow', []);
|
| +}
|
| +
|
| +
|
| function MakeSyntaxError(type, args) {
|
| return MakeGenericError($SyntaxError, type, args);
|
| }
|
| @@ -1187,7 +1193,7 @@ function captureStackTrace(obj, cons_opt) {
|
| function SetUpError() {
|
| // Define special error type constructors.
|
|
|
| - var DefineError = function(f) {
|
| + var DefineError = function(f, error_type) {
|
| // Store the error function in both the global object
|
| // and the runtime object. The function is fetched
|
| // from the runtime object when throwing errors from
|
| @@ -1195,7 +1201,9 @@ function SetUpError() {
|
| // effects when overwriting the error functions from
|
| // user code.
|
| var name = f.name;
|
| - %SetProperty(global, name, f, DONT_ENUM);
|
| + if (name != 'StackOverflowError') { // StackOverflowError is not in spec.
|
| + %SetProperty(global, name, f, DONT_ENUM);
|
| + }
|
| %SetProperty(builtins, '$' + name, f, DONT_ENUM | DONT_DELETE | READ_ONLY);
|
| // Configure the error function.
|
| if (name == 'Error') {
|
| @@ -1207,6 +1215,9 @@ function SetUpError() {
|
| %FunctionSetPrototype(ErrorPrototype, $Object.prototype);
|
| %FunctionSetInstanceClassName(ErrorPrototype, 'Error');
|
| %FunctionSetPrototype(f, new ErrorPrototype());
|
| + } else if (name == 'StackOverflowError') {
|
| + // StackOverflowError extends RangeError for backward compatibility.
|
| + %FunctionSetPrototype(f, new $RangeError());
|
| } else {
|
| %FunctionSetPrototype(f, new $Error());
|
| }
|
| @@ -1223,6 +1234,9 @@ function SetUpError() {
|
| %IgnoreAttributesAndSetProperty(
|
| this, 'message', ToString(m), DONT_ENUM);
|
| }
|
| + // Define error_type property as a private symbol.
|
| + %IgnoreAttributesAndSetProperty(
|
| + this, error_type_symbol, error_type, READ_ONLY | DONT_DELETE);
|
| captureStackTrace(this, f);
|
| } else {
|
| return new f(m);
|
| @@ -1231,13 +1245,14 @@ function SetUpError() {
|
| %SetNativeFlag(f);
|
| };
|
|
|
| - DefineError(function Error() { });
|
| - DefineError(function TypeError() { });
|
| - DefineError(function RangeError() { });
|
| - DefineError(function SyntaxError() { });
|
| - DefineError(function ReferenceError() { });
|
| - DefineError(function EvalError() { });
|
| - DefineError(function URIError() { });
|
| + DefineError(function Error() { }, kError);
|
| + DefineError(function TypeError() { }, kTypeError);
|
| + DefineError(function RangeError() { }, kRangeError);
|
| + DefineError(function SyntaxError() { }, kSyntaxError);
|
| + DefineError(function ReferenceError() { }, kReferenceError);
|
| + DefineError(function EvalError() { }, kEvalError);
|
| + DefineError(function URIError() { }, kURIError);
|
| + DefineError(function StackOverflowError() { }, kStackOverflowError);
|
| }
|
|
|
| SetUpError();
|
| @@ -1314,7 +1329,7 @@ InstallFunctions($Error.prototype, DONT_ENUM, ['toString', ErrorToString]);
|
| // Boilerplate for exceptions for stack overflows. Used from
|
| // Isolate::StackOverflow().
|
| function SetUpStackOverflowBoilerplate() {
|
| - var boilerplate = MakeRangeError('stack_overflow', []);
|
| + var boilerplate = MakeStackOverflowError();
|
|
|
| var error_string = boilerplate.name + ": " + boilerplate.message;
|
|
|
|
|