Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/alexperezortuno/ce-blocker/llms.txt

Use this file to discover all available pages before exploring further.

Each rule that Traffic Blocker stores and registers with the Chrome browser corresponds to a chrome.declarativeNetRequest.Rule object. When rules are saved or imported, the extension validates every entry and automatically fills in any missing fields with safe defaults — so malformed or partial rules are corrected rather than rejected.

Top-level fields

id
number
required
Unique rule identifier. Traffic Blocker automatically reassigns IDs sequentially (1-indexed) on every save operation. Do not rely on ID stability across sessions or imports.
priority
number
required
Matching priority for the rule. Defaults to 1. When multiple rules could match the same request, the rule with the highest priority value takes precedence.
action
object
required
Defines what to do when the rule matches a request. See the action object section below.
condition
object
required
Defines which requests the rule should match. See the condition object section below.

action object

type
string
required
The action to take when the rule matches. Always "block" in Traffic Blocker. The extension’s UI only exposes the block action type.

condition object

urlFilter
string
required
The URL pattern to match against incoming requests. Supports wildcards and Chrome’s declarativeNetRequest filter syntax. See URL Patterns for full pattern reference.
initiatorDomains
string[]
Optional list of domains that must have initiated the request for the rule to apply. When set, the rule is scoped — it only blocks the target URL when the request originates from one of these domains. Cannot be combined with excludedInitiatorDomains on the same rule.
excludedInitiatorDomains
string[]
Optional list of domains from which requests should never be blocked, even if the URL matches. When a rule is added through the UI without specifying initiatorDomains, Traffic Blocker automatically adds "localhost" to this list to avoid disrupting local development servers.

Complete example

{
  "id": 1,
  "priority": 1,
  "action": { "type": "block" },
  "condition": {
    "urlFilter": "*://*.doubleclick.net/*",
    "excludedInitiatorDomains": ["localhost"]
  }
}

Auto-fix behavior

When rules are imported — whether from a JSON file, a URL, or a preset — the extension runs each entry through an auto-fix function before registering it. This fills in any missing or malformed fields using the following logic from background.ts:
const autoFixRule = (rule: any, index: number): any => {
    return {
        id: index + 1,
        priority: typeof rule.priority === 'number' ? rule.priority : (typeof rule.priority === 'string' ? parseInt(rule.priority, 10) : 1),
        action: rule.action && typeof rule.action.type === 'string' ? rule.action : {type: chrome.declarativeNetRequest.RuleActionType.BLOCK},
        condition: rule.condition && typeof rule.condition.urlFilter === 'string' ? rule.condition : {urlFilter: rule.condition?.urlFilter || rule.rule || ''}
    };
};
After auto-fix, IDs are reassigned a second time to guarantee a clean 1-indexed sequence with no gaps. The priority field accepts both numeric and string values; strings are coerced with parseInt. If no valid urlFilter can be found in condition, the importer falls back to a top-level rule property for backwards compatibility with older export formats.
Traffic Blocker only uses action type block. The full Chrome declarativeNetRequest spec supports additional action types (allow, redirect, etc.) which are not exposed through the UI.

Build docs developers (and LLMs) love