Index: third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.cpp |
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.cpp |
index 2b232efc2e714be4c5e32cd5d5f063f3ff3f2cfc..7af2a5e458d551089c10ed49ff17563656a75d8f 100644 |
--- a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.cpp |
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.cpp |
@@ -516,10 +516,15 @@ void V8DebuggerAgentImpl::searchInContent(ErrorString* error, const String16& sc |
{ |
v8::HandleScope handles(m_isolate); |
ScriptsMap::iterator it = m_scripts.find(scriptId); |
- if (it != m_scripts.end()) |
- *results = V8ContentSearchUtil::searchInTextByLines(m_session, toProtocolString(it->second->source(m_isolate)), query, optionalCaseSensitive.fromMaybe(false), optionalIsRegex.fromMaybe(false)); |
- else |
+ if (it == m_scripts.end()) { |
*error = String16("No script for id: " + scriptId); |
+ return; |
+ } |
+ |
+ std::vector<std::unique_ptr<protocol::Debugger::SearchMatch>> matches = searchInTextByLinesImpl(m_session, toProtocolString(it->second->source(m_isolate)), query, optionalCaseSensitive.fromMaybe(false), optionalIsRegex.fromMaybe(false)); |
+ *results = protocol::Array<protocol::Debugger::SearchMatch>::create(); |
+ for (size_t i = 0; i < matches.size(); ++i) |
+ (*results)->addItem(std::move(matches[i])); |
} |
void V8DebuggerAgentImpl::setScriptSource(ErrorString* errorString, |