| 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 "modules/serviceworkers/RespondWithObserver.h" | 5 #include "modules/serviceworkers/RespondWithObserver.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptFunction.h" | 7 #include "bindings/core/v8/ScriptFunction.h" |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptValue.h" | 9 #include "bindings/core/v8/ScriptValue.h" |
| 10 #include "bindings/core/v8/V8Binding.h" | 10 #include "bindings/core/v8/V8Binding.h" |
| 11 #include "bindings/modules/v8/V8Response.h" | 11 #include "bindings/modules/v8/V8Response.h" |
| 12 #include "core/dom/ExceptionCode.h" | 12 #include "core/dom/ExceptionCode.h" |
| 13 #include "core/dom/ExecutionContext.h" | 13 #include "core/dom/ExecutionContext.h" |
| 14 #include "core/inspector/ConsoleMessage.h" | 14 #include "core/inspector/ConsoleMessage.h" |
| 15 #include "core/streams/Stream.h" | 15 #include "core/streams/Stream.h" |
| 16 #include "modules/fetch/BodyStreamBuffer.h" | 16 #include "modules/fetch/BodyStreamBuffer.h" |
| 17 #include "modules/fetch/BytesConsumer.h" | 17 #include "modules/fetch/BytesConsumer.h" |
| 18 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" | 18 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" |
| 19 #include "platform/RuntimeEnabledFeatures.h" | 19 #include "platform/RuntimeEnabledFeatures.h" |
| 20 #include "public/platform/modules/serviceworker/WebServiceWorkerResponse.h" | 20 #include "public/platform/modules/serviceworker/WebServiceWorkerResponse.h" |
| 21 #include "wtf/Assertions.h" | 21 #include "wtf/Assertions.h" |
| 22 #include "wtf/RefPtr.h" | 22 #include "wtf/RefPtr.h" |
| 23 #include <v8.h> | 23 #include <v8.h> |
| 24 | 24 |
| 25 namespace blink { | 25 namespace blink { |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 // Returns the error message to let the developer know about the reason of the u
nusual failures. | 28 // Returns the error message to let the developer know about the reason of the |
| 29 // unusual failures. |
| 29 const String getMessageForResponseError(WebServiceWorkerResponseError error, | 30 const String getMessageForResponseError(WebServiceWorkerResponseError error, |
| 30 const KURL& requestURL) { | 31 const KURL& requestURL) { |
| 31 String errorMessage = "The FetchEvent for \"" + requestURL.getString() + | 32 String errorMessage = "The FetchEvent for \"" + requestURL.getString() + |
| 32 "\" resulted in a network error response: "; | 33 "\" resulted in a network error response: "; |
| 33 switch (error) { | 34 switch (error) { |
| 34 case WebServiceWorkerResponseErrorPromiseRejected: | 35 case WebServiceWorkerResponseErrorPromiseRejected: |
| 35 errorMessage = errorMessage + "the promise was rejected."; | 36 errorMessage = errorMessage + "the promise was rejected."; |
| 36 break; | 37 break; |
| 37 case WebServiceWorkerResponseErrorDefaultPrevented: | 38 case WebServiceWorkerResponseErrorDefaultPrevented: |
| 38 errorMessage = | 39 errorMessage = |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 m_requestContext(requestContext), | 338 m_requestContext(requestContext), |
| 338 m_state(Initial), | 339 m_state(Initial), |
| 339 m_observer(observer) {} | 340 m_observer(observer) {} |
| 340 | 341 |
| 341 DEFINE_TRACE(RespondWithObserver) { | 342 DEFINE_TRACE(RespondWithObserver) { |
| 342 visitor->trace(m_observer); | 343 visitor->trace(m_observer); |
| 343 ContextLifecycleObserver::trace(visitor); | 344 ContextLifecycleObserver::trace(visitor); |
| 344 } | 345 } |
| 345 | 346 |
| 346 } // namespace blink | 347 } // namespace blink |
| OLD | NEW |