Index: src/messages.js |
diff --git a/src/messages.js b/src/messages.js |
index 8d79dac43225931eb1800bde5f2b54feead2f92b..cc87c20c4fe192dedda6ffb98165108a31f0ba3d 100644 |
--- a/src/messages.js |
+++ b/src/messages.js |
@@ -27,6 +27,9 @@ |
var MakeSyntaxError; |
var MakeTypeError; |
var MakeURIError; |
+var MakeReferenceErrorEmbedded; |
+var MakeSyntaxErrorEmbedded; |
+var MakeTypeErrorEmbedded; |
(function(global, utils) { |
@@ -37,17 +40,12 @@ |
var GlobalObject = global.Object; |
var InternalArray = utils.InternalArray; |
-var ObjectDefineProperty = utils.ObjectDefineProperty; |
- |
-var ArrayJoin; |
-var ObjectToString; |
+ |
var StringCharAt; |
var StringIndexOf; |
var StringSubstring; |
utils.Import(function(from) { |
- ArrayJoin = from.ArrayJoin; |
- ObjectToString = from.ObjectToString; |
StringCharAt = from.StringCharAt; |
StringIndexOf = from.StringIndexOf; |
StringSubstring = from.StringSubstring; |
@@ -87,7 +85,7 @@ |
} |
if (IS_SYMBOL(obj)) return %_CallFunction(obj, $symbolToString); |
if (IS_OBJECT(obj) |
- && %GetDataProperty(obj, "toString") === ObjectToString) { |
+ && %GetDataProperty(obj, "toString") === $objectToString) { |
var constructor = %GetDataProperty(obj, "constructor"); |
if (typeof constructor == "function") { |
var constructorName = constructor.name; |
@@ -139,7 +137,7 @@ |
function ToDetailString(obj) { |
- if (obj != null && IS_OBJECT(obj) && obj.toString === ObjectToString) { |
+ if (obj != null && IS_OBJECT(obj) && obj.toString === $objectToString) { |
var constructor = obj.constructor; |
if (typeof constructor == "function") { |
var constructorName = constructor.name; |
@@ -411,7 +409,7 @@ |
} |
-utils.SetUpLockedPrototype(Script, [ |
+$setUpLockedPrototype(Script, [ |
"source", |
"name", |
"source_url", |
@@ -475,7 +473,7 @@ |
} |
-utils.SetUpLockedPrototype(SourceLocation, |
+$setUpLockedPrototype(SourceLocation, |
["script", "position", "line", "column", "start", "end"], |
["sourceText", SourceLocationSourceText] |
); |
@@ -519,7 +517,7 @@ |
StringSubstring); |
} |
-utils.SetUpLockedPrototype(SourceSlice, |
+$setUpLockedPrototype(SourceSlice, |
["script", "from_line", "to_line", "from_position", "to_position"], |
["sourceText", SourceSliceSourceText] |
); |
@@ -717,7 +715,7 @@ |
return line; |
} |
-utils.SetUpLockedPrototype(CallSite, ["receiver", "fun", "pos"], [ |
+$setUpLockedPrototype(CallSite, ["receiver", "fun", "pos"], [ |
"getThis", CallSiteGetThis, |
"getTypeName", CallSiteGetTypeName, |
"isToplevel", CallSiteIsToplevel, |
@@ -844,7 +842,7 @@ |
} |
lines.push(" at " + line); |
} |
- return %_CallFunction(lines, "\n", ArrayJoin); |
+ return %_CallFunction(lines, "\n", $arrayJoin); |
} |
@@ -904,7 +902,13 @@ |
// Use a dummy function since we do not actually want to capture a stack trace |
// when constructing the initial Error prototytpes. |
-var captureStackTrace = function() {}; |
+var captureStackTrace = function captureStackTrace(obj, cons_opt) { |
+ // Define accessors first, as this may fail and throw. |
+ $objectDefineProperty(obj, 'stack', { get: StackTraceGetter, |
+ set: StackTraceSetter, |
+ configurable: true }); |
+ %CollectStackTrace(obj, cons_opt ? cons_opt : captureStackTrace); |
+} |
// Define special error type constructors. |
@@ -959,6 +963,9 @@ |
GlobalTypeError = DefineError(global, function TypeError() { }); |
GlobalURIError = DefineError(global, function URIError() { }); |
+ |
+GlobalError.captureStackTrace = captureStackTrace; |
+ |
%AddNamedProperty(GlobalError.prototype, 'message', '', DONT_ENUM); |
// Global list of error objects visited during ErrorToString. This is |
@@ -1023,8 +1030,8 @@ |
} |
} |
-utils.InstallFunctions(GlobalError.prototype, DONT_ENUM, |
- ['toString', ErrorToString]); |
+$installFunctions(GlobalError.prototype, DONT_ENUM, |
+ ['toString', ErrorToString]); |
$errorToString = ErrorToString; |
$getStackTraceLine = GetStackTraceLine; |
@@ -1070,22 +1077,10 @@ |
return MakeGenericError(GlobalURIError, kURIMalformed); |
} |
-// Boilerplate for exceptions for stack overflows. Used from |
-// Isolate::StackOverflow(). |
+//Boilerplate for exceptions for stack overflows. Used from |
+//Isolate::StackOverflow(). |
$stackOverflowBoilerplate = MakeRangeError(kStackOverflow); |
%DefineAccessorPropertyUnchecked($stackOverflowBoilerplate, 'stack', |
- StackTraceGetter, StackTraceSetter, |
- DONT_ENUM); |
- |
-// Define actual captureStackTrace function after everything has been set up. |
-captureStackTrace = function captureStackTrace(obj, cons_opt) { |
- // Define accessors first, as this may fail and throw. |
- ObjectDefineProperty(obj, 'stack', { get: StackTraceGetter, |
- set: StackTraceSetter, |
- configurable: true }); |
- %CollectStackTrace(obj, cons_opt ? cons_opt : captureStackTrace); |
-}; |
- |
-GlobalError.captureStackTrace = captureStackTrace; |
- |
-}); |
+ StackTraceGetter, StackTraceSetter, DONT_ENUM); |
+ |
+}) |