Closed Bug 1613988 Opened 4 years ago Closed 4 years ago

Allow wildcards (*) for blocking URLs

Categories

(DevTools :: Netmonitor, enhancement, P3)

enhancement

Tracking

(firefox75 verified)

VERIFIED FIXED
Firefox 75
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)

Summary: Allow wildcards (*) in for blocking URLs → Allow wildcards (*) for blocking URLs

Harald the link in comment #0 is giving "Oops you hit a 404!"
Honza

Flags: needinfo?(hkirschner)
Priority: -- → P3

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.

Flags: needinfo?(hkirschner)

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

Flags: needinfo?(hkirschner)

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.

Flags: needinfo?(hkirschner)

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!

Flags: needinfo?(hkirschner)
Assignee: nobody → duncangleeddean
Status: NEW → ASSIGNED
Pushed by jodvarko@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/38361b9f7581
Allow wildcards for blocking URLs. r=Honza,Harald
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 75
Blocks: 1617277

(clearing ni, answered in phab)

Flags: needinfo?(hkirschner)

This works as intended on latest Nightly 75.0a1 (2020-03-04) with these steps provided by Honza:

  1. Open DevTools and select the Network panel
  2. Load e.g. cnn.com
  3. Open the Blocking side panel (on the left side) - click the proper button in the toolbar
  4. 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!

Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: