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

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: typo 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 unsigned ThreadDebugger::promiseRejected(v8::Local<v8::Context> context, const S tring16& errorMessage, v8::Local<v8::Value> exception, std::unique_ptr<SourceLoc ation> location) 104 unsigned ThreadDebugger::promiseRejected(v8::Local<v8::Context> context, const S tring16& errorMessage, v8::Local<v8::Value> exception, std::unique_ptr<SourceLoc ation> location)
105 { 105 {
106 const String16 defaultMessage = "Uncaught (in promise)"; 106 const String16 defaultMessage = "Uncaught (in promise)";
107 String16 message = errorMessage; 107 String16 message = errorMessage;
108 if (message.isEmpty()) 108 if (message.isEmpty())
109 message = defaultMessage; 109 message = defaultMessage;
110 else if (message.startWith("Uncaught ")) 110 else if (message.startWith("Uncaught "))
111 message = message.substring(0, 8) + " (in promise)" + message.substring( 8); 111 message = message.substring(0, 8) + " (in promise)" + message.substring( 8);
112 112
113 unsigned result = debugger()->promiseRejected(context, message, exception, l ocation->url(), location->lineNumber(), location->columnNumber(), location->clon eStackTrace(), location->scriptId()); 113 unsigned result = debugger()->exceptionThrown(context, defaultMessage, excep tion, message, location->url(), location->lineNumber(), location->columnNumber() , location->cloneStackTrace(), location->scriptId());
114 // TODO(dgozman): maybe not wrap in ConsoleMessage. 114 // TODO(dgozman): do not wrap in ConsoleMessage.
115 reportConsoleMessage(toExecutionContext(context), ConsoleMessage::create(JSM essageSource, ErrorMessageLevel, message, std::move(location))); 115 reportConsoleMessage(toExecutionContext(context), ConsoleMessage::create(JSM essageSource, ErrorMessageLevel, message, std::move(location)));
116 return result; 116 return result;
117 } 117 }
118 118
119 void ThreadDebugger::promiseRejectionRevoked(v8::Local<v8::Context> context, uns igned promiseRejectionId)
120 {
121 const String16 message = "Handler added to rejected promise";
122 debugger()->exceptionRevoked(context, promiseRejectionId, message);
123 }
124
119 void ThreadDebugger::beginUserGesture() 125 void ThreadDebugger::beginUserGesture()
120 { 126 {
121 m_userGestureIndicator = wrapUnique(new UserGestureIndicator(DefinitelyProce ssingNewUserGesture)); 127 m_userGestureIndicator = wrapUnique(new UserGestureIndicator(DefinitelyProce ssingNewUserGesture));
122 } 128 }
123 129
124 void ThreadDebugger::endUserGesture() 130 void ThreadDebugger::endUserGesture()
125 { 131 {
126 m_userGestureIndicator.reset(); 132 m_userGestureIndicator.reset();
127 } 133 }
128 134
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 { 383 {
378 for (size_t index = 0; index < m_timers.size(); ++index) { 384 for (size_t index = 0; index < m_timers.size(); ++index) {
379 if (m_timers[index].get() == timer) { 385 if (m_timers[index].get() == timer) {
380 m_timerCallbacks[index](m_timerData[index]); 386 m_timerCallbacks[index](m_timerData[index]);
381 return; 387 return;
382 } 388 }
383 } 389 }
384 } 390 }
385 391
386 } // namespace blink 392 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698