Chromium Code Reviews| 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 2d78ce6ae036bc3a8f6b4d45cad6f3756405a7b1..7a48873680f4807f291fe3b50634420f817b26ff 100644 |
| --- a/src/inspector/v8-debugger-agent-impl.cc |
| +++ b/src/inspector/v8-debugger-agent-impl.cc |
| @@ -525,6 +525,16 @@ 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 for id: " + scriptId); |
|
dgozman
2017/02/03 20:57:25
No script with given id found
kozy
2017/02/03 21:32:55
Done.
|
| + } |
| + if (it->second->isModule()) { |
| + // TODO(kozyatinskiy): LiveEdit should support ES6 module |
| + return Response::Error( |
| + "Debugger.setScriptSource doesn't support editing ES module"); |
|
dgozman
2017/02/03 20:57:25
Editing module's script is not supported.
kozy
2017/02/03 21:32:55
Done.
|
| + } |
| + |
| v8::HandleScope handles(m_isolate); |
| v8::Local<v8::String> newSource = toV8String(m_isolate, newContent); |
| bool compileError = false; |
| @@ -533,9 +543,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; |