Expose parseFilter binding to surface parse errors in JS#681
Draft
ShivanKaul wants to merge 1 commit into
Draft
Conversation
JS callers using addFilter only got a boolean and could not learn
why a rule was rejected, nor whether it was a network or cosmetic
filter. This made it impossible to audit a filter list for
adblock-rust compatibility without mutating a FilterSet.
Expose the pure adblock::lists::parse_filter as a standalone
parseFilter export returning { supported, filterType, error }, where
error is the FilterParseError Display string on failure. addFilter's
existing boolean return is left unchanged to avoid breaking callers,
since rejected rules are a normal outcome when loading real lists.
There was a problem hiding this comment.
Rust Benchmark
Details
| Benchmark suite | Current: 8517775 | Previous: d789160 | Ratio |
|---|---|---|---|
rule-match-browserlike/brave-list |
1775659713 ns/iter (± 5487420) |
2294657228 ns/iter (± 16160555) |
0.77 |
rule-match-first-request/brave-list |
1003100 ns/iter (± 6386) |
1251222 ns/iter (± 4974) |
0.80 |
blocker_new/brave-list |
108917432 ns/iter (± 679457) |
138752639 ns/iter (± 1395429) |
0.78 |
blocker_new/brave-list-deserialize |
25656979 ns/iter (± 1814357) |
32916216 ns/iter (± 223578) |
0.78 |
memory-usage-final/brave-list-initial |
11354668 B/iter (± 0) |
11354668 B/iter (± 0) |
1 |
memory-usage-final/brave-list-1000-requests |
2612449 B/iter (± 0) |
2612449 B/iter (± 0) |
1 |
memory-usage-max/brave-list-initial/max |
63576547 B/iter (± 0) |
63576547 B/iter (± 0) |
1 |
memory-usage-alloc-count/brave-list-initial/alloc-count |
859915 allocs/iter (± 0) |
859915 allocs/iter (± 0) |
1 |
memory-usage-alloc-count/brave-list-1000-requests/alloc-count |
74018 allocs/iter (± 0) |
74018 allocs/iter (± 0) |
1 |
url_cosmetic_resources/brave-list |
155629 ns/iter (± 644) |
201452 ns/iter (± 708) |
0.77 |
cosmetic-class-id-match/brave-list |
2710182 ns/iter (± 717917) |
3345009 ns/iter (± 905142) |
0.81 |
This comment was automatically generated by workflow using github-action-benchmark.
ShivanKaul
marked this pull request as draft
June 23, 2026 05:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JS callers using
addFilteronly got a boolean and could not learn why a rule was rejected.This PR exposes the
adblock::lists::parse_filterfunction as a standaloneparseFilterexport returning{ supported, filterType, error }, whereerroris theFilterParseErrorDisplay string on failure.addFilter's existing boolean return is left unchanged.