Index: third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp |
diff --git a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp |
index 3849642296520f9df72c9311426cbfbdce725001..ba90b75de830df1b89cf4f228735a9a263befe39 100644 |
--- a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp |
+++ b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp |
@@ -102,18 +102,31 @@ void ServiceWorkerGlobalScopeProxy::dispatchActivateEvent(int eventID) |
workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); |
} |
-void ServiceWorkerGlobalScopeProxy::dispatchExtendableMessageEvent(int eventID, const WebString& message, const WebMessagePortChannelArray& webChannels) |
+void ServiceWorkerGlobalScopeProxy::dispatchExtendableMessageEvent(int eventID, const WebString& message, const WebMessagePortChannelArray& webChannels, const WebServiceWorkerClientInfo& client) |
{ |
ASSERT(RuntimeEnabledFeatures::serviceWorkerExtendableMessageEventEnabled()); |
WebSerializedScriptValue value = WebSerializedScriptValue::fromString(message); |
MessagePortArray* ports = MessagePort::toMessagePortArray(m_workerGlobalScope, webChannels); |
- // TODO(nhiroki): Support |origin| and |source| attributes. |
- // (http://crbug.com/543198) |
+ ServiceWorkerClient* source = ServiceWorkerClient::create(client); |
+ RefPtr<SecurityOrigin> origin = SecurityOrigin::create(KURL(KURL(), source->url())); |
+ WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(), WaitUntilObserver::Message, eventID); |
+ RefPtrWillBeRawPtr<Event> event(ExtendableMessageEvent::create(value, origin->toString(), ports, source, observer)); |
+ workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); |
+} |
+ |
+void ServiceWorkerGlobalScopeProxy::dispatchExtendableMessageEvent(int eventID, const WebString& message, const WebMessagePortChannelArray& webChannels, WebPassOwnPtr<WebServiceWorker::Handle> handle) |
+{ |
+ ASSERT(RuntimeEnabledFeatures::serviceWorkerExtendableMessageEventEnabled()); |
+ |
+ WebSerializedScriptValue value = WebSerializedScriptValue::fromString(message); |
+ MessagePortArray* ports = MessagePort::toMessagePortArray(m_workerGlobalScope, webChannels); |
+ ServiceWorker* source = ServiceWorker::from(m_workerGlobalScope->executionContext(), handle.release()); |
+ RefPtr<SecurityOrigin> origin = SecurityOrigin::create(KURL(KURL(), source->scriptURL())); |
WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(), WaitUntilObserver::Message, eventID); |
- RefPtrWillBeRawPtr<Event> event(ExtendableMessageEvent::create(value, String(), ports, observer)); |
+ RefPtrWillBeRawPtr<Event> event(ExtendableMessageEvent::create(value, origin->toString(), ports, source, observer)); |
workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); |
} |