Skip to content

platform/blocker/content-blocker

Defined in: app/src/platform/blocker/content-blocker.ts:52

Blocks requests that the filter lists name, with the engine that tools/blocker built. The engine loads with the first web page, not at the start, and so does the code that uses it (blocker-engine.ts): a browser that shows only its own pages keeps neither its memory nor the work of collecting it. Requests wait for the engine, so even the first page is filtered. Main-frame requests are not blocked: a page the user opens is never replaced by an error page.

new ContentBlocker(options): ContentBlocker

Defined in: app/src/platform/blocker/content-blocker.ts:60

ContentBlockerOptions

Data folder, switch and callbacks.

ContentBlocker

get status(): BlockerStatus

Defined in: app/src/platform/blocker/content-blocker.ts:74

Whether the engine has loaded, is loading, or could not load, so the UI can tell.

BlockerStatus

beforeRequest(details): Promise<RequestDecision | undefined>

Defined in: app/src/platform/blocker/content-blocker.ts:89

Decides about a request before it starts.

OnBeforeRequestListenerDetails

Promise<RequestDecision | undefined>

A decision, or undefined to let the next interceptor decide.

RequestInterceptor.beforeRequest

blocksPopup(url, openerUrl): boolean

Defined in: app/src/platform/blocker/content-blocker.ts:173

Whether a popup that a page opens is one that the filter lists block.

string

The address the popup would show.

string

The address of the page that opens it.

boolean

domainOf(url): string | undefined

Defined in: app/src/platform/blocker/content-blocker.ts:164

The registrable domain of a page, such as example.co.uk for www.example.co.uk; undefined before the filter engine has loaded or for anything but http and https.

string

The page’s address.

string | undefined

elementRules(url, top, elements): string

Defined in: app/src/platform/blocker/content-blocker.ts:155

The generic element hiding rules for the classes, ids and links of a frame.

string

The frame’s address.

string

The address of the page the frame belongs to.

FrameElements

What the frame reported.

string

frameRules(url, top?): FrameRules

Defined in: app/src/platform/blocker/content-blocker.ts:145

The element hiding rules and scriptlets for a frame that starts. The frame waits for them, so this answers at once: before the engine has loaded, there are none.

string

The frame’s address.

string = url

The address of the page the frame belongs to.

FrameRules

headersReceived(details): Readonly<Record<string, readonly string[]>> | undefined

Defined in: app/src/platform/blocker/content-blocker.ts:119

Adds the content security policy that $csp filters set for a page.

OnHeadersReceivedListenerDetails

The response of a page.

Readonly<Record<string, readonly string[]>> | undefined

RequestInterceptor.headersReceived

load(): Promise<BlockerEngine | undefined>

Defined in: app/src/platform/blocker/content-blocker.ts:65

Loads the engine; resolves to undefined when the data is missing or broken.

Promise<BlockerEngine | undefined>

loadExtras(): Promise<void>

Defined in: app/src/platform/blocker/content-blocker.ts:186

Loads the engines of the optional lists that are on, so that they apply from the next request on; a group whose engine has loaded already costs nothing.

Promise<void>

loading(): Promise<unknown> | undefined

Defined in: app/src/platform/blocker/content-blocker.ts:85

The engine while it loads, for a frame that may wait for it; undefined otherwise.

Promise<unknown> | undefined

resource(name): ReplacementResource | undefined

Defined in: app/src/platform/blocker/content-blocker.ts:135

A replacement resource of the filter data by its file name, for the resource scheme.

string

The file name.

ReplacementResource | undefined

Re-exports BlockerStatus


Re-exports ContentBlockerOptions


Re-exports ExtendedRule


Re-exports ExtraLists


Re-exports FrameElements


Re-exports FrameRules