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..8b55a4ed59e424c5a07a061bab42973a59f532b9 100644 |
--- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClients.cpp |
+++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClients.cpp |
@@ -71,6 +71,21 @@ ServiceWorkerClients::ServiceWorkerClients() |
{ |
} |
+ScriptPromise ServiceWorkerClients::get(ScriptState* scriptState, const String& id) |
+{ |
+ ExecutionContext* executionContext = scriptState->executionContext(); |
+ // FIXME: May be null due to worker termination: http://crbug.com/413518. |
+ if (!executionContext) |
+ return ScriptPromise(); |
+ |
+ ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); |
+ ScriptPromise promise = resolver->promise(); |
+ |
+ // TODO(jungkees): Use ServiceWorkerClient for typename S of CallBackPromiseAdpater. |
zino
2016/01/04 09:05:27
I'm not sure but you are already done?
|
+ ServiceWorkerGlobalScopeClient::from(executionContext)->getClient(id, new CallbackPromiseAdapter<ServiceWorkerClient, ServiceWorkerError>(resolver)); |
+ return promise; |
+} |
+ |
ScriptPromise ServiceWorkerClients::matchAll(ScriptState* scriptState, const ClientQueryOptions& options) |
{ |
ExecutionContext* executionContext = scriptState->executionContext(); |