Index: Source/web/WebDOMMessageEvent.cpp |
diff --git a/Source/web/WebDOMMessageEvent.cpp b/Source/web/WebDOMMessageEvent.cpp |
index 573ae5495198011867ed41ef341f4c9b3239de4f..b6a683ec513ac8d645fbbcf6640b7f7ba5c556bb 100644 |
--- a/Source/web/WebDOMMessageEvent.cpp |
+++ b/Source/web/WebDOMMessageEvent.cpp |
@@ -37,12 +37,29 @@ |
#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; |
+ 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()); |
dcheng
2015/08/15 05:12:30
Can we re-express this in terms of the new interfa
sgurun-gerrit only
2015/08/18 15:17:30
Done.
|