| 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 f318619b35bf2b37a0696f9af59bef791840af77..8d7d97c7abe00f0e96dc1bc3f21c0ae54d9f09eb 100644
|
| --- a/src/inspector/v8-debugger-agent-impl.cc
|
| +++ b/src/inspector/v8-debugger-agent-impl.cc
|
| @@ -380,6 +380,57 @@ void V8DebuggerAgentImpl::removeBreakpoint(const String16& breakpointId) {
|
| m_breakpointIdToDebuggerBreakpointIds.erase(breakpointId);
|
| }
|
|
|
| +void V8DebuggerAgentImpl::getPossibleBreakpoints(
|
| + ErrorString* errorString,
|
| + std::unique_ptr<protocol::Debugger::Location> start,
|
| + const Maybe<protocol::Debugger::Location>& end,
|
| + std::unique_ptr<protocol::Array<protocol::Debugger::Location>>* locations) {
|
| + String16 scriptId = start->getScriptId();
|
| +
|
| + if (start->getLineNumber() < 0 || start->getColumnNumber(0) < 0) {
|
| + *errorString = "start.lineNumber and start.columnNumber should be >= 0";
|
| + return;
|
| + }
|
| +
|
| + v8::DebugInterface::Location v8Start(start->getLineNumber(),
|
| + start->getColumnNumber(0));
|
| + v8::DebugInterface::Location v8End;
|
| + if (end.isJust()) {
|
| + if (end.fromJust()->getScriptId() != scriptId) {
|
| + *errorString = "Locations should contain the same scriptId";
|
| + return;
|
| + }
|
| + int line = end.fromJust()->getLineNumber();
|
| + int column = end.fromJust()->getColumnNumber(0);
|
| + if (line < 0 || column < 0) {
|
| + *errorString = "end.lineNumber and end.columnNumber should be >= 0";
|
| + return;
|
| + }
|
| + v8End = v8::DebugInterface::Location(line, column);
|
| + }
|
| + auto it = m_scripts.find(scriptId);
|
| + if (it == m_scripts.end()) {
|
| + *errorString = "Script not found";
|
| + return;
|
| + }
|
| +
|
| + std::vector<v8::DebugInterface::Location> v8Locations;
|
| + if (!it->second->getPossibleBreakpoints(v8Start, v8End, &v8Locations)) {
|
| + *errorString = "Internal error";
|
| + return;
|
| + }
|
| +
|
| + *locations = protocol::Array<protocol::Debugger::Location>::create();
|
| + for (size_t i = 0; i < v8Locations.size(); ++i) {
|
| + (*locations)
|
| + ->addItem(protocol::Debugger::Location::create()
|
| + .setScriptId(scriptId)
|
| + .setLineNumber(v8Locations[i].GetLineNumber())
|
| + .setColumnNumber(v8Locations[i].GetColumnNumber())
|
| + .build());
|
| + }
|
| +}
|
| +
|
| void V8DebuggerAgentImpl::continueToLocation(
|
| ErrorString* errorString,
|
| std::unique_ptr<protocol::Debugger::Location> location) {
|
| @@ -547,7 +598,7 @@ void V8DebuggerAgentImpl::setScriptSource(
|
| return;
|
|
|
| ScriptsMap::iterator it = m_scripts.find(scriptId);
|
| - if (it != m_scripts.end()) it->second->setSource(m_isolate, newSource);
|
| + if (it != m_scripts.end()) it->second->setSource(newSource);
|
|
|
| std::unique_ptr<Array<CallFrame>> callFrames = currentCallFrames(errorString);
|
| if (!callFrames) return;
|
|
|