Index: Source/bindings/v8/V8Initializer.cpp |
diff --git a/Source/bindings/v8/V8Initializer.cpp b/Source/bindings/v8/V8Initializer.cpp |
index d2e2d9c26a1e2b149bc5fc1e486d06d518e791fe..3da868f2307fb9947d03f2a907d0aead5c6d2607 100644 |
--- a/Source/bindings/v8/V8Initializer.cpp |
+++ b/Source/bindings/v8/V8Initializer.cpp |
@@ -26,6 +26,7 @@ |
#include "config.h" |
#include "bindings/v8/V8Initializer.h" |
+#include "V8DOMException.h" |
#include "V8ErrorEvent.h" |
#include "V8History.h" |
#include "V8Location.h" |
@@ -99,9 +100,19 @@ static void messageHandlerInMainThread(v8::Handle<v8::Message> message, v8::Hand |
v8::Handle<v8::Value> resourceName = message->GetScriptResourceName(); |
bool shouldUseDocumentURL = resourceName.IsEmpty() || !resourceName->IsString(); |
String resource = shouldUseDocumentURL ? firstWindow->document()->url() : toWebCoreString(resourceName); |
- RefPtr<ErrorEvent> event = ErrorEvent::create(errorMessage, resource, message->GetLineNumber(), message->GetStartColumn()); |
AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? SharableCrossOrigin : NotSharableCrossOrigin; |
+ RefPtr<ErrorEvent> event = ErrorEvent::create(errorMessage, resource, message->GetLineNumber(), message->GetStartColumn()); |
+ if (V8DOMWrapper::isDOMWrapper(data)) { |
+ v8::Handle<v8::Object> obj = v8::Handle<v8::Object>::Cast(data); |
+ WrapperTypeInfo* type = toWrapperTypeInfo(obj); |
+ if (V8DOMException::info.isSubclass(type)) { |
+ DOMException* exception = V8DOMException::toNative(obj); |
+ if (exception && !exception->messageForConsole().isEmpty()) |
+ event->setUnsanitizedMessage("Uncaught " + exception->toStringForConsole()); |
+ } |
+ } |
+ |
// This method might be called while we're creating a new context. In this case, we |
// avoid storing the exception object, as we can't create a wrapper during context creation. |
DOMWrapperWorld* world = DOMWrapperWorld::current(); |