Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "modules/serviceworkers/ServiceWorkerClients.h" | 6 #include "modules/serviceworkers/ServiceWorkerClients.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 8 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "core/dom/ExceptionCode.h" | 10 #include "core/dom/ExceptionCode.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 if (options.type() != "window") { | 66 if (options.type() != "window") { |
| 67 // FIXME: Currently we only support WindowClients. | 67 // FIXME: Currently we only support WindowClients. |
| 68 resolver->reject(DOMException::create(NotSupportedError, "type parameter of getAll is not supported.")); | 68 resolver->reject(DOMException::create(NotSupportedError, "type parameter of getAll is not supported.")); |
| 69 return promise; | 69 return promise; |
| 70 } | 70 } |
| 71 | 71 |
| 72 ServiceWorkerGlobalScopeClient::from(scriptState->executionContext())->getCl ients(new CallbackPromiseAdapter<ClientArray, ServiceWorkerError>(resolver)); | 72 ServiceWorkerGlobalScopeClient::from(scriptState->executionContext())->getCl ients(new CallbackPromiseAdapter<ClientArray, ServiceWorkerError>(resolver)); |
| 73 return promise; | 73 return promise; |
| 74 } | 74 } |
| 75 | 75 |
| 76 ScriptPromise ServiceWorkerClients::claim(ScriptState* scriptState) | |
| 77 { | |
| 78 ExecutionContext* executionContext = scriptState->executionContext(); | |
| 79 | |
| 80 // FIXME: short-term fix, see details at: https://codereview.chromium.org/53 5193002/. | |
| 81 if (!executionContext) | |
| 82 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.
| |
| 83 | |
| 84 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState); | |
| 85 ScriptPromise promise = resolver->promise(); | |
| 86 | |
| 87 WebServiceWorkerClientsClaimCallbacks* callbacks = new CallbackPromiseAdapte r<void, ServiceWorkerError>(resolver); | |
| 88 ServiceWorkerGlobalScopeClient::from(executionContext)->claim(callbacks); | |
| 89 return promise; | |
| 90 } | |
| 91 | |
| 76 } // namespace blink | 92 } // namespace blink |
| OLD | NEW |