+2011-09-28 Vsevolod Vlasov <vsevik@chromium.org>
+
+ Web Inspector: Refactor searching in inspector, add test (fixed non regex search).
+ https://bugs.webkit.org/show_bug.cgi?id=68930
+
+ Reviewed by Yury Semikhatsky.
+
+ * http/tests/inspector/search/resources/search.css: Added.
+ (div.searchTestUniqueString):
+ (div.searchTestUniqueString:hover):
+ * http/tests/inspector/search/resources/search.html: Added.
+ * http/tests/inspector/search/resources/search.js: Added.
+ (searchTestUniqueString):
+ (doSomething):
+ * http/tests/inspector/search/search-in-resources-expected.txt: Added.
+ * http/tests/inspector/search/search-in-resources.html: Added.
+ * http/tests/inspector/search/search-test.js: Added.
+ (initialize_SearchTest.InspectorTest.dumpSearchResults):
+ (initialize_SearchTest):
+
2011-09-28 Kentaro Hara <haraken@chromium.org>
Implement a PopStateEvent constructor for V8
--- /dev/null
+div.searchTestUniqueString {
+ background-color: red;
+}
+
+div.searchTestUniqueString:hover {
+ /* another searchTestUniqueString occurence */
+ background-color: red;
+}
+
--- /dev/null
+<html>
+<head>
+<link href="search.css" rel="stylesheet" type="text/css">
+<script src="search.js"></script>
+<body>
+<div>searchTestUniqueString</div>
+<div>other text</div>
+<!-- searchTestUniqueString -->
+<div>some other text</div>
+<div id="searchTestUniqueString">div text</div>
+</body>
+</html>
+
--- /dev/null
+function searchTestUniqueString()
+{
+ var variable = 0;
+ // searchTestUniqueString two occurences on the same line searchTestUniqueString
+ var variable2 = 0;
+}
+
+function doSomething()
+{
+ searchTestUniqueString();
+ // SEARCHTestUniqueString();
+}
+
--- /dev/null
+Tests backend search in inspector.
+
+Bug 61205
+Case insensitive, non regex:
+Search results:
+url: http://127.0.0.1:8000/inspector/search/resources/search.css, matchesCount: 3
+url: http://127.0.0.1:8000/inspector/search/resources/search.js, matchesCount: 5
+url: http://127.0.0.1:8000/inspector/search/resources/search.html, matchesCount: 3
+
+Case sensitive, non regex:
+Search results:
+url: http://127.0.0.1:8000/inspector/search/resources/search.css, matchesCount: 3
+url: http://127.0.0.1:8000/inspector/search/resources/search.js, matchesCount: 4
+url: http://127.0.0.1:8000/inspector/search/resources/search.html, matchesCount: 3
+
+Case insensitive, regex:
+Search results:
+url: http://127.0.0.1:8000/inspector/search/resources/search.css, matchesCount: 3
+url: http://127.0.0.1:8000/inspector/search/resources/search.js, matchesCount: 5
+url: http://127.0.0.1:8000/inspector/search/resources/search.html, matchesCount: 3
+
+Case sensitive, regex:
+Search results:
+url: http://127.0.0.1:8000/inspector/search/resources/search.css, matchesCount: 3
+url: http://127.0.0.1:8000/inspector/search/resources/search.js, matchesCount: 4
+url: http://127.0.0.1:8000/inspector/search/resources/search.html, matchesCount: 3
+
+
--- /dev/null
+<html>
+<head>
+<script src="../inspector-test.js"></script>
+<script src="../resource-tree/resource-tree-test.js"></script>
+<script src="search-test.js"></script>
+<script>
+function test()
+{
+ // This file should not match search query.
+ var text = "searchTest" + "UniqueString";
+ InspectorTest.runAfterResourcesAreFinished(["search.js", "search.css", "search.html"], step2);
+
+ function step2()
+ {
+ InspectorTest.addResult("Case insensitive, non regex:");
+ PageAgent.searchInResources(text, false, false, step3);
+ }
+
+ function step3(error, searchResults)
+ {
+ InspectorTest.dumpSearchResults(searchResults);
+ InspectorTest.addResult("Case sensitive, non regex:");
+ PageAgent.searchInResources(text, true, false, step4);
+ }
+
+ function step4(error, searchResults)
+ {
+ InspectorTest.dumpSearchResults(searchResults);
+ InspectorTest.addResult("Case insensitive, regex:");
+ PageAgent.searchInResources(text, false, true, step5);
+ }
+
+ function step5(error, searchResults)
+ {
+ InspectorTest.dumpSearchResults(searchResults);
+ InspectorTest.addResult("Case sensitive, regex:");
+ PageAgent.searchInResources(text, true, true, step6);
+ }
+
+ function step6(error, searchResults)
+ {
+ InspectorTest.dumpSearchResults(searchResults);
+ InspectorTest.completeTest();
+ }
+}
+</script>
+</head>
+<body>
+<p>Tests backend search in inspector.</p>
+<a href="https://bugs.webkit.org/show_bug.cgi?id=61205">Bug 61205</a>
+
+<iframe src="resources/search.html" onload="runTest()">
+</body>
+</html>
--- /dev/null
+var initialize_SearchTest = function() {
+
+InspectorTest.dumpSearchResults = function(searchResults)
+{
+ InspectorTest.addResult("Search results: ");
+ for (var i = 0; i < searchResults.length; i++)
+ InspectorTest.addResult("url: " + searchResults[i].url + ", matchesCount: " + searchResults[i].matchesCount);
+ InspectorTest.addResult("");
+}
+
+};
html/shadow/TextControlInnerElements.cpp
inspector/ConsoleMessage.cpp
+ inspector/ContentSearchUtils.cpp
inspector/DOMNodeHighlighter.cpp
inspector/IdentifiersFactory.cpp
inspector/InjectedScript.cpp
+2011-09-28 Vsevolod Vlasov <vsevik@chromium.org>
+
+ Web Inspector: Refactor searching in inspector, add test (fixed non regex search).
+ https://bugs.webkit.org/show_bug.cgi?id=68930
+
+ Reviewed by Yury Semikhatsky.
+
+ Search moved out from page agent.
+ Fixed search for non regex case which is not yet used.
+
+ Test: http/tests/inspector/search/search-in-resources.html
+
+ * CMakeLists.txt:
+ * GNUmakefile.list.am:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * inspector/ContentSearchUtils.cpp: Added.
+ (WebCore::ContentSearchUtils::createSearchRegexSource):
+ (WebCore::ContentSearchUtils::createSearchRegex):
+ (WebCore::ContentSearchUtils::countRegularExpressionMatches):
+ * inspector/ContentSearchUtils.h: Added.
+ * inspector/InspectorPageAgent.cpp:
+ (WebCore::hasTextContent):
+ (WebCore::InspectorPageAgent::cachedResourceContent):
+ (WebCore::textContentForCachedResource):
+ (WebCore::buildObjectForSearchResult):
+ (WebCore::InspectorPageAgent::searchInResources):
+ * inspector/front-end/utilities.js:
+ ():
+
2011-09-28 Kentaro Hara <haraken@chromium.org>
Implement a PopStateEvent constructor for V8
Source/WebCore/icu/unicode/uversion.h \
Source/WebCore/inspector/ConsoleMessage.cpp \
Source/WebCore/inspector/ConsoleMessage.h \
+ Source/WebCore/inspector/ContentSearchUtils.cpp \
+ Source/WebCore/inspector/ContentSearchUtils.h \
Source/WebCore/inspector/DOMNodeHighlighter.cpp \
Source/WebCore/inspector/DOMNodeHighlighter.h \
Source/WebCore/inspector/IdentifiersFactory.cpp \
'icu/unicode/uversion.h',
'inspector/ConsoleMessage.cpp',
'inspector/ConsoleMessage.h',
+ 'inspector/ContentSearchUtils.cpp',
+ 'inspector/ContentSearchUtils.h',
'inspector/DOMNodeHighlighter.cpp',
'inspector/DOMNodeHighlighter.h',
'inspector/IdentifiersFactory.cpp',
html/shadow/SliderThumbElement.cpp \
html/shadow/TextControlInnerElements.cpp \
inspector/ConsoleMessage.cpp \
+ inspector/ContentSearchUtils.cpp \
inspector/DOMNodeHighlighter.cpp \
inspector/IdentifiersFactory.cpp \
inspector/InjectedScript.cpp \
html/track/WebVTTToken.h \
html/track/WebVTTTokenizer.h \
inspector/ConsoleMessage.h \
+ inspector/ContentSearchUtils.h \
inspector/DOMNodeHighlighter.h \
inspector/IdentifiersFactory.h \
inspector/InjectedScript.h \
>
</File>
<File
+ RelativePath="..\inspector\ContentSearchUtils.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\inspector\ContentSearchUtils.h"
+ >
+ </File>
+ <File
RelativePath="..\inspector\DOMNodeHighlighter.cpp"
>
</File>
5905ADC01302F3CE00F116DF /* XMLTreeViewer.h in Headers */ = {isa = PBXBuildFile; fileRef = 5905ADBE1302F3CE00F116DF /* XMLTreeViewer.h */; };
590E1B4911E4EF4B0069F784 /* DeviceOrientation.h in Headers */ = {isa = PBXBuildFile; fileRef = 590E1B4811E4EF4B0069F784 /* DeviceOrientation.h */; settings = {ATTRIBUTES = (Private, ); }; };
590E1B4B11E4EF700069F784 /* JSDeviceOrientationEventCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 590E1B4A11E4EF700069F784 /* JSDeviceOrientationEventCustom.cpp */; };
+ 59102FBB14327D3B003C9D04 /* ContentSearchUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59102FB914327D3B003C9D04 /* ContentSearchUtils.cpp */; };
+ 59102FBC14327D3B003C9D04 /* ContentSearchUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 59102FBA14327D3B003C9D04 /* ContentSearchUtils.h */; };
5913A24113D49EBA00F5B05C /* IdentifiersFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5913A23F13D49EBA00F5B05C /* IdentifiersFactory.cpp */; };
5913A24213D49EBA00F5B05C /* IdentifiersFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 5913A24013D49EBA00F5B05C /* IdentifiersFactory.h */; };
59309A1111F4AE5800250603 /* DeviceOrientationClientMock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59309A1011F4AE5800250603 /* DeviceOrientationClientMock.cpp */; };
5905ADBE1302F3CE00F116DF /* XMLTreeViewer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLTreeViewer.h; sourceTree = "<group>"; };
590E1B4811E4EF4B0069F784 /* DeviceOrientation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceOrientation.h; sourceTree = "<group>"; };
590E1B4A11E4EF700069F784 /* JSDeviceOrientationEventCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDeviceOrientationEventCustom.cpp; sourceTree = "<group>"; };
+ 59102FB914327D3B003C9D04 /* ContentSearchUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentSearchUtils.cpp; sourceTree = "<group>"; };
+ 59102FBA14327D3B003C9D04 /* ContentSearchUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentSearchUtils.h; sourceTree = "<group>"; };
5913A23F13D49EBA00F5B05C /* IdentifiersFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IdentifiersFactory.cpp; sourceTree = "<group>"; };
5913A24013D49EBA00F5B05C /* IdentifiersFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IdentifiersFactory.h; sourceTree = "<group>"; };
59309A1011F4AE5800250603 /* DeviceOrientationClientMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DeviceOrientationClientMock.cpp; path = mock/DeviceOrientationClientMock.cpp; sourceTree = "<group>"; };
1C81B9590E97330800266E07 /* front-end */,
41F0618D0F5F069800A07EAC /* ConsoleMessage.cpp */,
41F0618C0F5F069800A07EAC /* ConsoleMessage.h */,
+ 59102FB914327D3B003C9D04 /* ContentSearchUtils.cpp */,
+ 59102FBA14327D3B003C9D04 /* ContentSearchUtils.h */,
4F1442261339FD6200E0D6F8 /* DOMNodeHighlighter.cpp */,
4F1442271339FD6200E0D6F8 /* DOMNodeHighlighter.h */,
5913A23F13D49EBA00F5B05C /* IdentifiersFactory.cpp */,
1A927FD41416A15B003A83C8 /* nptypes.h in Headers */,
CECCFC3B141973D5002A0AC1 /* DecodeEscapeSequences.h in Headers */,
0FE71406142170B800DB33BA /* ScrollbarThemeMock.h in Headers */,
+ 59102FBC14327D3B003C9D04 /* ContentSearchUtils.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
A85F22091430377D007CC884 /* JSPopStateEventCustom.cpp in Sources */,
319AE063142D6B24006563A1 /* StyleFilterData.cpp in Sources */,
319AE069142D78DD006563A1 /* FilterOperations.cpp in Sources */,
+ 59102FBB14327D3B003C9D04 /* ContentSearchUtils.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
--- /dev/null
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. AND ITS CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC.
+ * OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ContentSearchUtils.h"
+
+#if ENABLE(INSPECTOR)
+
+#include "RegularExpression.h"
+
+namespace WebCore {
+namespace ContentSearchUtils {
+
+namespace {
+// This should be kept the same as the one in front-end/utilities.js
+static const char regexSpecialCharacters[] = "[](){}+-*.,?\\^$|";
+}
+
+static String createSearchRegexSource(const String& text)
+{
+ String result;
+ const UChar* characters = text.characters();
+ String specials(regexSpecialCharacters);
+
+ for (unsigned i = 0; i < text.length(); i++) {
+ if (specials.find(characters[i]) != notFound)
+ result.append("\\");
+ result.append(characters[i]);
+ }
+
+ return result;
+}
+
+RegularExpression createSearchRegex(const String& text, bool caseSensitive, bool isRegex)
+{
+ String regexSource = isRegex ? text : createSearchRegexSource(text);
+ return RegularExpression(regexSource, caseSensitive ? TextCaseSensitive : TextCaseInsensitive);
+}
+
+int countRegularExpressionMatches(const RegularExpression& regex, const String& content)
+{
+ int result = 0;
+ int position;
+ unsigned start = 0;
+ int matchLength;
+ while ((position = regex.match(content, start, &matchLength)) != -1) {
+ if (start >= content.length())
+ break;
+ if (matchLength > 0)
+ ++result;
+ start = position + 1;
+ }
+ return result;
+}
+
+} // namespace ContentSearchUtils
+} // namespace WebCore
+
+#endif // ENABLE(INSPECTOR)
--- /dev/null
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. AND ITS CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC.
+ * OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ContentSearchUtils_h
+#define ContentSearchUtils_h
+
+#include "PlatformString.h"
+
+namespace WebCore {
+
+class RegularExpression;
+
+namespace ContentSearchUtils {
+
+RegularExpression createSearchRegex(const String& text, bool caseSensitive, bool isRegex);
+int countRegularExpressionMatches(const RegularExpression&, const String&);
+
+} // namespace ContentSearchUtils
+} // namespace WebCore
+
+#endif // !defined(ContentSearchUtils_h)
#include "CachedResource.h"
#include "CachedResourceLoader.h"
#include "CachedScript.h"
+#include "ContentSearchUtils.h"
#include "Cookie.h"
#include "CookieJar.h"
#include "Document.h"
namespace WebCore {
-namespace {
-// This should be kept the same as the one in front-end/utilities.js
-static const char regexSpecialCharacters[] = "[](){}+-*.,?\\^$|";
-}
-
namespace PageAgentState {
static const char pageAgentEnabled[] = "resourceAgentEnabled";
}
return true;
}
+static bool hasTextContent(CachedResource* cachedResource)
+{
+ InspectorPageAgent::ResourceType type = InspectorPageAgent::cachedResourceType(*cachedResource);
+ return type == InspectorPageAgent::StylesheetResource || type == InspectorPageAgent::ScriptResource;
+}
+
bool InspectorPageAgent::cachedResourceContent(CachedResource* cachedResource, String* result, bool* base64Encoded)
{
bool hasZeroSize;
if (!prepared)
return false;
- ResourceType type = cachedResourceType(*cachedResource);
- *base64Encoded = type != StylesheetResource && type != ScriptResource;
-
+ *base64Encoded = !hasTextContent(cachedResource);
if (*base64Encoded) {
RefPtr<SharedBuffer> buffer = hasZeroSize ? SharedBuffer::create() : cachedResource->data();
resourceContent(errorString, frame, KURL(ParsedURLString, url), content, base64Encoded);
}
-static String createSearchRegexSource(const String& text)
-{
- String result;
- const UChar* characters = text.characters();
- String specials(regexSpecialCharacters);
-
- for (unsigned i = 0; i < text.length(); i++) {
- if (specials.find(characters[i]))
- result.append("\\");
- result.append(characters[i]);
- }
-
- return result;
-}
-
-static int countRegularExpressionMatches(const RegularExpression& regex, const String& content)
+static bool textContentForCachedResource(CachedResource* cachedResource, String* result)
{
- int result = 0;
- int position;
- unsigned start = 0;
- int matchLength;
- while ((position = regex.match(content, start, &matchLength)) != -1) {
- if (start >= content.length())
- break;
- if (matchLength > 0)
- ++result;
- start = position + 1;
+ if (hasTextContent(cachedResource)) {
+ String content;
+ bool base64Encoded;
+ if (InspectorPageAgent::cachedResourceContent(cachedResource, result, &base64Encoded)) {
+ ASSERT(!base64Encoded);
+ return true;
+ }
}
- return result;
+ return false;
}
-static PassRefPtr<InspectorObject> buildObjectForSearchMatch(const String& frameId, const String& url, int matchesCount)
+static PassRefPtr<InspectorObject> buildObjectForSearchResult(const String& frameId, const String& url, int matchesCount)
{
RefPtr<InspectorObject> result = InspectorObject::create();
result->setString("frameId", frameId);
RefPtr<InspectorArray> result = InspectorArray::create();
bool isRegex = optionalIsRegex ? *optionalIsRegex : false;
- String regexSource = isRegex ? text : createSearchRegexSource(text);
-
bool caseSensitive = optionalCaseSensitive ? *optionalCaseSensitive : false;
- RegularExpression regex(regexSource, caseSensitive ? TextCaseSensitive : TextCaseInsensitive);
+ RegularExpression regex = ContentSearchUtils::createSearchRegex(text, caseSensitive, isRegex);
for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree()->traverseNext(m_page->mainFrame())) {
String content;
- bool base64Encoded;
Vector<CachedResource*> allResources = cachedResourcesForFrame(frame);
for (Vector<CachedResource*>::const_iterator it = allResources.begin(); it != allResources.end(); ++it) {
CachedResource* cachedResource = *it;
- switch (InspectorPageAgent::cachedResourceType(*cachedResource)) {
- case InspectorPageAgent::StylesheetResource:
- case InspectorPageAgent::ScriptResource:
- if (cachedResourceContent(cachedResource, &content, &base64Encoded)) {
- ASSERT(!base64Encoded);
- int matchesCount = countRegularExpressionMatches(regex, content);
- if (matchesCount)
- result->pushValue(buildObjectForSearchMatch(frameId(frame), cachedResource->url(), matchesCount));
- }
- break;
- default:
- break;
+ if (textContentForCachedResource(cachedResource, &content)) {
+ int matchesCount = ContentSearchUtils::countRegularExpressionMatches(regex, content);
+ if (matchesCount)
+ result->pushValue(buildObjectForSearchResult(frameId(frame), cachedResource->url(), matchesCount));
}
}
if (mainResourceContent(frame, false, &content)) {
- int matchesCount = countRegularExpressionMatches(regex, content);
+ int matchesCount = ContentSearchUtils::countRegularExpressionMatches(regex, content);
if (matchesCount)
- result->pushValue(buildObjectForSearchMatch(frameId(frame), frame->document()->url(), matchesCount));
+ result->pushValue(buildObjectForSearchResult(frameId(frame), frame->document()->url(), matchesCount));
}
}
function createSearchRegex(query, extraFlags)
{
- // This should be kept the same as the one in InspectorPageAgent.cpp.
+ // This should be kept the same as the one in ContentSearchUtils.cpp.
var regexSpecialCharacters = "[](){}+-*.,?\\^$|";
var regex = "";
for (var i = 0; i < query.length; ++i) {