Index: Source/core/dom/MessagePort.cpp |
diff --git a/Source/core/dom/MessagePort.cpp b/Source/core/dom/MessagePort.cpp |
index da4fa3b35c033a8a2c8b70e001f8f96f521e732d..67289c7609b81389f0d06fb4b94a7f62b1cb3497 100644 |
--- a/Source/core/dom/MessagePort.cpp |
+++ b/Source/core/dom/MessagePort.cpp |
@@ -184,6 +184,13 @@ static bool tryGetMessageFrom(WebMessagePortChannel& webChannel, RefPtr<Serializ |
return true; |
} |
+bool MessagePort::tryGetMessage(RefPtr<SerializedScriptValue>& message, OwnPtr<MessagePortChannelArray>& channels) |
+{ |
+ if (!m_entangledChannel) |
+ return false; |
+ return tryGetMessageFrom(*m_entangledChannel, message, channels); |
+} |
+ |
void MessagePort::dispatchMessages() |
{ |
// Because close() doesn't cancel any in flight calls to dispatchMessages() we need to check if the port is still open before dispatch. |
@@ -197,7 +204,7 @@ void MessagePort::dispatchMessages() |
RefPtr<SerializedScriptValue> message; |
OwnPtr<MessagePortChannelArray> channels; |
- while (m_entangledChannel && tryGetMessageFrom(*m_entangledChannel, message, channels)) { |
+ while (tryGetMessage(message, channels)) { |
// close() in Worker onmessage handler should prevent next message from dispatching. |
if (executionContext()->isWorkerGlobalScope() && toWorkerGlobalScope(executionContext())->isClosing()) |
return; |