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

Unified Diff: src/inspector/v8-debugger.cc

Issue 2669933003: Merged: Fix uncaught exception bug from liveEditScriptSource (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/inspector/v8-debugger.h ('k') | test/inspector/debugger/set-script-source-exception.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/inspector/v8-debugger.cc
diff --git a/src/inspector/v8-debugger.cc b/src/inspector/v8-debugger.cc
index 39cc556fb920bebb164c7b077e7aef6e340dd837..2563f4f36cd2ed55b02f9e0ca6ae18f0be65fbca 100644
--- a/src/inspector/v8-debugger.cc
+++ b/src/inspector/v8-debugger.cc
@@ -35,7 +35,8 @@ inline v8::Local<v8::Boolean> v8Boolean(bool value, v8::Isolate* isolate) {
static bool inLiveEditScope = false;
v8::MaybeLocal<v8::Value> V8Debugger::callDebuggerMethod(
- const char* functionName, int argc, v8::Local<v8::Value> argv[]) {
+ const char* functionName, int argc, v8::Local<v8::Value> argv[],
+ bool catchExceptions) {
v8::MicrotasksScope microtasks(m_isolate,
v8::MicrotasksScope::kDoNotRunMicrotasks);
DCHECK(m_isolate->InContext());
@@ -45,7 +46,10 @@ v8::MaybeLocal<v8::Value> V8Debugger::callDebuggerMethod(
debuggerScript
->Get(context, toV8StringInternalized(m_isolate, functionName))
.ToLocalChecked());
- v8::TryCatch try_catch(m_isolate);
+ if (catchExceptions) {
+ v8::TryCatch try_catch(m_isolate);
+ return function->Call(context, debuggerScript, argc, argv);
+ }
return function->Call(context, debuggerScript, argc, argv);
}
@@ -338,7 +342,7 @@ Response V8Debugger::setScriptSource(
v8::TryCatch tryCatch(m_isolate);
tryCatch.SetVerbose(false);
v8::MaybeLocal<v8::Value> maybeResult =
- callDebuggerMethod("liveEditScriptSource", 3, argv);
+ callDebuggerMethod("liveEditScriptSource", 3, argv, false);
if (tryCatch.HasCaught()) {
v8::Local<v8::Message> message = tryCatch.Message();
if (!message.IsEmpty())
@@ -415,7 +419,7 @@ JavaScriptCallFrames V8Debugger::currentCallFrames(int limit) {
} else {
v8::Local<v8::Value> argv[] = {m_executionState,
v8::Integer::New(m_isolate, limit)};
- if (!callDebuggerMethod("currentCallFrames", arraysize(argv), argv)
+ if (!callDebuggerMethod("currentCallFrames", arraysize(argv), argv, true)
.ToLocal(&currentCallFramesV8))
return JavaScriptCallFrames();
}
@@ -584,7 +588,7 @@ void V8Debugger::handleV8DebugEvent(
} else if (event == v8::Break) {
v8::Local<v8::Value> argv[] = {eventDetails.GetEventData()};
v8::Local<v8::Value> hitBreakpoints;
- if (!callDebuggerMethod("getBreakpointNumbers", 1, argv)
+ if (!callDebuggerMethod("getBreakpointNumbers", 1, argv, true)
.ToLocal(&hitBreakpoints))
return;
DCHECK(hitBreakpoints->IsArray());
@@ -680,7 +684,7 @@ v8::MaybeLocal<v8::Value> V8Debugger::getTargetScopes(
break;
}
- if (!callDebuggerMethod(debuggerMethod, 1, argv).ToLocal(&scopesValue))
+ if (!callDebuggerMethod(debuggerMethod, 1, argv, true).ToLocal(&scopesValue))
return v8::MaybeLocal<v8::Value>();
v8::Local<v8::Value> copied;
if (!copyValueFromDebuggerContext(m_isolate, debuggerContext(), context,
@@ -777,7 +781,7 @@ v8::Local<v8::Value> V8Debugger::collectionEntries(
}
v8::Local<v8::Value> argv[] = {object};
v8::Local<v8::Value> entriesValue;
- if (!callDebuggerMethod("getCollectionEntries", 1, argv)
+ if (!callDebuggerMethod("getCollectionEntries", 1, argv, true)
.ToLocal(&entriesValue) ||
!entriesValue->IsArray())
return v8::Undefined(m_isolate);
@@ -815,7 +819,7 @@ v8::Local<v8::Value> V8Debugger::generatorObjectLocation(
v8::Local<v8::Value> argv[] = {object};
v8::Local<v8::Value> location;
v8::Local<v8::Value> copied;
- if (!callDebuggerMethod("getGeneratorObjectLocation", 1, argv)
+ if (!callDebuggerMethod("getGeneratorObjectLocation", 1, argv, true)
.ToLocal(&location) ||
!copyValueFromDebuggerContext(m_isolate, debuggerContext(), context,
location)
« no previous file with comments | « src/inspector/v8-debugger.h ('k') | test/inspector/debugger/set-script-source-exception.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698