Skip to content
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

fix: throw on invalid webRequest filters #19580

Conversation

@trop
Copy link
Contributor

commented Aug 1, 2019

Backport of #19570

See that PR for details.

Notes: Fixed error throwing on invalid webRequest url pattern filtering in onBeforeRequest.

fix: throw on invalid webRequest filters (#19337)
Closes #11371.

Previously, we didn't consider the return value of the webRequest URLPattern mate converter, which meant that when the pattern wasn't correctly parsed owing to invalid filter specification users would not be made aware of that fact and would just think that the filtering itself had failed. This corrects that error by moving the business logic of url pattern parsing out of the converter and into the function itself so that granular and specific errors can be thrown.

There's also no real reason that i'm aware of not to allow wider breadth of filters by letting users use a wildcard for effective TLD, so I also overrode that (default for the 1-arg Parse is not to allow that).

Finally, I added some examples of url filter types for users to reference.

@electron-cation electron-cation bot removed the new-pr 🌱 label Aug 1, 2019

@zcbenz
Copy link
Member

left a comment

CI is failing:

net module ClientRequest API Should throw when invalid filters are passed to a request - Should throw when invalid filters are passed to a request
/Users/distiller/project/src/electron/spec/api-net-spec.js
moreReferenceError: expect is not defined

@codebytere codebytere requested a review from zcbenz Aug 5, 2019

@zcbenz

zcbenz approved these changes Aug 5, 2019

@zcbenz zcbenz merged commit fa2b3a3 into 5-0-x Aug 5, 2019

11 of 14 checks passed

build-linux Workflow: build-linux
Details
electron-arm-testing Build #20190805.7 had test failures
Details
Artifact Comparison Changes Detected
Details
Semantic Pull Request ready to be squashed
Details
Valid Backport Valid Backport
Details
WIP Ready for review
Details
appveyor: win-ia32-testing AppVeyor build succeeded
Details
appveyor: win-ia32-testing-pr AppVeyor build succeeded
Details
appveyor: win-x64-testing AppVeyor build succeeded
Details
appveyor: win-x64-testing-pr AppVeyor build succeeded
Details
build-mac Workflow: build-mac
Details
electron-arm64-testing Build #20190805.7 succeeded
Details
lint Workflow: lint
Details
release-notes Release notes found
@release-clerk

This comment has been minimized.

Copy link

commented Aug 5, 2019

Release Notes Persisted

Fixed error throwing on invalid webRequest url pattern filtering in onBeforeRequest.

@zcbenz zcbenz deleted the trop/5-0-x-bp-fix-throw-on-invalid-webrequest-filters-1564693430394 branch Aug 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.