Understand the snippets library
Last updated
Was this helpful?
Last updated
Was this helpful?
Snippets are pieces of JavaScript code, injected by the Ad-Filtering Solution, that execute within the context of a website and combat advanced ads that circumvent ordinary blocking.
A snippet is typically a JavaScript function. It may optionally take arguments.
Snippets are stored in a snippet library and selected for execution based on the content of a filter list. The filter list also specifies any arguments passed to snippets on a given website.
Multiple snippets with various arguments may be executed on a single website. For more on snippet functionality, view the Snippets Overview.
In order to execute snippets on websites, the following are required:
the snippet library of a sufficiently recent version must be built into the browser
the must be subscribed
The Anti-CV filter list is subscribed by default.
If it isn't in your configuration, you can subscribe to it the same way as you subscribe to any other filter list, through FilteringConfiguration
or any of the platform-specific APIs.
The snippet library may sometimes be updated separately from the remainder of the Solution by changing the tagged version.
Some changes to the snippets library may require alignment of the Solution. Consult the following compatibility matrix to see if a Solution version is compatible with a snippet library version:
0.5.1
105+
0.8.1
117+
1.2.0
123+
Run gclient sync
to pull the new version of the library to your local repository.
Rebuild the browser (ninja -C out/...
)
Remember to consult the compatibility matrix to avoid mismatches between the snippets library content and the Solution's expectations.
The version of the snippets library built into the Browser Ad-Filtering Solution is defined in the .
Set the new desired version in the .