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

Side by Side Diff: third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp

Issue 2170263002: [DevTools] Pass error object when reporting exceptions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: worklets! Created 4 years, 4 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/inspector/ThreadDebugger.h" 5 #include "core/inspector/ThreadDebugger.h"
6 6
7 #include "bindings/core/v8/SourceLocation.h" 7 #include "bindings/core/v8/SourceLocation.h"
8 #include "bindings/core/v8/V8Binding.h" 8 #include "bindings/core/v8/V8Binding.h"
9 #include "bindings/core/v8/V8DOMException.h" 9 #include "bindings/core/v8/V8DOMException.h"
10 #include "bindings/core/v8/V8DOMTokenList.h" 10 #include "bindings/core/v8/V8DOMTokenList.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 110
111 unsigned ThreadDebugger::promiseRejected(v8::Local<v8::Context> context, const S tring16& errorMessage, v8::Local<v8::Value> exception, std::unique_ptr<SourceLoc ation> location) 111 unsigned ThreadDebugger::promiseRejected(v8::Local<v8::Context> context, const S tring16& errorMessage, v8::Local<v8::Value> exception, std::unique_ptr<SourceLoc ation> location)
112 { 112 {
113 const String16 defaultMessage = "Uncaught (in promise)"; 113 const String16 defaultMessage = "Uncaught (in promise)";
114 String16 message = errorMessage; 114 String16 message = errorMessage;
115 if (message.isEmpty()) 115 if (message.isEmpty())
116 message = defaultMessage; 116 message = defaultMessage;
117 else if (message.startWith("Uncaught ")) 117 else if (message.startWith("Uncaught "))
118 message = message.substring(0, 8) + " (in promise)" + message.substring( 8); 118 message = message.substring(0, 8) + " (in promise)" + message.substring( 8);
119 119
120 unsigned result = debugger()->promiseRejected(context, message, exception, l ocation->url(), location->lineNumber(), location->columnNumber(), location->clon eStackTrace(), location->scriptId()); 120 unsigned result = debugger()->exceptionThrown(context, defaultMessage, excep tion, message, location->url(), location->lineNumber(), location->columnNumber() , location->cloneStackTrace(), location->scriptId());
121 // TODO(dgozman): maybe not wrap in ConsoleMessage. 121 // TODO(dgozman): do not wrap in ConsoleMessage.
122 reportConsoleMessage(toExecutionContext(context), ConsoleMessage::create(JSM essageSource, ErrorMessageLevel, message, std::move(location))); 122 reportConsoleMessage(toExecutionContext(context), ConsoleMessage::create(JSM essageSource, ErrorMessageLevel, message, std::move(location)));
123 return result; 123 return result;
124 } 124 }
125 125
126 void ThreadDebugger::promiseRejectionRevoked(v8::Local<v8::Context> context, uns igned promiseRejectionId)
127 {
128 const String16 message = "Handler added to rejected promise";
129 debugger()->exceptionRevoked(context, promiseRejectionId, message);
130 }
131
126 void ThreadDebugger::beginUserGesture() 132 void ThreadDebugger::beginUserGesture()
127 { 133 {
128 m_userGestureIndicator = wrapUnique(new UserGestureIndicator(DefinitelyProce ssingNewUserGesture)); 134 m_userGestureIndicator = wrapUnique(new UserGestureIndicator(DefinitelyProce ssingNewUserGesture));
129 } 135 }
130 136
131 void ThreadDebugger::endUserGesture() 137 void ThreadDebugger::endUserGesture()
132 { 138 {
133 m_userGestureIndicator.reset(); 139 m_userGestureIndicator.reset();
134 } 140 }
135 141
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 { 378 {
373 for (size_t index = 0; index < m_timers.size(); ++index) { 379 for (size_t index = 0; index < m_timers.size(); ++index) {
374 if (m_timers[index].get() == timer) { 380 if (m_timers[index].get() == timer) {
375 m_timerCallbacks[index](m_timerData[index]); 381 m_timerCallbacks[index](m_timerData[index]);
376 return; 382 return;
377 } 383 }
378 } 384 }
379 } 385 }
380 386
381 } // namespace blink 387 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698