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

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

Issue 2669713002: [inspector] return meaningful error on Debug.setScriptSource for ES module (Closed)
Patch Set: addressed comments Created 3 years, 10 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 | « no previous file | test/inspector/debugger/es6-module-set-script-source.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/inspector/v8-debugger-agent-impl.cc
diff --git a/src/inspector/v8-debugger-agent-impl.cc b/src/inspector/v8-debugger-agent-impl.cc
index 6914082e700486ea7bc7066466e565d1e5ac3e3e..664c2ed095a0545d2ee655c3b15178e21e056f3f 100644
--- a/src/inspector/v8-debugger-agent-impl.cc
+++ b/src/inspector/v8-debugger-agent-impl.cc
@@ -522,6 +522,15 @@ Response V8DebuggerAgentImpl::setScriptSource(
Maybe<protocol::Runtime::ExceptionDetails>* optOutCompileError) {
if (!enabled()) return Response::Error(kDebuggerNotEnabled);
+ ScriptsMap::iterator it = m_scripts.find(scriptId);
+ if (it == m_scripts.end()) {
+ return Response::Error("No script with given id found");
+ }
+ if (it->second->isModule()) {
+ // TODO(kozyatinskiy): LiveEdit should support ES6 module
+ return Response::Error("Editing module's script is not supported.");
+ }
+
v8::HandleScope handles(m_isolate);
v8::Local<v8::String> newSource = toV8String(m_isolate, newContent);
bool compileError = false;
@@ -530,9 +539,7 @@ Response V8DebuggerAgentImpl::setScriptSource(
&m_pausedCallFrames, stackChanged, &compileError);
if (!response.isSuccess() || compileError) return response;
- ScriptsMap::iterator it = m_scripts.find(scriptId);
- if (it != m_scripts.end()) it->second->setSource(newSource);
-
+ it->second->setSource(newSource);
std::unique_ptr<Array<CallFrame>> callFrames;
response = currentCallFrames(&callFrames);
if (!response.isSuccess()) return response;
« no previous file with comments | « no previous file | test/inspector/debugger/es6-module-set-script-source.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698