Closed Bug 1593837 Opened 7 years ago Closed 6 years ago

Filter WS messages with regular expressions

Categories

(DevTools :: Netmonitor, enhancement, P3)

enhancement

Tracking

(firefox75 fixed)

RESOLVED FIXED
Firefox 75
Tracking Status
firefox75 --- fixed

People

(Reporter: Harald, Assigned: i, Mentored)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete, good-first-bug)

User Story

When filtering WS messages I want to use regular expressions (just like in Console), so that I can be more flexible and have the same experience as other panels (namely Console).

Attachments

(1 file, 3 external files)

For having consistently powerful filtering.

This will be great feature, thanks for the report!

Some instructions for anyone interested in implementing this new feature:

  1. A test page for WebSocket connection:
    http://janodvarko.cz/test/websockets/

  2. The Filter Messages input box is rendered here:
    https://searchfox.org/mozilla-central/rev/3300072e993ae05d50d5c63d815260367eaf9179/devtools/client/netmonitor/src/components/websockets/Toolbar.js#96-105

  3. When the user types into the Filter box setFrameFilterText Redux action is fired here:
    https://searchfox.org/mozilla-central/rev/3300072e993ae05d50d5c63d815260367eaf9179/devtools/client/netmonitor/src/components/websockets/Toolbar.js#132

  4. The action is handled in WebSockets reducer here:
    https://searchfox.org/mozilla-central/rev/3300072e993ae05d50d5c63d815260367eaf9179/devtools/client/netmonitor/src/reducers/web-sockets.js#139-144

  5. The list of displayed WS frames is generated by getDisplayedFrames called here
    https://searchfox.org/mozilla-central/rev/3300072e993ae05d50d5c63d815260367eaf9179/devtools/client/netmonitor/src/components/websockets/FrameListContent.js#345

The method is implemented here:
https://searchfox.org/mozilla-central/rev/3300072e993ae05d50d5c63d815260367eaf9179/devtools/client/netmonitor/src/selectors/web-sockets.js#13-34

The goal of this report is to enhance the getDisplayedFrames method and use regular expression API instead of just simple include
https://searchfox.org/mozilla-central/rev/3300072e993ae05d50d5c63d815260367eaf9179/devtools/client/netmonitor/src/selectors/web-sockets.js#29-30

RegExp MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp

Honza

Attached image image.png —

A screenshot showing the filter input box in the UI

Honza

Assignee: nobody → adresortegao
Status: NEW → ASSIGNED

Allow to search WS messages with regular expressions for more flexible search and
have the same experience as other panels (like WebConsole)

I look at the code on https://searchfox.org/mozilla-central/source/devtools/client/webconsole/reducers/messages.js#1286 to do something similar. There's probably an opportunity for refactoring the code for checking if the search text is a regex, and the regex creation

Hey Andres, I noticed this bug has not been updated in a couple month. The patch you posted on phabricator looks great and Honza asked for some changes there.
Do you need any help with those?

Flags: needinfo?(adresortegao)

No answer from Andres. Let me unassign this bug so other people can pick up from here.

Assignee: adresortegao → nobody
Status: ASSIGNED → NEW
Flags: needinfo?(adresortegao)
Assignee: nobody → i
Status: NEW → ASSIGNED

This test is based on browser_net-ws-filter-freetext.js.

Depends on D64409

Pushed by jodvarko@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/830eca484fef Filter WS messages with regular expressions. r=Honza https://hg.mozilla.org/integration/autoland/rev/f7dd4fb8ea09 Add corresponding tests. r=Honza
Blocks: 1617277
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 75

Is there a trick or hidden preference I need to enable to make this work? because I can't get regexps to work in the WebSocket dev tools panel at all. I'm on Nightly 75.

Never mind. My command-line "run a fresh profile" command accidentally launched the current release version instead of nightly.

(In reply to Eric Shepherd [:sheppy] from comment #11)

Is there a trick or hidden preference I need to enable to make this work? because I can't get regexps to work in the WebSocket dev tools panel at all. I'm on Nightly 75.

No hidden preference, but you need to use this format: /regex/ (e.g. /a.*b/) so that it can be recognized as RegEx. See https://phabricator.services.mozilla.com/D64409.

I think it's better to document this feature somewhere...

Docs updated:

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: