Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp

Issue 625943002: Catch uncaught promise rejections from V8 and log to console. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: addressed Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 17 matching lines...) Expand all
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 #include "config.h" 30 #include "config.h"
31 #include "ServiceWorkerGlobalScope.h" 31 #include "ServiceWorkerGlobalScope.h"
32 32
33 #include "bindings/core/v8/ScriptPromise.h" 33 #include "bindings/core/v8/ScriptPromise.h"
34 #include "bindings/core/v8/ScriptState.h" 34 #include "bindings/core/v8/ScriptState.h"
35 #include "bindings/core/v8/V8ThrowException.h" 35 #include "bindings/core/v8/V8ThrowException.h"
36 #include "core/fetch/MemoryCache.h" 36 #include "core/fetch/MemoryCache.h"
37 #include "core/fetch/ResourceLoaderOptions.h" 37 #include "core/fetch/ResourceLoaderOptions.h"
38 #include "core/inspector/ScriptArguments.h"
38 #include "core/inspector/ScriptCallStack.h" 39 #include "core/inspector/ScriptCallStack.h"
39 #include "core/loader/ThreadableLoader.h" 40 #include "core/loader/ThreadableLoader.h"
40 #include "core/workers/WorkerClients.h" 41 #include "core/workers/WorkerClients.h"
41 #include "core/workers/WorkerThreadStartupData.h" 42 #include "core/workers/WorkerThreadStartupData.h"
42 #include "modules/EventTargetModules.h" 43 #include "modules/EventTargetModules.h"
43 #include "modules/serviceworkers/CacheStorage.h" 44 #include "modules/serviceworkers/CacheStorage.h"
44 #include "modules/serviceworkers/FetchManager.h" 45 #include "modules/serviceworkers/FetchManager.h"
45 #include "modules/serviceworkers/Request.h" 46 #include "modules/serviceworkers/Request.h"
46 #include "modules/serviceworkers/ServiceWorkerClients.h" 47 #include "modules/serviceworkers/ServiceWorkerClients.h"
47 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" 48 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 void ServiceWorkerGlobalScope::importScripts(const Vector<String>& urls, Excepti onState& exceptionState) 181 void ServiceWorkerGlobalScope::importScripts(const Vector<String>& urls, Excepti onState& exceptionState)
181 { 182 {
182 // Bust the MemoryCache to ensure script requests reach the browser-side 183 // Bust the MemoryCache to ensure script requests reach the browser-side
183 // and get added to and retrieved from the ServiceWorker's script cache. 184 // and get added to and retrieved from the ServiceWorker's script cache.
184 // FIXME: Revisit in light of the solution to crbug/388375. 185 // FIXME: Revisit in light of the solution to crbug/388375.
185 for (Vector<String>::const_iterator it = urls.begin(); it != urls.end(); ++i t) 186 for (Vector<String>::const_iterator it = urls.begin(); it != urls.end(); ++i t)
186 MemoryCache::removeURLFromCache(this->executionContext(), completeURL(*i t)); 187 MemoryCache::removeURLFromCache(this->executionContext(), completeURL(*i t));
187 WorkerGlobalScope::importScripts(urls, exceptionState); 188 WorkerGlobalScope::importScripts(urls, exceptionState);
188 } 189 }
189 190
190 void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage, int scriptId, const String& sourceURL, int lineNumber, int columnNumber, PassRe fPtrWillBeRawPtr<ScriptCallStack> callStack) 191 void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage, int scriptId, const String& sourceURL, int lineNumber, int columnNumber, PassRe fPtrWillBeRawPtr<ScriptCallStack> callStack, PassRefPtrWillBeRawPtr<ScriptArgume nts> arguments)
191 { 192 {
192 WorkerGlobalScope::logExceptionToConsole(errorMessage, scriptId, sourceURL, lineNumber, columnNumber, callStack); 193 WorkerGlobalScope::logExceptionToConsole(errorMessage, scriptId, sourceURL, lineNumber, columnNumber, callStack, arguments);
193 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(J SMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber); 194 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(J SMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber);
194 consoleMessage->setScriptId(scriptId); 195 consoleMessage->setScriptId(scriptId);
195 consoleMessage->setCallStack(callStack); 196 consoleMessage->setCallStack(callStack);
197 consoleMessage->setScriptArguments(arguments);
196 addMessageToWorkerConsole(consoleMessage.release()); 198 addMessageToWorkerConsole(consoleMessage.release());
197 } 199 }
198 200
199 } // namespace blink 201 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698