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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 CacheStorage* ServiceWorkerGlobalScope::caches(ExecutionContext* context) | 91 CacheStorage* ServiceWorkerGlobalScope::caches(ExecutionContext* context) |
92 { | 92 { |
93 if (!m_caches) | 93 if (!m_caches) |
94 m_caches = CacheStorage::create(ServiceWorkerGlobalScopeClient::from(con
text)->cacheStorage()); | 94 m_caches = CacheStorage::create(ServiceWorkerGlobalScopeClient::from(con
text)->cacheStorage()); |
95 return m_caches; | 95 return m_caches; |
96 } | 96 } |
97 | 97 |
98 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, Request*
request) | 98 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, Request*
request) |
99 { | 99 { |
100 if (!m_fetchManager) | 100 if (!m_fetchManager) |
101 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror("ServiceWorkerGlobalScope is shutting down.", scriptState->isolate())); | 101 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(scriptState->isolate(), "ServiceWorkerGlobalScope is shutting down.")); |
102 // "Let |r| be the associated request of the result of invoking the initial | 102 // "Let |r| be the associated request of the result of invoking the initial |
103 // value of Request as constructor with |input| and |init| as arguments. If | 103 // value of Request as constructor with |input| and |init| as arguments. If |
104 // this throws an exception, reject |p| with it." | 104 // this throws an exception, reject |p| with it." |
105 TrackExceptionState exceptionState; | 105 TrackExceptionState exceptionState; |
106 Request* r = Request::create(this, request, exceptionState); | 106 Request* r = Request::create(this, request, exceptionState); |
107 if (exceptionState.hadException()) { | 107 if (exceptionState.hadException()) { |
108 // FIXME: We should throw the caught error. | 108 // FIXME: We should throw the caught error. |
109 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(exceptionState.message(), scriptState->isolate())); | 109 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(scriptState->isolate(), exceptionState.message())); |
110 } | 110 } |
111 return m_fetchManager->fetch(scriptState, r->request()); | 111 return m_fetchManager->fetch(scriptState, r->request()); |
112 } | 112 } |
113 | 113 |
114 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, Request*
request, const Dictionary& requestInit) | 114 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, Request*
request, const Dictionary& requestInit) |
115 { | 115 { |
116 if (!m_fetchManager) | 116 if (!m_fetchManager) |
117 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror("ServiceWorkerGlobalScope is shutting down.", scriptState->isolate())); | 117 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(scriptState->isolate(), "ServiceWorkerGlobalScope is shutting down.")); |
118 // "Let |r| be the associated request of the result of invoking the initial | 118 // "Let |r| be the associated request of the result of invoking the initial |
119 // value of Request as constructor with |input| and |init| as arguments. If | 119 // value of Request as constructor with |input| and |init| as arguments. If |
120 // this throws an exception, reject |p| with it." | 120 // this throws an exception, reject |p| with it." |
121 TrackExceptionState exceptionState; | 121 TrackExceptionState exceptionState; |
122 Request* r = Request::create(this, request, requestInit, exceptionState); | 122 Request* r = Request::create(this, request, requestInit, exceptionState); |
123 if (exceptionState.hadException()) { | 123 if (exceptionState.hadException()) { |
124 // FIXME: We should throw the caught error. | 124 // FIXME: We should throw the caught error. |
125 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(exceptionState.message(), scriptState->isolate())); | 125 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(scriptState->isolate(), exceptionState.message())); |
126 } | 126 } |
127 return m_fetchManager->fetch(scriptState, r->request()); | 127 return m_fetchManager->fetch(scriptState, r->request()); |
128 } | 128 } |
129 | 129 |
130 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, const St
ring& urlstring) | 130 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, const St
ring& urlstring) |
131 { | 131 { |
132 if (!m_fetchManager) | 132 if (!m_fetchManager) |
133 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror("ServiceWorkerGlobalScope is shutting down.", scriptState->isolate())); | 133 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(scriptState->isolate(), "ServiceWorkerGlobalScope is shutting down.")); |
134 // "Let |r| be the associated request of the result of invoking the initial | 134 // "Let |r| be the associated request of the result of invoking the initial |
135 // value of Request as constructor with |input| and |init| as arguments. If | 135 // value of Request as constructor with |input| and |init| as arguments. If |
136 // this throws an exception, reject |p| with it." | 136 // this throws an exception, reject |p| with it." |
137 TrackExceptionState exceptionState; | 137 TrackExceptionState exceptionState; |
138 Request* r = Request::create(this, urlstring, exceptionState); | 138 Request* r = Request::create(this, urlstring, exceptionState); |
139 if (exceptionState.hadException()) { | 139 if (exceptionState.hadException()) { |
140 // FIXME: We should throw the caught error. | 140 // FIXME: We should throw the caught error. |
141 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(exceptionState.message(), scriptState->isolate())); | 141 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(scriptState->isolate(), exceptionState.message())); |
142 } | 142 } |
143 return m_fetchManager->fetch(scriptState, r->request()); | 143 return m_fetchManager->fetch(scriptState, r->request()); |
144 } | 144 } |
145 | 145 |
146 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, const St
ring& urlstring, const Dictionary& requestInit) | 146 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, const St
ring& urlstring, const Dictionary& requestInit) |
147 { | 147 { |
148 if (!m_fetchManager) | 148 if (!m_fetchManager) |
149 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror("ServiceWorkerGlobalScope is shutting down.", scriptState->isolate())); | 149 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(scriptState->isolate(), "ServiceWorkerGlobalScope is shutting down.")); |
150 // "Let |r| be the associated request of the result of invoking the initial | 150 // "Let |r| be the associated request of the result of invoking the initial |
151 // value of Request as constructor with |input| and |init| as arguments. If | 151 // value of Request as constructor with |input| and |init| as arguments. If |
152 // this throws an exception, reject |p| with it." | 152 // this throws an exception, reject |p| with it." |
153 TrackExceptionState exceptionState; | 153 TrackExceptionState exceptionState; |
154 Request* r = Request::create(this, urlstring, requestInit, exceptionState); | 154 Request* r = Request::create(this, urlstring, requestInit, exceptionState); |
155 if (exceptionState.hadException()) { | 155 if (exceptionState.hadException()) { |
156 // FIXME: We should throw the caught error. | 156 // FIXME: We should throw the caught error. |
157 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(exceptionState.message(), scriptState->isolate())); | 157 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(scriptState->isolate(), exceptionState.message())); |
158 } | 158 } |
159 return m_fetchManager->fetch(scriptState, r->request()); | 159 return m_fetchManager->fetch(scriptState, r->request()); |
160 } | 160 } |
161 | 161 |
162 ServiceWorkerClients* ServiceWorkerGlobalScope::clients() | 162 ServiceWorkerClients* ServiceWorkerGlobalScope::clients() |
163 { | 163 { |
164 if (!m_clients) | 164 if (!m_clients) |
165 m_clients = ServiceWorkerClients::create(); | 165 m_clients = ServiceWorkerClients::create(); |
166 return m_clients; | 166 return m_clients; |
167 } | 167 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage,
int scriptId, const String& sourceURL, int lineNumber, int columnNumber, PassRe
fPtrWillBeRawPtr<ScriptCallStack> callStack) | 210 void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage,
int scriptId, const String& sourceURL, int lineNumber, int columnNumber, PassRe
fPtrWillBeRawPtr<ScriptCallStack> callStack) |
211 { | 211 { |
212 WorkerGlobalScope::logExceptionToConsole(errorMessage, scriptId, sourceURL,
lineNumber, columnNumber, callStack); | 212 WorkerGlobalScope::logExceptionToConsole(errorMessage, scriptId, sourceURL,
lineNumber, columnNumber, callStack); |
213 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(J
SMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber); | 213 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(J
SMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber); |
214 consoleMessage->setScriptId(scriptId); | 214 consoleMessage->setScriptId(scriptId); |
215 consoleMessage->setCallStack(callStack); | 215 consoleMessage->setCallStack(callStack); |
216 addMessageToWorkerConsole(consoleMessage.release()); | 216 addMessageToWorkerConsole(consoleMessage.release()); |
217 } | 217 } |
218 | 218 |
219 } // namespace blink | 219 } // namespace blink |
OLD | NEW |