| Index: third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClients.cpp | 
| diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClients.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClients.cpp | 
| index ff907d2e33cf8a5dcc584a4ca7a8d8ed251671e4..63a51494d0327fc0d5990251ecc2da276af34e7c 100644 | 
| --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClients.cpp | 
| +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClients.cpp | 
| @@ -60,6 +60,37 @@ WebServiceWorkerClientType getClientType(const String& type) | 
| return WebServiceWorkerClientTypeWindow; | 
| } | 
|  | 
| +class GetCallback : public WebServiceWorkerClientCallbacks { | 
| +public: | 
| +    explicit GetCallback(ScriptPromiseResolver* resolver) | 
| +        : m_resolver(resolver) { } | 
| +    ~GetCallback() override { } | 
| + | 
| +    void onSuccess(WebPassOwnPtr<WebServiceWorkerClientInfo> webClient) override | 
| +    { | 
| +        OwnPtr<WebServiceWorkerClientInfo> client = webClient.release(); | 
| +        if (!m_resolver->executionContext() || m_resolver->executionContext()->activeDOMObjectsAreStopped()) | 
| +            return; | 
| +        if (!client) { | 
| +            // Resolve the promise with undefined. | 
| +            m_resolver->resolve(); | 
| +            return; | 
| +        } | 
| +        m_resolver->resolve(ServiceWorkerClient::take(m_resolver, client.release())); | 
| +    } | 
| + | 
| +    void onError(const WebServiceWorkerError& error) override | 
| +    { | 
| +        if (!m_resolver->executionContext() || m_resolver->executionContext()->activeDOMObjectsAreStopped()) | 
| +            return; | 
| +        m_resolver->reject(ServiceWorkerError::take(m_resolver.get(), error)); | 
| +    } | 
| + | 
| +private: | 
| +    Persistent<ScriptPromiseResolver> m_resolver; | 
| +    WTF_MAKE_NONCOPYABLE(GetCallback); | 
| +}; | 
| + | 
| } // namespace | 
|  | 
| ServiceWorkerClients* ServiceWorkerClients::create() | 
| @@ -71,6 +102,20 @@ ServiceWorkerClients::ServiceWorkerClients() | 
| { | 
| } | 
|  | 
| +ScriptPromise ServiceWorkerClients::get(ScriptState* scriptState, const String& id) | 
| +{ | 
| +    ExecutionContext* executionContext = scriptState->executionContext(); | 
| +    // TODO(jungkees): May be null due to worker termination: http://crbug.com/413518. | 
| +    if (!executionContext) | 
| +        return ScriptPromise(); | 
| + | 
| +    ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); | 
| +    ScriptPromise promise = resolver->promise(); | 
| + | 
| +    ServiceWorkerGlobalScopeClient::from(executionContext)->getClient(id, new GetCallback(resolver)); | 
| +    return promise; | 
| +} | 
| + | 
| ScriptPromise ServiceWorkerClients::matchAll(ScriptState* scriptState, const ClientQueryOptions& options) | 
| { | 
| ExecutionContext* executionContext = scriptState->executionContext(); | 
|  |