Closed Bug 1580188 Opened 5 years ago Closed 5 years ago

Not all search matches are highlighted

Categories

(DevTools :: Netmonitor, defect, P2)

defect

Tracking

(firefox71 fixed)

RESOLVED FIXED
Firefox 71
Tracking Status
firefox71 --- fixed

People

(Reporter: Honza, Assigned: lalas)

References

Details

Attachments

(2 files)

It looks like that not all search matches are highlighted in the Search panel. See the attached screenshot

  • Only the first two search results have highlighted the search-keyword
  • The fourth and fifth results don't highlighted anything
  • The third result is there because match was with the Cookie name also not highlighted.

Honza

@Lloan, could you please look at this one?
Honza

Blocks: 1572145
Flags: needinfo?(lloanalas)

It somehow relates to the fact the the search-string is at the begginning of a cookie (or header) value.
So, the start index is 0, which if used in a condition might be resulting with false even if it's
valid index. Or something like that...

I found this place. Fixing that helps, but not sure if it's the only place...

diff --git a/devtools/client/netmonitor/src/components/search/SearchPanel.js b/devtools/client/netmonitor/src/compo--- a/devtools/client/netmonitor/src/components/search/SearchPanel.js
+++ b/devtools/client/netmonitor/src/components/search/SearchPanel.js
@@ -163,17 +163,17 @@ class SearchPanel extends Component {
       }

       const indexStart = caseSensitive
         ? object.value.indexOf(query)
         : object.value.toLowerCase().indexOf(query.toLowerCase());
       const indexEnd = indexStart + query.length;

       // Handles a match in a string
-      if (indexStart > 0) {
+      if (indexStart >= 0) {
         return span(
           { title: object.value },
           span({}, object.value.substring(0, indexStart)),
           span(
             { className: "query-match" },
             object.value.substring(indexStart, indexStart + query.length)
           ),
           span({}, object.value.substring(indexEnd, object.value.length))

Honza

Honza,

That should be the only place. I see the error now - its not taking in to account when the index starts at 0. I'll create a patch for this - thanks!

Flags: needinfo?(lloanalas)
Attached image image.png

Check out the following match at the screenshot:

MyCustomCookie: Workers+eat+cookies

The Workers part isn't highlighted.

Honza

Assignee: nobody → lloanalas
Status: NEW → ASSIGNED
Pushed by jodvarko@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1e329466ec57
Not all search matches are highlighted. r=Honza
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 71
QA Whiteboard: [qa-71b-p2]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: