Index: Source/modules/serviceworkers/Client.cpp |
diff --git a/Source/modules/serviceworkers/Client.cpp b/Source/modules/serviceworkers/Client.cpp |
index 77890687d12702f277cc362f647c92579bbcdb0d..1ddf95d3fd1dde0036d52cafb1f0755641f3bcab 100644 |
--- a/Source/modules/serviceworkers/Client.cpp |
+++ b/Source/modules/serviceworkers/Client.cpp |
@@ -5,6 +5,10 @@ |
#include "config.h" |
#include "modules/serviceworkers/Client.h" |
+#include "bindings/v8/ExceptionState.h" |
+#include "bindings/v8/SerializedScriptValue.h" |
+#include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" |
+#include "public/platform/WebString.h" |
#include "wtf/RefPtr.h" |
namespace WebCore { |
@@ -24,4 +28,16 @@ Client::~Client() |
{ |
} |
+void Client::postMessage(ExecutionContext* context, PassRefPtr<SerializedScriptValue> message, const MessagePortArray* ports, ExceptionState& exceptionState) |
+{ |
+ // Disentangle the port in preparation for sending it to the remote context. |
+ OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(ports, exceptionState); |
+ if (exceptionState.hadException()) |
+ return; |
+ |
+ blink::WebString messageString = message->toWireString(); |
+ OwnPtr<blink::WebMessagePortChannelArray> webChannels = MessagePort::toWebMessagePortChannelArray(channels.release()); |
+ ServiceWorkerGlobalScopeClient::from(context)->postMessageToClient(m_id, messageString, webChannels.release()); |
+} |
+ |
} // namespace WebCore |