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

Side by Side Diff: Source/core/workers/WorkerGlobalScope.cpp

Issue 743153002: [DevTools] Show stack trace for exceptions in dedicated workers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@worker-capture-stack
Patch Set: Rebased Created 6 years 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
« no previous file with comments | « Source/core/workers/WorkerGlobalScope.h ('k') | Source/core/workers/WorkerMessagingProxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved. 3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 #include "core/workers/WorkerLocation.h" 53 #include "core/workers/WorkerLocation.h"
54 #include "core/workers/WorkerNavigator.h" 54 #include "core/workers/WorkerNavigator.h"
55 #include "core/workers/WorkerReportingProxy.h" 55 #include "core/workers/WorkerReportingProxy.h"
56 #include "core/workers/WorkerScriptLoader.h" 56 #include "core/workers/WorkerScriptLoader.h"
57 #include "core/workers/WorkerThread.h" 57 #include "core/workers/WorkerThread.h"
58 #include "platform/network/ContentSecurityPolicyParsers.h" 58 #include "platform/network/ContentSecurityPolicyParsers.h"
59 #include "platform/weborigin/KURL.h" 59 #include "platform/weborigin/KURL.h"
60 #include "platform/weborigin/SecurityOrigin.h" 60 #include "platform/weborigin/SecurityOrigin.h"
61 #include "public/platform/WebURLRequest.h" 61 #include "public/platform/WebURLRequest.h"
62 62
63 namespace {
64 unsigned long createWorkerExceptionUniqueIdentifier()
65 {
66 static unsigned long s_workerExceptionUniqueIdentifier = 0;
67 return ++s_workerExceptionUniqueIdentifier;
68 }
69 }
70
63 namespace blink { 71 namespace blink {
64 72
65 class CloseWorkerGlobalScopeTask : public ExecutionContextTask { 73 class CloseWorkerGlobalScopeTask : public ExecutionContextTask {
66 public: 74 public:
67 static PassOwnPtr<CloseWorkerGlobalScopeTask> create() 75 static PassOwnPtr<CloseWorkerGlobalScopeTask> create()
68 { 76 {
69 return adoptPtr(new CloseWorkerGlobalScopeTask); 77 return adoptPtr(new CloseWorkerGlobalScopeTask);
70 } 78 }
71 79
72 virtual void performTask(ExecutionContext *context) 80 virtual void performTask(ExecutionContext *context)
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 return; 268 return;
261 } 269 }
262 } 270 }
263 } 271 }
264 272
265 EventTarget* WorkerGlobalScope::errorEventTarget() 273 EventTarget* WorkerGlobalScope::errorEventTarget()
266 { 274 {
267 return this; 275 return this;
268 } 276 }
269 277
270 void WorkerGlobalScope::logExceptionToConsole(const String& errorMessage, int, c onst String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr <ScriptCallStack>) 278 void WorkerGlobalScope::logExceptionToConsole(const String& errorMessage, int, c onst String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr <ScriptCallStack> callStack)
271 { 279 {
272 thread()->workerReportingProxy().reportException(errorMessage, lineNumber, c olumnNumber, sourceURL); 280 unsigned long exceptionId = createWorkerExceptionUniqueIdentifier();
281 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(J SMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber);
282 consoleMessage->setCallStack(callStack);
283 m_pendingMessages.set(exceptionId, consoleMessage);
284
285 thread()->workerReportingProxy().reportException(errorMessage, lineNumber, c olumnNumber, sourceURL, exceptionId);
273 } 286 }
274 287
275 void WorkerGlobalScope::reportBlockedScriptExecutionToInspector(const String& di rectiveText) 288 void WorkerGlobalScope::reportBlockedScriptExecutionToInspector(const String& di rectiveText)
276 { 289 {
277 InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText); 290 InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText);
278 } 291 }
279 292
280 void WorkerGlobalScope::addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage> prpConsoleMessage) 293 void WorkerGlobalScope::addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage> prpConsoleMessage)
281 { 294 {
282 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = prpConsoleMessage; 295 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = prpConsoleMessage;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 void WorkerGlobalScope::countDeprecation(UseCounter::Feature) const 335 void WorkerGlobalScope::countDeprecation(UseCounter::Feature) const
323 { 336 {
324 // FIXME: How should we count features for shared/service workers? 337 // FIXME: How should we count features for shared/service workers?
325 } 338 }
326 339
327 ConsoleMessageStorage* WorkerGlobalScope::messageStorage() 340 ConsoleMessageStorage* WorkerGlobalScope::messageStorage()
328 { 341 {
329 return m_messageStorage.get(); 342 return m_messageStorage.get();
330 } 343 }
331 344
345 void WorkerGlobalScope::exceptionHandled(int exceptionId, bool isHandled)
346 {
347 RefPtr<ConsoleMessage> consoleMessage = m_pendingMessages.take(exceptionId);
348 if (!isHandled)
349 addConsoleMessage(consoleMessage.release());
350 }
351
332 void WorkerGlobalScope::trace(Visitor* visitor) 352 void WorkerGlobalScope::trace(Visitor* visitor)
333 { 353 {
334 #if ENABLE(OILPAN) 354 #if ENABLE(OILPAN)
335 visitor->trace(m_console); 355 visitor->trace(m_console);
336 visitor->trace(m_location); 356 visitor->trace(m_location);
337 visitor->trace(m_navigator); 357 visitor->trace(m_navigator);
338 visitor->trace(m_workerInspectorController); 358 visitor->trace(m_workerInspectorController);
339 visitor->trace(m_eventQueue); 359 visitor->trace(m_eventQueue);
340 visitor->trace(m_workerClients); 360 visitor->trace(m_workerClients);
341 visitor->trace(m_messageStorage); 361 visitor->trace(m_messageStorage);
342 HeapSupplementable<WorkerGlobalScope>::trace(visitor); 362 HeapSupplementable<WorkerGlobalScope>::trace(visitor);
343 #endif 363 #endif
344 ExecutionContext::trace(visitor); 364 ExecutionContext::trace(visitor);
345 EventTargetWithInlineData::trace(visitor); 365 EventTargetWithInlineData::trace(visitor);
346 } 366 }
347 367
348 } // namespace blink 368 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/workers/WorkerGlobalScope.h ('k') | Source/core/workers/WorkerMessagingProxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698