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

Unified Diff: Source/web/WebDOMMessageEvent.cpp

Issue 1150183007: Re-land: bindings: Use MessageEventInit for MessageEvent constructor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 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 | « Source/core/events/MessageEventInit.idl ('k') | no next file » | no next file with comments »
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 f050e01a89842a2fbfb7d6f9a7eaa3cb14bb37cc..fb6f1066a6cfcf29d8c05bd4ea28e11dad74c811 100644
--- a/Source/web/WebDOMMessageEvent.cpp
+++ b/Source/web/WebDOMMessageEvent.cpp
@@ -55,6 +55,10 @@ void WebDOMMessageEvent::initMessageEvent(const WebString& type, bool canBubble,
// TODO(alexmos): make ports work properly with OOPIF.
if (sourceFrame && sourceFrame->isWebLocalFrame())
ports = MessagePort::toMessagePortArray(toLocalDOMWindow(window)->document(), webChannels);
+ // Use an empty array for |ports| when it is null because this function
+ // is used to implement postMessage().
+ if (!ports)
+ ports = adoptPtrWillBeNoop(new MessagePortArray());
unwrap<MessageEvent>()->initMessageEvent(type, canBubble, cancelable, messageData, origin, lastEventId, window, ports.release());
}
« no previous file with comments | « Source/core/events/MessageEventInit.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698