Skip to content

Commit 7261566

Browse files
authored
Merge pull request #388 from brave/next
Release v0.9.0
2 parents 319f88b + 91db748 commit 7261566

18 files changed

+1181
-595
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "adblock"
3-
version = "0.8.12"
3+
version = "0.9.0"
44
authors = ["Anton Lazarev <[email protected]>", "Andrius Aucinas"]
55
edition = "2021"
66

@@ -39,14 +39,13 @@ rmp-serde = "0.15"
3939
lifeguard = { version = "^ 0.6.1", optional = true }
4040
cssparser = { version = "0.28", optional = true }
4141
selectors = { version = "0.23", optional = true }
42-
serde_json = { version = "1.0", optional = true }
42+
serde_json = "1.0"
4343
thiserror = "1.0"
4444

4545
[dev-dependencies]
4646
criterion = "0.5"
4747
csv = "1"
4848
mock_instant = { version = "0.5" }
49-
serde_json = "1.0"
5049
# By default, reqwest builds openssl from source, which fails on missing/incompatible system dependencies
5150
reqwest = { version = "0.11", features = ["rustls-tls"], default-features = false }
5251
futures = "0.3"
@@ -91,6 +90,6 @@ object-pooling = ["lifeguard"] # disables `Send` and `Sync` on `Engine`.
9190
unsync-regex-caching = [] # disables `Send` and `Sync` on `Engine`.
9291
regex-debug-info = []
9392
css-validation = ["cssparser", "selectors"]
94-
content-blocking = ["serde_json"]
93+
content-blocking = []
9594
embedded-domain-resolver = ["addr"] # Requires setting an external domain resolver if disabled.
96-
resource-assembler = ["serde_json"]
95+
resource-assembler = []

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ It may be a good fit for yours, too!
2929

3030
See [docs.rs](https://docs.rs/adblock) for detailed API documentation.
3131

32-
Also check the [Rust example](./examples/example.rs) or the [NodeJS example](./js/example.js).
32+
Also check the [Rust example](./examples/example.rs) or the [NodeJS example](./js/example.mjs).
3333

3434
### Optional features
3535

fuzz/Cargo.lock

+25-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "adblock-rs"
3-
version = "0.8.12"
3+
version = "0.9.0"
44
authors = ["Anton Lazarev <[email protected]>", "Andrius Aucinas"]
55
edition = "2018"
66
license = "MPL-2.0"

js/example.js renamed to js/example.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const adblockRust = require('adblock-rs');
2-
const fs = require('fs');
1+
import adblockRust from 'adblock-rs';
2+
import fs from 'node:fs';
33
const dataPath = '../data/'
44

55
const debugInfo = true;

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "adblock-rs",
3-
"version": "0.8.12",
3+
"version": "0.9.0",
44
"description": "Very fast, Rust-based, native implementation of ad-blocker engine for Node",
55
"keywords": [
66
"adblock",

src/content_blocking.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ pub enum CbRuleCreationFailure {
204204
RuleContainsNonASCII,
205205
/// `from` as a `domain` alias is not currently supported in content blocking syntax.
206206
FromNotSupported,
207+
/// Content blocking rules cannot support procedural cosmetic filter operators.
208+
ProceduralCosmeticFiltersUnsupported,
207209
}
208210

209211
impl TryFrom<ParsedFilter> for CbRuleEquivalent {
@@ -567,7 +569,7 @@ impl TryFrom<CosmeticFilter> for CbRule {
567569
return Err(CbRuleCreationFailure::ScriptletInjectionsNotSupported);
568570
}
569571

570-
if let Some(raw_line) = v.raw_line {
572+
if let Some(raw_line) = &v.raw_line {
571573
let mut hostnames_vec = vec![];
572574
let mut not_hostnames_vec = vec![];
573575

@@ -609,10 +611,16 @@ impl TryFrom<CosmeticFilter> for CbRule {
609611
(not_hostnames_vec, hostnames_vec)
610612
};
611613

614+
let selector = if let Some(selector) = v.plain_css_selector() {
615+
selector.to_string()
616+
} else {
617+
return Err(CbRuleCreationFailure::ProceduralCosmeticFiltersUnsupported);
618+
};
619+
612620
let rule = Self {
613621
action: CbAction {
614622
typ: CbType::CssDisplayNone,
615-
selector: Some(v.selector),
623+
selector: Some(selector),
616624
},
617625
trigger: CbTrigger {
618626
url_filter: ".*".to_string(),

0 commit comments

Comments
 (0)