| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 "modules/serviceworkers/ServiceWorkerWindowClientCallback.h" | 5 #include "modules/serviceworkers/ServiceWorkerWindowClientCallback.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptPromiseResolver.h" | 7 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 8 #include "core/dom/DOMException.h" | 8 #include "core/dom/DOMException.h" |
| 9 #include "modules/serviceworkers/ServiceWorkerError.h" | 9 #include "modules/serviceworkers/ServiceWorkerError.h" |
| 10 #include "modules/serviceworkers/ServiceWorkerWindowClient.h" | 10 #include "modules/serviceworkers/ServiceWorkerWindowClient.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 void NavigateClientCallback::onSuccess(WebPassOwnPtr<WebServiceWorkerClientInfo>
clientInfo) | 14 void NavigateClientCallback::onSuccess(std::unique_ptr<WebServiceWorkerClientInf
o> clientInfo) |
| 15 { | 15 { |
| 16 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()-
>activeDOMObjectsAreStopped()) | 16 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()-
>activeDOMObjectsAreStopped()) |
| 17 return; | 17 return; |
| 18 m_resolver->resolve(ServiceWorkerWindowClient::take(m_resolver.get(), client
Info.release())); | 18 m_resolver->resolve(ServiceWorkerWindowClient::take(m_resolver.get(), adoptP
tr(clientInfo.release()))); |
| 19 } | 19 } |
| 20 | 20 |
| 21 void NavigateClientCallback::onError(const WebServiceWorkerError& error) | 21 void NavigateClientCallback::onError(const WebServiceWorkerError& error) |
| 22 { | 22 { |
| 23 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()-
>activeDOMObjectsAreStopped()) | 23 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()-
>activeDOMObjectsAreStopped()) |
| 24 return; | 24 return; |
| 25 | 25 |
| 26 if (error.errorType == WebServiceWorkerError::ErrorTypeNavigation) { | 26 if (error.errorType == WebServiceWorkerError::ErrorTypeNavigation) { |
| 27 ScriptState::Scope scope(m_resolver->getScriptState()); | 27 ScriptState::Scope scope(m_resolver->getScriptState()); |
| 28 m_resolver->reject(V8ThrowException::createTypeError(m_resolver->getScri
ptState()->isolate(), error.message)); | 28 m_resolver->reject(V8ThrowException::createTypeError(m_resolver->getScri
ptState()->isolate(), error.message)); |
| 29 return; | 29 return; |
| 30 } | 30 } |
| 31 | 31 |
| 32 m_resolver->reject(ServiceWorkerError::take(m_resolver.get(), error)); | 32 m_resolver->reject(ServiceWorkerError::take(m_resolver.get(), error)); |
| 33 } | 33 } |
| 34 | 34 |
| 35 } // namespace blink | 35 } // namespace blink |
| OLD | NEW |