Index: Source/bindings/core/v8/V8ThrowException.cpp |
diff --git a/Source/bindings/core/v8/V8ThrowException.cpp b/Source/bindings/core/v8/V8ThrowException.cpp |
index 13be07f40bc91f1c7f5d9f48e710c7875800dd9b..0e66afcab65787bcfc324dc57955b3fc9bd0f5da 100644 |
--- a/Source/bindings/core/v8/V8ThrowException.cpp |
+++ b/Source/bindings/core/v8/V8ThrowException.cpp |
@@ -70,12 +70,16 @@ v8::Handle<v8::Value> V8ThrowException::createDOMException(v8::Isolate* isolate, |
if (!frame || !BindingSecurity::shouldAllowAccessToFrame(isolate, frame, DoNotReportSecurityError)) |
sanitizedCreationContext = isolate->GetCurrentContext()->Global(); |
+ v8::TryCatch tryCatch; |
RefPtrWillBeRawPtr<DOMException> domException = DOMException::create(ec, sanitizedMessage, unsanitizedMessage); |
v8::Handle<v8::Value> exception = toV8(domException.get(), sanitizedCreationContext, isolate); |
- if (exception.IsEmpty()) |
- return v8Undefined(); |
+ if (tryCatch.HasCaught()) { |
+ ASSERT(exception.IsEmpty()); |
+ return tryCatch.Exception(); |
+ } |
+ ASSERT(!exception.IsEmpty()); |
// Attach an Error object to the DOMException. This is then lazily used to get the stack value. |
v8::Handle<v8::Value> error = v8::Exception::Error(v8String(isolate, domException->message())); |