Chromium Code Reviews| 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 f187c2abf27cbfddcec50030f6faf35b69275eb7..25f93bc218cf76c870ab389bb60467c8e04bef57 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())); |
|
Mike West
2016/03/02 10:03:23
This seems like it's going to give you the wrong r
nhiroki
2016/03/07 07:40:52
Are you concerned about sandboxed documents that d
|
| + 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); |
| } |