Index: Source/core/dom/MessagePort.cpp |
diff --git a/Source/core/dom/MessagePort.cpp b/Source/core/dom/MessagePort.cpp |
index ebb399f19274ca7a7496ba59af3dda169f646bf1..3df2fde8f052b25304b7ab5fc42c341e3a839d97 100644 |
--- a/Source/core/dom/MessagePort.cpp |
+++ b/Source/core/dom/MessagePort.cpp |
@@ -259,8 +259,10 @@ PassOwnPtr<MessagePortChannelArray> MessagePort::disentanglePorts(ExecutionConte |
PassOwnPtrWillBeRawPtr<MessagePortArray> MessagePort::entanglePorts(ExecutionContext& context, PassOwnPtr<MessagePortChannelArray> channels) |
{ |
+ // https://html.spec.whatwg.org/multipage/comms.html#message-ports |
+ // |ports| should be an empty array, not null even when there is no ports. |
if (!channels || !channels->size()) |
- return nullptr; |
+ return adoptPtrWillBeNoop(new MessagePortArray()); |
OwnPtrWillBeRawPtr<MessagePortArray> portArray = adoptPtrWillBeNoop(new MessagePortArray(channels->size())); |
for (unsigned i = 0; i < channels->size(); ++i) { |