Index: Source/WebCore/inspector/front-end/ContentProviders.js |
=================================================================== |
--- Source/WebCore/inspector/front-end/ContentProviders.js (revision 98227) |
+++ Source/WebCore/inspector/front-end/ContentProviders.js (working copy) |
@@ -304,7 +304,27 @@ |
*/ |
searchInContent: function(query, caseSensitive, isRegex, callback) |
{ |
- callback([]); |
+ function performSearch() |
+ { |
+ var regex = createSearchRegex(query, caseSensitive, isRegex); |
+ |
+ var result = []; |
+ var lineEndings = this._content.lineEndings(); |
+ for (var i = 0; i < lineEndings.length; ++i) { |
+ var lineStart = i > 0 ? lineEndings[i - 1] + 1 : 0; |
+ var lineEnd = lineEndings[i]; |
+ var lineContent = this._content.substring(lineStart, lineEnd); |
+ if (lineContent.length > 0 && lineContent.charAt(lineContent.length - 1) === "\r") |
+ lineContent = lineContent.substring(0, lineContent.length - 1) |
+ |
+ if (regex.exec(lineContent)) |
+ result.push(new WebInspector.ContentProvider.SearchMatch(i, lineContent)); |
+ } |
+ callback(result); |
+ } |
+ |
+ // searchInContent should call back later. |
+ window.setTimeout(performSearch.bind(this), 0); |
} |
} |