Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Unified Diff: src/messages.js

Issue 292173011: Harden a few builtins (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: refactored Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/macros.py ('k') | src/objects.cc » ('j') | src/uri.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/messages.js
diff --git a/src/messages.js b/src/messages.js
index d20b34b07e26e587ef9e9e1e03637750fb1f8e33..44ae4b8c849dcb748d44c21f986bd026489a792b 100644
--- a/src/messages.js
+++ b/src/messages.js
@@ -162,7 +162,9 @@ var kMessages = {
symbol_to_primitive: ["Cannot convert a Symbol wrapper object to a primitive value"],
invalid_module_path: ["Module does not export '", "%0", "', or export is not itself a module"],
module_type_error: ["Module '", "%0", "' used improperly"],
- module_export_undefined: ["Export '", "%0", "' is not defined in module"]
+ module_export_undefined: ["Export '", "%0", "' is not defined in module"],
+ // Internal error.
+ internal_error: ["Internal error"]
};
@@ -349,6 +351,11 @@ function MakeError(type, args) {
return MakeGenericError($Error, type, args);
}
+
+function MakeInternalError() {
+ return MakeGenericError($InternalError, "internal_error");
+}
+
/**
* Find a line number given a specific source position.
* @param {number} position The source position.
@@ -1184,7 +1191,7 @@ function SetUpError() {
%SetProperty(global, name, f, DONT_ENUM);
%SetProperty(builtins, '$' + name, f, DONT_ENUM | DONT_DELETE | READ_ONLY);
// Configure the error function.
- if (name == 'Error') {
+ if (name === 'Error') {
// The prototype of the Error object must itself be an error.
// However, it can't be an instance of the Error object because
// it hasn't been properly configured yet. Instead we create a
@@ -1193,7 +1200,7 @@ function SetUpError() {
%FunctionSetPrototype(ErrorPrototype, $Object.prototype);
%FunctionSetInstanceClassName(ErrorPrototype, 'Error');
%FunctionSetPrototype(f, new ErrorPrototype());
- } else {
+ } else if (name !== 'InternalError') {
%FunctionSetPrototype(f, new $Error());
}
%FunctionSetInstanceClassName(f, 'Error');
@@ -1224,6 +1231,7 @@ function SetUpError() {
DefineError(function ReferenceError() { });
DefineError(function EvalError() { });
DefineError(function URIError() { });
+ DefineError(function InternalError() { });
}
SetUpError();
« no previous file with comments | « src/macros.py ('k') | src/objects.cc » ('j') | src/uri.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698