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 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" | 31 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" |
32 | 32 |
33 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 33 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
34 #include "bindings/core/v8/ScriptCallStack.h" | |
35 #include "bindings/core/v8/ScriptPromise.h" | 34 #include "bindings/core/v8/ScriptPromise.h" |
36 #include "bindings/core/v8/ScriptPromiseResolver.h" | 35 #include "bindings/core/v8/ScriptPromiseResolver.h" |
37 #include "bindings/core/v8/ScriptState.h" | 36 #include "bindings/core/v8/ScriptState.h" |
| 37 #include "bindings/core/v8/SourceLocation.h" |
38 #include "bindings/core/v8/V8ThrowException.h" | 38 #include "bindings/core/v8/V8ThrowException.h" |
39 #include "core/dom/ExceptionCode.h" | 39 #include "core/dom/ExceptionCode.h" |
40 #include "core/events/Event.h" | 40 #include "core/events/Event.h" |
41 #include "core/fetch/MemoryCache.h" | 41 #include "core/fetch/MemoryCache.h" |
42 #include "core/fetch/ResourceLoaderOptions.h" | 42 #include "core/fetch/ResourceLoaderOptions.h" |
43 #include "core/inspector/ConsoleMessage.h" | 43 #include "core/inspector/ConsoleMessage.h" |
44 #include "core/inspector/WorkerInspectorController.h" | 44 #include "core/inspector/WorkerInspectorController.h" |
45 #include "core/loader/ThreadableLoader.h" | 45 #include "core/loader/ThreadableLoader.h" |
46 #include "core/origin_trials/OriginTrialContext.h" | 46 #include "core/origin_trials/OriginTrialContext.h" |
47 #include "core/workers/WorkerClients.h" | 47 #include "core/workers/WorkerClients.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 for (Vector<String>::const_iterator it = urls.begin(); it != urls.end(); ++i
t) | 201 for (Vector<String>::const_iterator it = urls.begin(); it != urls.end(); ++i
t) |
202 getExecutionContext()->removeURLFromMemoryCache(completeURL(*it)); | 202 getExecutionContext()->removeURLFromMemoryCache(completeURL(*it)); |
203 WorkerGlobalScope::importScripts(urls, exceptionState); | 203 WorkerGlobalScope::importScripts(urls, exceptionState); |
204 } | 204 } |
205 | 205 |
206 CachedMetadataHandler* ServiceWorkerGlobalScope::createWorkerScriptCachedMetadat
aHandler(const KURL& scriptURL, const Vector<char>* metaData) | 206 CachedMetadataHandler* ServiceWorkerGlobalScope::createWorkerScriptCachedMetadat
aHandler(const KURL& scriptURL, const Vector<char>* metaData) |
207 { | 207 { |
208 return ServiceWorkerScriptCachedMetadataHandler::create(this, scriptURL, met
aData); | 208 return ServiceWorkerScriptCachedMetadataHandler::create(this, scriptURL, met
aData); |
209 } | 209 } |
210 | 210 |
211 void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage,
int scriptId, const String& sourceURL, int lineNumber, int columnNumber, PassRe
fPtr<ScriptCallStack> callStack) | 211 void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage,
PassOwnPtr<SourceLocation> location) |
212 { | 212 { |
213 WorkerGlobalScope::logExceptionToConsole(errorMessage, scriptId, sourceURL,
lineNumber, columnNumber, callStack); | 213 WorkerGlobalScope::logExceptionToConsole(errorMessage, location->clone()); |
214 ConsoleMessage* consoleMessage = ConsoleMessage::create(JSMessageSource, Err
orMessageLevel, errorMessage, sourceURL, lineNumber, columnNumber, callStack, sc
riptId); | 214 ConsoleMessage* consoleMessage = ConsoleMessage::create(JSMessageSource, Err
orMessageLevel, errorMessage, std::move(location)); |
215 addMessageToWorkerConsole(consoleMessage); | 215 addMessageToWorkerConsole(consoleMessage); |
216 } | 216 } |
217 | 217 |
218 void ServiceWorkerGlobalScope::scriptLoaded(size_t scriptSize, size_t cachedMeta
dataSize) | 218 void ServiceWorkerGlobalScope::scriptLoaded(size_t scriptSize, size_t cachedMeta
dataSize) |
219 { | 219 { |
220 ++m_scriptCount; | 220 ++m_scriptCount; |
221 m_scriptTotalSize += scriptSize; | 221 m_scriptTotalSize += scriptSize; |
222 m_scriptCachedMetadataTotalSize += cachedMetadataSize; | 222 m_scriptCachedMetadataTotalSize += cachedMetadataSize; |
223 } | 223 } |
224 | 224 |
225 } // namespace blink | 225 } // namespace blink |
OLD | NEW |