platform/blocker/content-blocker
Classes
Section titled “Classes”ContentBlocker
Section titled “ContentBlocker”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.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ContentBlocker(
options):ContentBlocker
Defined in: app/src/platform/blocker/content-blocker.ts:60
Parameters
Section titled “Parameters”options
Section titled “options”Data folder, switch and callbacks.
Returns
Section titled “Returns”Accessors
Section titled “Accessors”status
Section titled “status”Get Signature
Section titled “Get Signature”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.
Returns
Section titled “Returns”Methods
Section titled “Methods”beforeRequest()
Section titled “beforeRequest()”beforeRequest(
details):Promise<RequestDecision|undefined>
Defined in: app/src/platform/blocker/content-blocker.ts:89
Decides about a request before it starts.
Parameters
Section titled “Parameters”details
Section titled “details”OnBeforeRequestListenerDetails
Returns
Section titled “Returns”Promise<RequestDecision | undefined>
A decision, or undefined to let the next interceptor decide.
Implementation of
Section titled “Implementation of”RequestInterceptor.beforeRequest
blocksPopup()
Section titled “blocksPopup()”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.
Parameters
Section titled “Parameters”string
The address the popup would show.
openerUrl
Section titled “openerUrl”string
The address of the page that opens it.
Returns
Section titled “Returns”boolean
domainOf()
Section titled “domainOf()”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.
Parameters
Section titled “Parameters”string
The page’s address.
Returns
Section titled “Returns”string | undefined
elementRules()
Section titled “elementRules()”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.
Parameters
Section titled “Parameters”string
The frame’s address.
string
The address of the page the frame belongs to.
elements
Section titled “elements”What the frame reported.
Returns
Section titled “Returns”string
frameRules()
Section titled “frameRules()”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.
Parameters
Section titled “Parameters”string
The frame’s address.
string = url
The address of the page the frame belongs to.
Returns
Section titled “Returns”headersReceived()
Section titled “headersReceived()”headersReceived(
details):Readonly<Record<string, readonlystring[]>> |undefined
Defined in: app/src/platform/blocker/content-blocker.ts:119
Adds the content security policy that $csp filters set for a page.
Parameters
Section titled “Parameters”details
Section titled “details”OnHeadersReceivedListenerDetails
The response of a page.
Returns
Section titled “Returns”Readonly<Record<string, readonly string[]>> | undefined
Implementation of
Section titled “Implementation of”RequestInterceptor.headersReceived
load()
Section titled “load()”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.
Returns
Section titled “Returns”Promise<BlockerEngine | undefined>
loadExtras()
Section titled “loadExtras()”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.
Returns
Section titled “Returns”Promise<void>
loading()
Section titled “loading()”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.
Returns
Section titled “Returns”Promise<unknown> | undefined
resource()
Section titled “resource()”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.
Parameters
Section titled “Parameters”string
The file name.
Returns
Section titled “Returns”ReplacementResource | undefined
References
Section titled “References”BlockerStatus
Section titled “BlockerStatus”Re-exports BlockerStatus
ContentBlockerOptions
Section titled “ContentBlockerOptions”Re-exports ContentBlockerOptions
ExtendedRule
Section titled “ExtendedRule”Re-exports ExtendedRule
ExtraLists
Section titled “ExtraLists”Re-exports ExtraLists
FrameElements
Section titled “FrameElements”Re-exports FrameElements
FrameRules
Section titled “FrameRules”Re-exports FrameRules