Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(340)

Unified Diff: Source/core/events/MessageEvent.cpp

Issue 85263002: Improve handling of dictionary conversions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Have conversion methods take a context argument; elaborate error msgs further. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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())

Powered by Google App Engine
This is Rietveld 408576698