Allow wildcards (*) for blocking URLs
Categories
(DevTools :: Netmonitor, enhancement, P3)
Tracking
(firefox75 verified)
Tracking | Status | |
---|---|---|
firefox75 | --- | verified |
People
(Reporter: Harald, Assigned: duncangleeddean)
References
(Blocks 1 open bug)
Details
(Keywords: dev-doc-needed, good-first-bug)
User Story
When blocking a set of requests with changing paths/files/etc, I want to add requests with wild cards, so that I can block all similar-looking URLs.
Attachments
(1 file)
Reporter | ||
Updated•4 years ago
|
Reporter | ||
Comment 1•4 years ago
•
|
||
Some of the initial work landed in https://phabricator.services.mozilla.com/D46671
URLs get blocked here: https://searchfox.org/mozilla-central/source/devtools/server/actors/network-monitor/network-observer.js#749
Comment 2•4 years ago
|
||
Harald the link in comment #0 is giving "Oops you hit a 404!"
Honza
Reporter | ||
Comment 3•4 years ago
|
||
Deep linking seems to be busted in CDP docs, sorry.
Raw docs would be here: https://github.com/chromium/chromium/blob/e9c901261deec6dc1c18b59b0ac881965eec6ad3/third_party/blink/public/devtools_protocol/browser_protocol.pdl#L4552
The link doesn't add too much context, just shows how wildcards are being allowed in arguments.
Comment 4•4 years ago
|
||
Harald, how wildcards should be treated?
Does the following make sense?
"a*b" => everything that starts with "a" and ends with "b"
"a*" => everything that starts with "a"
"*b" => everything that ends with "b"
"*a*" => everything that has an "a" in it
"*a*b*"=> everything that has an "a" in it, followed by anything, followed by a "b", followed by anything
From:
https://stackoverflow.com/questions/26246601/wildcard-string-comparison-in-javascript
This might also be useful:
https://gist.github.com/donmccurdy/6d073ce2c6f3951312dfa45da14a420f
Honza
Reporter | ||
Comment 5•4 years ago
|
||
Thanks for summarizing the technical side, Honza.
I think it all makes sense except the start/end constraint (aka we should not add ^…$
in regexp)
The rules would, for example, be "a*" => everything that contains "a" followed by 1+ characters
This is also how Chrome treats it (*.com
filters down to all COM tlds). We can tweak it based on feedback and tighten it more if needed.
Assignee | ||
Comment 6•4 years ago
|
||
Hi Harald, I've been looking into this enhancement and have a working solution.
Just a few things:
- Should the regexp be case sensitive or not?
- I assume we wish to retain the old behaviour if no
*
is present, i.e. just check if the URL includes the query.
Thank you!
Assignee | ||
Comment 7•4 years ago
|
||
Updated•4 years ago
|
Pushed by jodvarko@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/38361b9f7581 Allow wildcards for blocking URLs. r=Honza,Harald
Comment 9•4 years ago
|
||
bugherder |
Comment 11•4 years ago
|
||
This works as intended on latest Nightly 75.0a1 (2020-03-04) with these steps provided by Honza:
- Open DevTools and select the Network panel
- Load e.g. cnn.com
- Open the Blocking side panel (on the left side) - click the proper button in the toolbar
- Create a new entry in the side panel e.g: video*square that should block the following image on the pate video_buffer_square_blk.gif (note that you might see different images so, you might want to create different pattern)
The "video*square" blocking pattern should block all requests that contain "video + something + square" in their names
Thanks for the help!
Reporter | ||
Comment 12•4 years ago
|
||
We should update https://wiki.developer.mozilla.org/en-US/docs/Tools/Network_Monitor/request_list#Blocking_specific_URLs
Description
•