| Index: Source/web/WebDOMMessageEvent.cpp
|
| diff --git a/Source/web/WebDOMMessageEvent.cpp b/Source/web/WebDOMMessageEvent.cpp
|
| index 573ae5495198011867ed41ef341f4c9b3239de4f..3e172dc5af2a526033273f70d87a73216d2ccab3 100644
|
| --- a/Source/web/WebDOMMessageEvent.cpp
|
| +++ b/Source/web/WebDOMMessageEvent.cpp
|
| @@ -37,24 +37,25 @@
|
| #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 WebString& lastEventId, const WebMessagePortChannelArray& webChannels)
|
| +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.
|
| if (sourceFrame)
|
| window = toCoreFrame(sourceFrame)->domWindow();
|
| MessagePortArray* ports = nullptr;
|
| - // TODO(alexmos): make ports work properly with OOPIF.
|
| - if (sourceFrame && sourceFrame->isWebLocalFrame())
|
| - ports = MessagePort::toMessagePortArray(toLocalDOMWindow(window)->document(), webChannels);
|
| + if (!targetDocument.isNull()) {
|
| + RefPtrWillBeRawPtr<Document> coreDocument = PassRefPtrWillBeRawPtr<Document>(targetDocument);
|
| + 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)
|
| @@ -62,6 +63,16 @@ void WebDOMMessageEvent::initMessageEvent(const WebString& type, bool canBubble,
|
| 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)
|
| +{
|
| + WebDocument document;
|
| + if (sourceFrame && sourceFrame->isWebLocalFrame()) {
|
| + DOMWindow* window = toCoreFrame(sourceFrame)->domWindow();
|
| + document = toLocalDOMWindow(window)->document();
|
| + }
|
| + initMessageEvent(type, canBubble, cancelable, messageData, origin, sourceFrame, document, lastEventId, webChannels);
|
| +}
|
| +
|
| WebSerializedScriptValue WebDOMMessageEvent::data() const
|
| {
|
| return WebSerializedScriptValue(constUnwrap<MessageEvent>()->dataAsSerializedScriptValue());
|
|
|