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

Unified Diff: Source/web/WebDOMMessageEvent.cpp

Issue 1289033003: Start changing WebDOMMessageEvent for using target execution context. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: removed obsolote todo Created 5 years, 4 months 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
« no previous file with comments | « no previous file | Source/web/tests/WebFrameTest.cpp » ('j') | public/web/WebDOMMessageEvent.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « no previous file | Source/web/tests/WebFrameTest.cpp » ('j') | public/web/WebDOMMessageEvent.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698