Index: Source/bindings/v8/V8ErrorHandler.cpp |
diff --git a/Source/bindings/v8/V8ErrorHandler.cpp b/Source/bindings/v8/V8ErrorHandler.cpp |
index 8f8b7c2cde57cac8645d7405a760ad79c659b0d8..f49ea06122253e8ea74b794f2c4b80ef71681f9b 100644 |
--- a/Source/bindings/v8/V8ErrorHandler.cpp |
+++ b/Source/bindings/v8/V8ErrorHandler.cpp |
@@ -31,12 +31,16 @@ |
#include "config.h" |
#include "bindings/v8/V8ErrorHandler.h" |
+#include "V8ErrorEvent.h" |
#include "bindings/v8/ScriptController.h" |
#include "bindings/v8/V8Binding.h" |
#include "bindings/v8/V8HiddenPropertyName.h" |
#include "bindings/v8/V8ScriptRunner.h" |
+#include "core/dom/Document.h" |
#include "core/dom/ErrorEvent.h" |
#include "core/dom/EventNames.h" |
+#include "core/dom/ScriptExecutionContext.h" |
+#include "core/page/Frame.h" |
namespace WebCore { |
@@ -73,6 +77,25 @@ v8::Local<v8::Value> V8ErrorHandler::callListenerFunction(ScriptExecutionContext |
return returnValue; |
} |
+// static |
+void V8ErrorHandler::storeExceptionOnErrorEventWrapper(ScriptExecutionContext* context, ErrorEvent* event, v8::Handle<v8::Value> data, v8::Isolate* isolate) |
+{ |
+ if (context->isDocument()) { |
+ // This method might be called while we're creating a new context. Since we |
adamk
2013/08/09 17:11:32
Why move this code? It seems like it would work fi
Mike West
2013/08/09 20:34:51
It seemed better to have one spot where the wrappi
adamk
2013/08/09 21:29:25
I'm confused: I'm suggesting sharing the wrapping/
Mike West
2013/08/09 21:38:45
Ah, sorry. I thought you were asking "Why move all
|
+ // cannot create a wrapper during context creation, we bail out early. |
+ DOMWrapperWorld* world = DOMWrapperWorld::current(); |
+ Frame* frame = toDocument(context)->frame(); |
+ if (!world || !frame || !frame->script()->existingWindowShell(world)) |
+ return; |
+ } |
+ |
+ v8::Local<v8::Value> wrappedEvent = toV8(event, v8::Handle<v8::Object>(), isolate); |
+ if (!wrappedEvent.IsEmpty()) { |
+ ASSERT(wrappedEvent->IsObject()); |
+ v8::Local<v8::Object>::Cast(wrappedEvent)->SetHiddenValue(V8HiddenPropertyName::error(), data); |
+ } |
+} |
+ |
bool V8ErrorHandler::shouldPreventDefault(v8::Local<v8::Value> returnValue) |
{ |
return returnValue->IsBoolean() && returnValue->BooleanValue(); |