Index: Source/web/WebDOMMessageEvent.cpp |
diff --git a/Source/web/WebDOMMessageEvent.cpp b/Source/web/WebDOMMessageEvent.cpp |
index 573ae5495198011867ed41ef341f4c9b3239de4f..61a70a1e46833bc28dc7f2b02d10cbc7b5c96406 100644 |
--- a/Source/web/WebDOMMessageEvent.cpp |
+++ b/Source/web/WebDOMMessageEvent.cpp |
@@ -37,12 +37,30 @@ |
#include "core/events/MessageEvent.h" |
#include "core/frame/LocalDOMWindow.h" |
#include "public/platform/WebString.h" |
+#include "public/web/WebDocument.h" |
#include "public/web/WebFrame.h" |
#include "public/web/WebSerializedScriptValue.h" |
#include "web/WebLocalFrameImpl.h" |
namespace blink { |
+void WebDOMMessageEvent::initMessageEvent(const WebString& type, bool canBubble, bool cancelable, const WebSerializedScriptValue& messageData, const WebString& origin, const WebFrame* sourceFrame, const WebDocument& targetDocument, const WebString& lastEventId, const WebMessagePortChannelArray& webChannels) |
+{ |
+ ASSERT(m_private.get()); |
+ ASSERT(isMessageEvent()); |
+ DOMWindow* window = nullptr; |
+ // TODO(alexmos): Figure out if this is the right thing to do. |
adamk
2015/08/15 00:01:15
Would hate to leave this TODO in the new version.
alexmos
2015/08/15 01:07:02
I think we can just remove this. dcheng@ original
sgurun-gerrit only
2015/08/15 01:12:11
Done.
|
+ if (sourceFrame) |
+ window = toCoreFrame(sourceFrame)->domWindow(); |
+ RefPtrWillBeRawPtr<Document> coreDocument = PassRefPtrWillBeRawPtr<Document>(targetDocument); |
+ MessagePortArray* ports = MessagePort::toMessagePortArray(coreDocument.get(), webChannels); |
+ // Use an empty array for |ports| when it is null because this function |
+ // is used to implement postMessage(). |
+ if (!ports) |
+ ports = new MessagePortArray; |
+ unwrap<MessageEvent>()->initMessageEvent(type, canBubble, cancelable, messageData, origin, lastEventId, window, ports); |
+} |
+ |
void WebDOMMessageEvent::initMessageEvent(const WebString& type, bool canBubble, bool cancelable, const WebSerializedScriptValue& messageData, const WebString& origin, const WebFrame* sourceFrame, const WebString& lastEventId, const WebMessagePortChannelArray& webChannels) |
{ |
ASSERT(m_private.get()); |