OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "config.h" |
| 6 #include "modules/serviceworkers/ServiceWorkerWindowClientCallback.h" |
| 7 |
| 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 9 #include "core/dom/DOMException.h" |
| 10 #include "modules/serviceworkers/ServiceWorkerError.h" |
| 11 #include "modules/serviceworkers/ServiceWorkerWindowClient.h" |
| 12 |
| 13 namespace blink { |
| 14 |
| 15 void NavigateClientCallback::onSuccess(WebPassOwnPtr<WebServiceWorkerClientInfo>
clientInfo) |
| 16 { |
| 17 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ
eDOMObjectsAreStopped()) |
| 18 return; |
| 19 m_resolver->resolve(ServiceWorkerWindowClient::take(m_resolver.get(), client
Info.release())); |
| 20 } |
| 21 |
| 22 void NavigateClientCallback::onError(const WebServiceWorkerError& error) |
| 23 { |
| 24 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ
eDOMObjectsAreStopped()) |
| 25 return; |
| 26 |
| 27 if (error.errorType == WebServiceWorkerError::ErrorTypeNavigation) { |
| 28 ScriptState::Scope scope(m_resolver->scriptState()); |
| 29 m_resolver->reject(V8ThrowException::createTypeError(m_resolver->scriptS
tate()->isolate(), error.message)); |
| 30 return; |
| 31 } |
| 32 |
| 33 m_resolver->reject(ServiceWorkerError::take(m_resolver.get(), error)); |
| 34 } |
| 35 |
| 36 } // namespace blink |
OLD | NEW |