| Index: Source/modules/serviceworkers/ServiceWorker.cpp
|
| diff --git a/Source/modules/serviceworkers/ServiceWorker.cpp b/Source/modules/serviceworkers/ServiceWorker.cpp
|
| index 0bbd5048335f6378f29b09f09f09a8b053a96b5d..3aa2048e2eb651d6d17ea205e1ce0e4cb0522d7e 100644
|
| --- a/Source/modules/serviceworkers/ServiceWorker.cpp
|
| +++ b/Source/modules/serviceworkers/ServiceWorker.cpp
|
| @@ -31,6 +31,10 @@
|
| #include "config.h"
|
| #include "ServiceWorker.h"
|
|
|
| +#include "bindings/v8/ExceptionState.h"
|
| +#include "core/dom/MessagePort.h"
|
| +#include "public/platform/WebMessagePortChannel.h"
|
| +#include "public/platform/WebString.h"
|
|
|
| namespace WebCore {
|
|
|
| @@ -39,4 +43,16 @@ ServiceWorker::ServiceWorker(PassOwnPtr<blink::WebServiceWorker> worker)
|
| {
|
| }
|
|
|
| +void ServiceWorker::postMessage(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());
|
| + m_outerWorker->postMessage(messageString, webChannels.leakPtr());
|
| +}
|
| +
|
| } // namespace WebCore
|
|
|