Chromium Code Reviews| Index: Source/bindings/v8/V8Initializer.cpp |
| diff --git a/Source/bindings/v8/V8Initializer.cpp b/Source/bindings/v8/V8Initializer.cpp |
| index f7c7343ae81ee4bfd31c1c2f16418f25e6ba0708..1f71663a3c219601f7a4ceb0dcd6c2f27ecf0965 100644 |
| --- a/Source/bindings/v8/V8Initializer.cpp |
| +++ b/Source/bindings/v8/V8Initializer.cpp |
| @@ -41,11 +41,11 @@ |
| #include "bindings/v8/V8PerContextData.h" |
| #include "core/dom/Document.h" |
| #include "core/dom/ExceptionCode.h" |
| -#include "core/inspector/ScriptCallStack.h" |
| #include "core/frame/ConsoleTypes.h" |
| #include "core/frame/ContentSecurityPolicy.h" |
| #include "core/frame/DOMWindow.h" |
| #include "core/frame/Frame.h" |
| +#include "core/inspector/ScriptCallStack.h" |
| #include "public/platform/Platform.h" |
| #include "wtf/RefPtr.h" |
| #include "wtf/text/WTFString.h" |
| @@ -84,6 +84,8 @@ static void reportFatalErrorInMainThread(const char* location, const char* messa |
| static void messageHandlerInMainThread(v8::Handle<v8::Message> message, v8::Handle<v8::Value> data) |
| { |
| + // See v8/src/isolate.c |
| + static const char stackOverFlowMessageString[] = "Uncaught RangeError: Maximum call stack size exceeded"; |
|
haraken
2014/02/21 04:19:21
Can we share code with handleMaxRecursionDepthExec
yhirano
2014/02/21 07:32:51
Done.
|
| v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| // If called during context initialization, there will be no entered context. |
| v8::Handle<v8::Context> enteredContext = isolate->GetEnteredContext(); |
| @@ -95,11 +97,13 @@ static void messageHandlerInMainThread(v8::Handle<v8::Message> message, v8::Hand |
| return; |
| String errorMessage = toCoreString(message->Get()); |
| + const bool isStackOverFlowException = errorMessage == stackOverFlowMessageString; |
| v8::Handle<v8::StackTrace> stackTrace = message->GetStackTrace(); |
| RefPtr<ScriptCallStack> callStack; |
| + // When the message consists of a stack over flow exception its stack trace is invalid. |
| // Currently stack trace is only collected when inspector is open. |
| - if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) |
| + if (!isStackOverFlowException && !stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) |
| callStack = createScriptCallStack(stackTrace, ScriptCallStack::maxCallStackSizeToCapture, isolate); |
| v8::Handle<v8::Value> resourceName = message->GetScriptResourceName(); |