Filter WS messages with regular expressions
Categories
(DevTools :: Netmonitor, enhancement, P3)
Tracking
(firefox75 fixed)
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
(4 files)
For having consistently powerful filtering.
Updated•5 years ago
|
Comment 1•5 years ago
|
||
This will be great feature, thanks for the report!
Some instructions for anyone interested in implementing this new feature:
-
A test page for WebSocket connection:
http://janodvarko.cz/test/websockets/ -
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 -
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 -
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 -
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
Comment 2•5 years ago
|
||
A screenshot showing the filter input box in the UI
Honza
Updated•5 years ago
|
Updated•5 years ago
|
Comment 3•5 years ago
|
||
Allow to search WS messages with regular expressions for more flexible search and
have the same experience as other panels (like WebConsole)
Comment 4•5 years ago
|
||
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
Comment 5•5 years ago
|
||
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?
Comment 6•5 years ago
|
||
No answer from Andres. Let me unassign this bug so other people can pick up from here.
Updated•5 years ago
|
This test is based on browser_net-ws-filter-freetext.js.
Depends on D64409
Comment 10•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/830eca484fef
https://hg.mozilla.org/mozilla-central/rev/f7dd4fb8ea09
Comment 11•5 years ago
•
|
||
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.
Assignee | ||
Comment 12•5 years ago
|
||
(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...
Comment 13•5 years ago
|
||
Docs updated:
- Updated the Network monitor toolbar page to improve a couple of sentences that were lacking useful information
- Added the regexp support information to the main article with filtering info, Network request list
- Added to Firefox 75 for developers
Description
•