Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1496)

Unified Diff: Source/modules/serviceworkers/ServiceWorkerClients.cpp

Issue 868463004: ServiceWorker: add ServiceWorkerClients.claim() support (1/3). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: change error type Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/modules/serviceworkers/ServiceWorkerClients.cpp
diff --git a/Source/modules/serviceworkers/ServiceWorkerClients.cpp b/Source/modules/serviceworkers/ServiceWorkerClients.cpp
index 6e5ed30b07f19a82d15b58b073abde469a56bf41..0f1c68ceabcc080842497346ed2560054e95d2df 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: short-term fix, see details at: https://codereview.chromium.org/535193002/.
+ if (!executionContext)
+ return ScriptPromise();
mlamouri (slow - plz ping) 2015/01/23 10:08:08 There are other places where such a check isn't do
jsbell 2015/01/24 00:42:16 Per that CL... yes. Any method called via bindings
falken 2015/01/26 04:55:11 http://crbug.com/413518 has more details, I've jus
xiang 2015/01/26 06:47:54 updated the comment.
+
+ 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

Powered by Google App Engine
This is Rietveld 408576698