-
Notifications
You must be signed in to change notification settings - Fork 16.3k
feat: add excludeUrls and modify urls in WebRequestFilter for better URL filtering #44692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@miniak Tagging you in this PR because you recently added types to the filter! Open to any feedback! 🙇♀️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API LGTM
The rationale seems very clear to me and I think having an <all-urls>
special value that aligns with the web standard is a cleaner way to have a catch-all value than the empty array approach from the previous API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
excludeUrls
looks good 👍 I have thoughts about following established standards which I left feedback for.
Small nit: The PR description uses The deprecation warning seems like something worth calling out in the breaking changes doc. I think maybe as a "Default Changed" breaking change? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API LGTM
Release Notes Persisted
|
I was unable to backport this PR to "35-x-y" cleanly; |
…URL filtering (#44692) * feat: add excludeUrls to web request filter * refactor: add deprecated field * test: update tests * lint: newline * docs: improve API doc * fix: add is filter defined property to match all urls * refactor: remove includeUrls * refactor: remove typescript binding * refactor: all_url * refactor: remove isDefined methods * refactor: remove comment * fix: logic * docs: add to breaking changes
@alicelovescake has manually backported this PR to "35-x-y", please check out #45678 |
…URL filtering (#45678) * feat: add excludeUrls and modify urls in WebRequestFilter for better URL filtering (#44692) * feat: add excludeUrls to web request filter * refactor: add deprecated field * test: update tests * lint: newline * docs: improve API doc * fix: add is filter defined property to match all urls * refactor: remove includeUrls * refactor: remove typescript binding * refactor: all_url * refactor: remove isDefined methods * refactor: remove comment * fix: logic * docs: add to breaking changes * docs: remove unneeded section
Description of Change
This PR introduces the following properties to the WebRequestFilter object:
excludeUrls
property. Specify URL patterns that should be excluded from matching.Why add
excludeUrls
?Previously, the WebRequestFilter object only supported the
urls
property, which allowed developers to specify patterns for URLs that should be matched. However, there was no straightforward way to exclude certain URLs from being matched. This limitation made it challenging to implement filtering logic where certain URLs needed to be explicitly excluded.Why add deprecation message to
urls
property with empty array?Previously, an empty urls array meant all URLs were included. This doesn't make sense. If the developer wants all urls included, they should use
all_urls
, which is a special URL pattern that matches everything.Changes
New Property: excludeUrls (optional)
Developers can now define urls and excludeUrls in their WebRequestFilter objects. The filtering logic will first check if a request matches any pattern in excludeUrls. If it does, the request will be excluded. If not, the request will be checked against the urls patterns.
Tests
Deprecation warning

Checklist
npm test
passesRelease Notes
Notes: Added excludeUrls to webRequest filter and deprecated the use of empty arrays in
urls
property.