Index: Source/modules/serviceworkers/ServiceWorkerClients.cpp |
diff --git a/Source/modules/serviceworkers/ServiceWorkerClients.cpp b/Source/modules/serviceworkers/ServiceWorkerClients.cpp |
index 6e5ed30b07f19a82d15b58b073abde469a56bf41..b9300cc0844a2c77ab8527605a1256ddaf475ade 100644 |
--- a/Source/modules/serviceworkers/ServiceWorkerClients.cpp |
+++ b/Source/modules/serviceworkers/ServiceWorkerClients.cpp |
@@ -73,4 +73,20 @@ ScriptPromise ServiceWorkerClients::getAll(ScriptState* scriptState, const Clien |
return promise; |
} |
+ScriptPromise ServiceWorkerClients::claim(ScriptState* scriptState) |
+{ |
+ ExecutionContext* executionContext = scriptState->executionContext(); |
+ |
+ // FIXME: May be null due to worker termination. http://crbug.coma/413518 |
falken
2015/01/27 03:25:18
typo: .coma
xiang
2015/01/28 05:57:49
Done.
|
+ if (!executionContext) |
+ return ScriptPromise(); |
+ |
+ RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scriptState); |
+ ScriptPromise promise = resolver->promise(); |
+ |
+ WebServiceWorkerClientsClaimCallbacks* callbacks = new CallbackPromiseAdapter<void, ServiceWorkerError>(resolver); |
+ ServiceWorkerGlobalScopeClient::from(executionContext)->claim(callbacks); |
+ return promise; |
+} |
+ |
} // namespace blink |