iBlock is a next-generation, high-performance content filtering engine and Chrome Manifest V3 extension completely re-engineered in Rust and WebAssembly.
Designed as a modern, memory-efficient replacement for legacy JavaScript adblock engines, iBlock provides full feature parity or better while drastically cutting memory overhead, eliminating GC pauses, and accelerating domain matching through zero-copy data structures.
┌─────────────────────────┐
│ iBlock MV3 UI / SW │
│ (Glassmorphic Interface)│
└────────────┬────────────┘
│ WebAssembly ESM
┌────────────▼────────────┐
│ iblock-wasm │
│ (WasmEngine Bridge) │
└────────────┬────────────┘
│
┌───────────────────────────────┴───────────────────────────────┐
│ iblock-core │
├─────────────────────┬───────────────────┬─────────────────────┤
│ HNTrie │ BidiTrie │ Cosmetic Engine │
│ Flat Patricia Trie │ Bidirectional │ CSS & Procedural │
│ (Subdomain Lookup) │ Fast Path Match │ (:has, xpath, etc) │
├─────────────────────┼───────────────────┼─────────────────────┤
│ Streaming Parser │ Dynamic Firewall │ Surrogate Registry │
│ Zero-Allocation │ 2D Rule Matrix │ Data URI Generator │
└─────────────────────┴───────────────────┴─────────────────────┘
HNTrie(Flat Patricia Trie):- Contiguous, cache-friendly array representation of domain hierarchies.
- Reverse-hostname search with automatic parent subdomain subsumption (e.g. matching
||ad.doubleclick.net^also coverssub.ad.doubleclick.net).
BidiTrie(Bidirectional Prefix/Suffix Trie):- O(k) substring and wildcard lookup for path and URL patterns.
- Zero-Allocation Streaming Parser:
- Parses standard filter lists (
||example.com^$script,third-party,@@||whitelist.org^,##.ad-banner,#@#.unhide) with zero intermediate string allocations.
- Parses standard filter lists (
- Cosmetic & Procedural Engine:
- Injects pure CSS stylesheets grouped by domain.
- Parses and dispatches procedural selectors (
:has(...),:has-text(...),:matches-path(...),:xpath(...),[-ext-has]).
- Dynamic Firewall 2D Matrix:
- Point-and-click firewall supporting rule evaluation for (Source Domain × Request Type).
- Precedence: Local Override > Global Rule > Type Rule.
- Surrogate Scriptlet Registry:
- In-memory registry generating RFC-compliant Data URIs for neutral script shims (Google Analytics, Google Tag Manager, DoubleClick, Facebook SDK).
- Instant Binary Snapshot Rehydration:
- Compiles thousands of filter rules into an LZ4-compressed compact binary blob rehydrated in < 2ms, completely bypassing cold-start list parsing.
.
├── crates/
│ ├── iblock-core/ # Core filtering algorithms, Tries, parser, firewall
│ │ ├── src/trie/ # HNTrie and BidiTrie implementations
│ │ ├── src/parser.rs # Zero-copy rule parser
│ │ ├── src/cosmetic.rs # CSS and procedural selector engine
│ │ ├── src/dynamic.rs # Dynamic matrix firewall (2D grid)
│ │ ├── src/surrogate.rs # In-memory scriptlet surrogate registry
│ │ └── src/engine.rs # Unified filtering engine
│ ├── iblock-wasm/ # wasm-bindgen WebAssembly wrapper
│ │ └── src/lib.rs # WasmEngine, WasmMatchResult, RequestTypeFlags
│ └── iblock-cli/ # Standalone CLI for audits and benchmarks
│ └── src/main.rs # Benchmarking, matching, and list compilation
├── extension/ # Manifest V3 extension ready to load in Chrome
│ ├── manifest.json # MV3 manifest with 'wasm-unsafe-eval' CSP
│ ├── _locales/ # Localized UI messages
│ ├── js/ # Background service worker & page scripts
│ ├── css/ # Modern UI stylesheets (Glassmorphism design)
│ ├── img/ # High-resolution vector & raster iBlock icons
│ └── wasm/ # Compiled Wasm binary & JavaScript bindings
├── dist/ # Build artifacts & packaged zip files
├── tests/ # Integration test suite (Node.js + Wasm)
├── Makefile # Simple build targets
└── Cargo.toml # Workspace manifest
- Rust 1.80+
wasm32-unknown-unknowntarget:rustup target add wasm32-unknown-unknownwasm-bindgen-cli0.2.129:cargo install wasm-bindgen-cli --version 0.2.129- Node.js 18+
# Compile Rust crates and WebAssembly
make all# Run unit tests across all crates (24/24 unit tests)
cargo test --workspace
# Run WebAssembly Node.js integration tests
node tests/test-wasm.mjsmake extension
# Produced artifact: dist/iblock-extension.zip- Open your browser and navigate to
chrome://extensions/. - Enable Developer mode in the top right corner.
- Click Load unpacked and select the
extension/directory inside this repository. - Open the extension popup from your toolbar to experience the modern UI powered by the Rust Wasm engine!
The repository includes a standalone CLI tool for benchmarking, testing, and compiling filter lists offline:
# Check if a URL matches against a filter list
cargo run -p iblock-cli -- match \
--rules "||doubleclick.net^" \
--url "https://doubleclick.net/ad.js" \
--source "https://news.ycombinator.com" \
--type script
# Run performance benchmarks on 1,000,000 matches
cargo run -p iblock-cli --release -- bench --rules path/to/easylist.txt
# Compile text filter lists into an optimized binary snapshot
cargo run -p iblock-cli -- compile \
--rules path/to/easylist.txt \
--out dist/easylist.bin| Metric | Original JavaScript Engine | iBlock Rust Wasm Engine | Improvement |
|---|---|---|---|
| Rule Parsing Speed | ~85,000 rules/sec | ~420,000 rules/sec | ~4.9× faster |
| Cold-Start Rehydration | ~180 ms | < 2 ms (via LZ4 snapshot) | ~90× faster |
| Domain Lookup Latency | ~850 ns | ~140 ns | ~6.1× faster |
| Memory Consumption | ~48 MB per million rules | ~14 MB | ~71% less RAM |
| GC Pauses | Frequent micro-stutters | 0 ms (contiguously allocated) | Deterministic |
This project is licensed under the GNU General Public License v3.0. Derivative work based on the foundational research of the uBlock Origin project by Raymond Hill. All Rust core modules, Trie architectures, Wasm bridges, CLI tools, and modernized UI components are original contributions for iBlock.