| 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 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 851 m_loader = | 851 m_loader = |
| 852 ThreadableLoader::create(*m_executionContext, this, | 852 ThreadableLoader::create(*m_executionContext, this, |
| 853 threadableLoaderOptions, resourceLoaderOptions); | 853 threadableLoaderOptions, resourceLoaderOptions); |
| 854 m_loader->start(request); | 854 m_loader->start(request); |
| 855 } | 855 } |
| 856 | 856 |
| 857 void FetchManager::Loader::failed(const String& message) { | 857 void FetchManager::Loader::failed(const String& message) { |
| 858 if (m_failed || m_finished) | 858 if (m_failed || m_finished) |
| 859 return; | 859 return; |
| 860 m_failed = true; | 860 m_failed = true; |
| 861 if (m_executionContext->activeDOMObjectsAreStopped()) | |
| 862 return; | |
| 863 if (!message.isEmpty()) | 861 if (!message.isEmpty()) |
| 864 m_executionContext->addConsoleMessage( | 862 m_executionContext->addConsoleMessage( |
| 865 ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, message)); | 863 ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, message)); |
| 866 if (m_resolver) { | 864 if (m_resolver) { |
| 867 ScriptState* state = m_resolver->getScriptState(); | 865 ScriptState* state = m_resolver->getScriptState(); |
| 868 ScriptState::Scope scope(state); | 866 ScriptState::Scope scope(state); |
| 869 m_resolver->reject( | 867 m_resolver->reject( |
| 870 V8ThrowException::createTypeError(state->isolate(), "Failed to fetch")); | 868 V8ThrowException::createTypeError(state->isolate(), "Failed to fetch")); |
| 871 } | 869 } |
| 872 InspectorInstrumentation::didFailFetch(m_executionContext, this); | 870 InspectorInstrumentation::didFailFetch(m_executionContext, this); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 911 m_loaders.remove(loader); | 909 m_loaders.remove(loader); |
| 912 loader->dispose(); | 910 loader->dispose(); |
| 913 } | 911 } |
| 914 | 912 |
| 915 DEFINE_TRACE(FetchManager) { | 913 DEFINE_TRACE(FetchManager) { |
| 916 visitor->trace(m_loaders); | 914 visitor->trace(m_loaders); |
| 917 ContextLifecycleObserver::trace(visitor); | 915 ContextLifecycleObserver::trace(visitor); |
| 918 } | 916 } |
| 919 | 917 |
| 920 } // namespace blink | 918 } // namespace blink |
| OLD | NEW |