Index: Source/core/events/MessageEvent.cpp |
diff --git a/Source/core/events/MessageEvent.cpp b/Source/core/events/MessageEvent.cpp |
index 651cec4e62fb6d0b2bc23ca05f7f553470d28148..50fe9e2229270924b14298657435a1fbbed7d3bf 100644 |
--- a/Source/core/events/MessageEvent.cpp |
+++ b/Source/core/events/MessageEvent.cpp |
@@ -28,6 +28,7 @@ |
#include "config.h" |
#include "core/events/MessageEvent.h" |
+#include "bindings/v8/ExceptionMessages.h" |
#include "core/events/ThreadLocalEventNames.h" |
#include "core/frame/DOMWindow.h" |
@@ -133,6 +134,15 @@ MessageEvent::~MessageEvent() |
{ |
} |
+PassRefPtr<MessageEvent> MessageEvent::create(const AtomicString& type, const MessageEventInit& initializer, ExceptionState& exceptionState) |
+{ |
+ if (initializer.source.get() && !isValidSource(initializer.source.get())) { |
+ exceptionState.throwTypeError(ExceptionMessages::failedToConstruct("MessageEvent", "The optional 'source' property is neither a Window nor MessagePort.")); |
+ return 0; |
+ } |
+ return adoptRef(new MessageEvent(type, initializer)); |
+} |
+ |
void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray> ports) |
{ |
if (dispatched()) |