| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 } | 95 } |
| 96 | 96 |
| 97 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, Request*
request) | 97 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, Request*
request) |
| 98 { | 98 { |
| 99 if (!m_fetchManager) | 99 if (!m_fetchManager) |
| 100 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror("ServiceWorkerGlobalScope is shutting down.", scriptState->isolate())); | 100 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror("ServiceWorkerGlobalScope is shutting down.", scriptState->isolate())); |
| 101 // "Let |r| be the associated request of the result of invoking the initial | 101 // "Let |r| be the associated request of the result of invoking the initial |
| 102 // value of Request as constructor with |input| and |init| as arguments. If | 102 // value of Request as constructor with |input| and |init| as arguments. If |
| 103 // this throws an exception, reject |p| with it." | 103 // this throws an exception, reject |p| with it." |
| 104 TrackExceptionState exceptionState; | 104 TrackExceptionState exceptionState; |
| 105 RefPtr<Request> r = Request::create(this, request, exceptionState); | 105 RefPtrWillBeRawPtr<Request> r = Request::create(this, request, exceptionStat
e); |
| 106 if (exceptionState.hadException()) { | 106 if (exceptionState.hadException()) { |
| 107 // FIXME: We should throw the caught error. | 107 // FIXME: We should throw the caught error. |
| 108 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(exceptionState.message(), scriptState->isolate())); | 108 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(exceptionState.message(), scriptState->isolate())); |
| 109 } | 109 } |
| 110 return m_fetchManager->fetch(scriptState, r->request()); | 110 return m_fetchManager->fetch(scriptState, r->request()); |
| 111 } | 111 } |
| 112 | 112 |
| 113 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, Request*
request, const Dictionary& requestInit) | 113 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, Request*
request, const Dictionary& requestInit) |
| 114 { | 114 { |
| 115 if (!m_fetchManager) | 115 if (!m_fetchManager) |
| 116 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror("ServiceWorkerGlobalScope is shutting down.", scriptState->isolate())); | 116 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror("ServiceWorkerGlobalScope is shutting down.", scriptState->isolate())); |
| 117 // "Let |r| be the associated request of the result of invoking the initial | 117 // "Let |r| be the associated request of the result of invoking the initial |
| 118 // value of Request as constructor with |input| and |init| as arguments. If | 118 // value of Request as constructor with |input| and |init| as arguments. If |
| 119 // this throws an exception, reject |p| with it." | 119 // this throws an exception, reject |p| with it." |
| 120 TrackExceptionState exceptionState; | 120 TrackExceptionState exceptionState; |
| 121 RefPtr<Request> r = Request::create(this, request, requestInit, exceptionSta
te); | 121 RefPtrWillBeRawPtr<Request> r = Request::create(this, request, requestInit,
exceptionState); |
| 122 if (exceptionState.hadException()) { | 122 if (exceptionState.hadException()) { |
| 123 // FIXME: We should throw the caught error. | 123 // FIXME: We should throw the caught error. |
| 124 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(exceptionState.message(), scriptState->isolate())); | 124 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(exceptionState.message(), scriptState->isolate())); |
| 125 } | 125 } |
| 126 return m_fetchManager->fetch(scriptState, r->request()); | 126 return m_fetchManager->fetch(scriptState, r->request()); |
| 127 } | 127 } |
| 128 | 128 |
| 129 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, const St
ring& urlstring) | 129 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, const St
ring& urlstring) |
| 130 { | 130 { |
| 131 if (!m_fetchManager) | 131 if (!m_fetchManager) |
| 132 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror("ServiceWorkerGlobalScope is shutting down.", scriptState->isolate())); | 132 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror("ServiceWorkerGlobalScope is shutting down.", scriptState->isolate())); |
| 133 // "Let |r| be the associated request of the result of invoking the initial | 133 // "Let |r| be the associated request of the result of invoking the initial |
| 134 // value of Request as constructor with |input| and |init| as arguments. If | 134 // value of Request as constructor with |input| and |init| as arguments. If |
| 135 // this throws an exception, reject |p| with it." | 135 // this throws an exception, reject |p| with it." |
| 136 TrackExceptionState exceptionState; | 136 TrackExceptionState exceptionState; |
| 137 RefPtr<Request> r = Request::create(this, urlstring, exceptionState); | 137 RefPtrWillBeRawPtr<Request> r = Request::create(this, urlstring, exceptionSt
ate); |
| 138 if (exceptionState.hadException()) { | 138 if (exceptionState.hadException()) { |
| 139 // FIXME: We should throw the caught error. | 139 // FIXME: We should throw the caught error. |
| 140 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(exceptionState.message(), scriptState->isolate())); | 140 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(exceptionState.message(), scriptState->isolate())); |
| 141 } | 141 } |
| 142 return m_fetchManager->fetch(scriptState, r->request()); | 142 return m_fetchManager->fetch(scriptState, r->request()); |
| 143 } | 143 } |
| 144 | 144 |
| 145 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, const St
ring& urlstring, const Dictionary& requestInit) | 145 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, const St
ring& urlstring, const Dictionary& requestInit) |
| 146 { | 146 { |
| 147 if (!m_fetchManager) | 147 if (!m_fetchManager) |
| 148 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror("ServiceWorkerGlobalScope is shutting down.", scriptState->isolate())); | 148 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror("ServiceWorkerGlobalScope is shutting down.", scriptState->isolate())); |
| 149 // "Let |r| be the associated request of the result of invoking the initial | 149 // "Let |r| be the associated request of the result of invoking the initial |
| 150 // value of Request as constructor with |input| and |init| as arguments. If | 150 // value of Request as constructor with |input| and |init| as arguments. If |
| 151 // this throws an exception, reject |p| with it." | 151 // this throws an exception, reject |p| with it." |
| 152 TrackExceptionState exceptionState; | 152 TrackExceptionState exceptionState; |
| 153 RefPtr<Request> r = Request::create(this, urlstring, requestInit, exceptionS
tate); | 153 RefPtrWillBeRawPtr<Request> r = Request::create(this, urlstring, requestInit
, exceptionState); |
| 154 if (exceptionState.hadException()) { | 154 if (exceptionState.hadException()) { |
| 155 // FIXME: We should throw the caught error. | 155 // FIXME: We should throw the caught error. |
| 156 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(exceptionState.message(), scriptState->isolate())); | 156 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(exceptionState.message(), scriptState->isolate())); |
| 157 } | 157 } |
| 158 return m_fetchManager->fetch(scriptState, r->request()); | 158 return m_fetchManager->fetch(scriptState, r->request()); |
| 159 } | 159 } |
| 160 | 160 |
| 161 PassRefPtrWillBeRawPtr<ServiceWorkerClients> ServiceWorkerGlobalScope::clients() | 161 PassRefPtrWillBeRawPtr<ServiceWorkerClients> ServiceWorkerGlobalScope::clients() |
| 162 { | 162 { |
| 163 if (!m_clients) | 163 if (!m_clients) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 177 WorkerGlobalScope::trace(visitor); | 177 WorkerGlobalScope::trace(visitor); |
| 178 } | 178 } |
| 179 | 179 |
| 180 void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage,
const String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawP
tr<ScriptCallStack> callStack) | 180 void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage,
const String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawP
tr<ScriptCallStack> callStack) |
| 181 { | 181 { |
| 182 WorkerGlobalScope::logExceptionToConsole(errorMessage, sourceURL, lineNumber
, columnNumber, callStack); | 182 WorkerGlobalScope::logExceptionToConsole(errorMessage, sourceURL, lineNumber
, columnNumber, callStack); |
| 183 addMessageToWorkerConsole(JSMessageSource, ErrorMessageLevel, errorMessage,
sourceURL, lineNumber, callStack, 0); | 183 addMessageToWorkerConsole(JSMessageSource, ErrorMessageLevel, errorMessage,
sourceURL, lineNumber, callStack, 0); |
| 184 } | 184 } |
| 185 | 185 |
| 186 } // namespace blink | 186 } // namespace blink |
| OLD | NEW |