Chromium Code Reviews| 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/GlobalFetch.h" | 5 #include "modules/fetch/GlobalFetch.h" |
| 6 | 6 |
| 7 #include "core/frame/LocalDOMWindow.h" | 7 #include "core/frame/LocalDOMWindow.h" |
| 8 #include "core/frame/UseCounter.h" | 8 #include "core/frame/UseCounter.h" |
| 9 #include "core/inspector/InspectorInstrumentation.h" | 9 #include "core/inspector/InspectorInstrumentation.h" |
| 10 #include "core/workers/WorkerGlobalScope.h" | 10 #include "core/workers/WorkerGlobalScope.h" |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 38 | 38 |
| 39 ScriptPromise fetch(ScriptState* scriptState, | 39 ScriptPromise fetch(ScriptState* scriptState, |
| 40 const RequestInfo& input, | 40 const RequestInfo& input, |
| 41 const Dictionary& init, | 41 const Dictionary& init, |
| 42 ExceptionState& exceptionState) override { | 42 ExceptionState& exceptionState) override { |
| 43 if (!scriptState->contextIsValid()) { | 43 if (!scriptState->contextIsValid()) { |
| 44 // TODO(yhirano): Should this be moved to bindings? | 44 // TODO(yhirano): Should this be moved to bindings? |
| 45 exceptionState.throwTypeError("The global scope is shutting down."); | 45 exceptionState.throwTypeError("The global scope is shutting down."); |
| 46 return ScriptPromise(); | 46 return ScriptPromise(); |
| 47 } | 47 } |
| 48 if (m_fetchManager->isStopped()) { | |
|
haraken
2016/12/07 06:05:29
If this returns true, scriptState->contextIsValid(
| |
| 49 exceptionState.throwTypeError("The global scope is shutting down."); | |
| 50 return ScriptPromise(); | |
| 51 } | |
| 52 | 48 |
| 53 // "Let |r| be the associated request of the result of invoking the | 49 // "Let |r| be the associated request of the result of invoking the |
| 54 // initial value of Request as constructor with |input| and |init| as | 50 // initial value of Request as constructor with |input| and |init| as |
| 55 // arguments. If this throws an exception, reject |p| with it." | 51 // arguments. If this throws an exception, reject |p| with it." |
| 56 Request* r = Request::create(scriptState, input, init, exceptionState); | 52 Request* r = Request::create(scriptState, input, init, exceptionState); |
| 57 if (exceptionState.hadException()) | 53 if (exceptionState.hadException()) |
| 58 return ScriptPromise(); | 54 return ScriptPromise(); |
| 59 | 55 |
| 60 if (ExecutionContext* executionContext = | 56 if (ExecutionContext* executionContext = |
| 61 m_fetchManager->getExecutionContext()) | 57 m_fetchManager->getExecutionContext()) |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 const RequestInfo& input, | 108 const RequestInfo& input, |
| 113 const Dictionary& init, | 109 const Dictionary& init, |
| 114 ExceptionState& exceptionState) { | 110 ExceptionState& exceptionState) { |
| 115 // Note that UseCounter doesn't work with SharedWorker or ServiceWorker. | 111 // Note that UseCounter doesn't work with SharedWorker or ServiceWorker. |
| 116 UseCounter::count(worker.getExecutionContext(), UseCounter::Fetch); | 112 UseCounter::count(worker.getExecutionContext(), UseCounter::Fetch); |
| 117 return ScopedFetcher::from(worker)->fetch(scriptState, input, init, | 113 return ScopedFetcher::from(worker)->fetch(scriptState, input, init, |
| 118 exceptionState); | 114 exceptionState); |
| 119 } | 115 } |
| 120 | 116 |
| 121 } // namespace blink | 117 } // namespace blink |
| OLD | NEW |