Commit 656c5bd8 authored by pfeldman@chromium.org's avatar pfeldman@chromium.org

2011-03-15 Pavel Feldman <pfeldman@chromium.org>

        Reviewed by Yury Semikhatsky.

        Web Inspector: crash upon "//html//@id" search in elements panel.
        https://bugs.webkit.org/show_bug.cgi?id=56334

        * inspector/elements/elements-panel-search-expected.txt:
        * inspector/elements/elements-panel-search.html:
2011-03-15  Pavel Feldman  <pfeldman@chromium.org>

        Reviewed by Yury Semikhatsky.

        Web Inspector: crash upon "//html//@id" search in elements panel.
        https://bugs.webkit.org/show_bug.cgi?id=56334

        * inspector/InspectorDOMAgent.cpp:
        * inspector/front-end/ElementsTreeOutline.js:

git-svn-id: svn://svn.chromium.org/blink/trunk@81132 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent e26a12e3
2011-03-15 Pavel Feldman <pfeldman@chromium.org>
Reviewed by Yury Semikhatsky.
Web Inspector: crash upon "//html//@id" search in elements panel.
https://bugs.webkit.org/show_bug.cgi?id=56334
* inspector/elements/elements-panel-search-expected.txt:
* inspector/elements/elements-panel-search.html:
2011-03-15 Andrey Kosyakov <caseq@chromium.org> 2011-03-15 Andrey Kosyakov <caseq@chromium.org>
Unreviewed. Swap two calls to setMonitoringXHREnabled to get rid of side effects on other tests. Unreviewed. Swap two calls to setMonitoringXHREnabled to get rid of side effects on other tests.
...@@ -11,4 +11,5 @@ FooBar ...@@ -11,4 +11,5 @@ FooBar
<input value="InputVal"> <input value="InputVal">
<input value="InputVal"> <input value="InputVal">
<input value="InputVal"> <input value="InputVal">
<div attr="foo"></div>
...@@ -52,6 +52,8 @@ function test() ...@@ -52,6 +52,8 @@ function test()
WebInspector.domAgent.performSearch("In" + "putVa" + "l", addNodesToSearchResult, true); WebInspector.domAgent.performSearch("In" + "putVa" + "l", addNodesToSearchResult, true);
// Partial attribute val<>ue. // Partial attribute val<>ue.
WebInspector.domAgent.performSearch("n" + "putVa" + "l", addNodesToSearchResult, true); WebInspector.domAgent.performSearch("n" + "putVa" + "l", addNodesToSearchResult, true);
// XPath attribute.
WebInspector.domAgent.performSearch("//html" + "//@attr", addNodesToSearchResult, true);
// Terminator. // Terminator.
WebInspector.domAgent.performSearch("ter" + "mi" + "nator", addNodesToSearchResult, true); WebInspector.domAgent.performSearch("ter" + "mi" + "nator", addNodesToSearchResult, true);
} }
...@@ -66,6 +68,7 @@ Tests that elements panel search is returning proper results. ...@@ -66,6 +68,7 @@ Tests that elements panel search is returning proper results.
<div>FooBar</div> <div>FooBar</div>
<input value="InputVal"> <input value="InputVal">
<div attr="foo"></div>
<div id="terminator"></div> <div id="terminator"></div>
</body> </body>
......
2011-03-15 Pavel Feldman <pfeldman@chromium.org>
Reviewed by Yury Semikhatsky.
Web Inspector: crash upon "//html//@id" search in elements panel.
https://bugs.webkit.org/show_bug.cgi?id=56334
* inspector/InspectorDOMAgent.cpp:
* inspector/front-end/ElementsTreeOutline.js:
2011-03-15 Andrey Kosyakov <caseq@chromium.org> 2011-03-15 Andrey Kosyakov <caseq@chromium.org>
Reviewed by Yury Semikhatsky. Reviewed by Yury Semikhatsky.
......
...@@ -206,8 +206,12 @@ public: ...@@ -206,8 +206,12 @@ public:
unsigned long size = result->snapshotLength(ec); unsigned long size = result->snapshotLength(ec);
for (unsigned long i = 0; !ec && i < size; ++i) { for (unsigned long i = 0; !ec && i < size; ++i) {
Node* node = result->snapshotItem(i, ec); Node* node = result->snapshotItem(i, ec);
if (!ec) if (ec)
resultCollector.add(node); break;
if (node->nodeType() == Node::ATTRIBUTE_NODE)
node = static_cast<Attr*>(node)->ownerElement();
resultCollector.add(node);
} }
#else #else
UNUSED_PARAM(resultCollector); UNUSED_PARAM(resultCollector);
......
...@@ -1492,6 +1492,11 @@ WebInspector.ElementsTreeElement.prototype = { ...@@ -1492,6 +1492,11 @@ WebInspector.ElementsTreeElement.prototype = {
matchRanges.push({ offset: match.index, length: match[0].length }); matchRanges.push({ offset: match.index, length: match[0].length });
match = regexObject.exec(text); match = regexObject.exec(text);
} }
// Fall back for XPath, etc. matches.
if (!matchRanges.length)
matchRanges.push({ offset: 0, length: text.length });
highlightSearchResults(this.listItemElement, matchRanges); highlightSearchResults(this.listItemElement, matchRanges);
this._searchHighlightedHTML = this.listItemElement.innerHTML; this._searchHighlightedHTML = this.listItemElement.innerHTML;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment