| 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/fetch/FetchManager.h" | 5 #include "modules/fetch/FetchManager.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
| 10 #include "bindings/core/v8/V8ThrowException.h" | 10 #include "bindings/core/v8/V8ThrowException.h" |
| (...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 m_loader = | 863 m_loader = |
| 864 ThreadableLoader::create(*m_executionContext, this, | 864 ThreadableLoader::create(*m_executionContext, this, |
| 865 threadableLoaderOptions, resourceLoaderOptions); | 865 threadableLoaderOptions, resourceLoaderOptions); |
| 866 m_loader->start(request); | 866 m_loader->start(request); |
| 867 } | 867 } |
| 868 | 868 |
| 869 void FetchManager::Loader::failed(const String& message) { | 869 void FetchManager::Loader::failed(const String& message) { |
| 870 if (m_failed || m_finished) | 870 if (m_failed || m_finished) |
| 871 return; | 871 return; |
| 872 m_failed = true; | 872 m_failed = true; |
| 873 if (m_executionContext->activeDOMObjectsAreStopped()) | 873 if (m_executionContext->isContextDestroyed()) |
| 874 return; | 874 return; |
| 875 if (!message.isEmpty()) | 875 if (!message.isEmpty()) |
| 876 m_executionContext->addConsoleMessage( | 876 m_executionContext->addConsoleMessage( |
| 877 ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, message)); | 877 ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, message)); |
| 878 if (m_resolver) { | 878 if (m_resolver) { |
| 879 ScriptState* state = m_resolver->getScriptState(); | 879 ScriptState* state = m_resolver->getScriptState(); |
| 880 ScriptState::Scope scope(state); | 880 ScriptState::Scope scope(state); |
| 881 m_resolver->reject( | 881 m_resolver->reject( |
| 882 V8ThrowException::createTypeError(state->isolate(), "Failed to fetch")); | 882 V8ThrowException::createTypeError(state->isolate(), "Failed to fetch")); |
| 883 } | 883 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 m_loaders.remove(loader); | 923 m_loaders.remove(loader); |
| 924 loader->dispose(); | 924 loader->dispose(); |
| 925 } | 925 } |
| 926 | 926 |
| 927 DEFINE_TRACE(FetchManager) { | 927 DEFINE_TRACE(FetchManager) { |
| 928 visitor->trace(m_loaders); | 928 visitor->trace(m_loaders); |
| 929 ContextLifecycleObserver::trace(visitor); | 929 ContextLifecycleObserver::trace(visitor); |
| 930 } | 930 } |
| 931 | 931 |
| 932 } // namespace blink | 932 } // namespace blink |
| OLD | NEW |