Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { injectCosmetics } from '@cliqz/adblocker-webextension-cosmetics';
/**
* `injectCosmetics` is in charge of all ad-blocking logic on the content-script
* side. It handles the following:
* - Inject scripts into the page, which might be used to defuse anti-adblockers.
* - Block the execution of some scripts in the page (only if the
* 'beforescriptexecute' event is available, currently only on Firefox).
*/
injectCosmetics(window, true /* MutationObserver */);
* All the filters and matching logic lives in the background of the extension,
* the content script needs a way to request relevant cosmetic filters for each
* frame. This communication can be handled in several ways (e.g.: `connect` or
* `sendMessage`). By default, `sendMessage` is used.
*
* The background should listen to these messages and answer back with lists of
* filters to be injected in the page, as well as scriplets (small
* self-contained programs) which should be injected.
*
* `injectCosmetics` is in charge of all ad-blocking logic on the content-script
* side. It handles the following:
* - Requests information from background
* - Monitor DOM changes and informs background
* - Injects scriplets returned by background into frames
*/
injectCosmetics(window, true /* observe DOM mutations */);