Code Monkey home page Code Monkey logo

adblockpluschrome's Introduction

Pipeline status

Adblock Plus for Chrome, Opera, Microsoft Edge and Firefox

This repository contains the platform-specific Adblock Plus source code for Chrome, Opera, Microsoft Edge and Firefox. It can be used to build Adblock Plus for these platforms, generic Adblock Plus code will be extracted from other repositories automatically (see dependencies file).

Note that the Firefox extension built from this repository is the new WebExtension. The source code of the legacy Adblock Plus extension can be found here.

Building

Requirements

Building on Windows

On Windows, you need a Linux environment running on WSL. Then install the above requirements and run the commands below from within Bash.

Building the extension

Run one of the following commands in the project directory, depending on your target platform:

./build.py build -t chrome -k adblockpluschrome.pem
./build.py build -t gecko

This will create a build with a name in the form adblockpluschrome-1.2.3.nnnn.crx or adblockplusfirefox-1.2.3.nnnn.xpi.

Note that you don't need an existing signing key for Chrome, a new key will be created automatically if the file doesn't exist.

The Firefox extension will be unsigned, and therefore is mostly only useful for upload to Mozilla Add-ons. You can also load it for testing purposes under about:debugging or by disabling signature enforcement in Firefox Nightly.

Development environment

To simplify the process of testing your changes you can create an unpacked development environment. For that run one of the following commands:

./build.py devenv -t chrome
./build.py devenv -t gecko

This will create a devenv.* directory in the repository. You can load the directory as an unpacked extension under chrome://extensions in Chrome and under about:debugging in Firefox. After making changes to the source code re-run the command to update the development environment, and the extension should reload automatically after a few seconds.

The build script calls the ensure_dependencies script automatically to manage the dependencies (see dependencies file). Dependencies with local modifications won't be updated. Otherwise during development specifying a feature-branch's name for a dependency's revision is sometimes useful. Alternatively dependency management can be disabled completely by setting the SKIP_DEPENDENCY_UPDATES environment variable, for example:

SKIP_DEPENDENCY_UPDATES=true ./build.py devenv -t chrome

Running tests

Unit tests

To verify your changes you can use the unit test suite located in the qunit directory of the repository. In order to run the unit tests go to the extension's Options page, open the JavaScript Console and type in:

location.href = "qunit/index.html";

The unit tests will run automatically once the page loads.

External test runner

There is also an external test runner that can be invoked from the command line in order to run the unit tests along some integration tests on different browsers, and automatically run the linter as well.

On Windows, in order to use the test runner, in addition to setting up a Linux environment as outlined above, you need to have Node.js installed in your native Windows environment. Then run the commands below from within PowerShell or cmd.exe (unlike when building the extension which needs to be done from Bash).

On Linux, newer versions of Chromium require libgbm.

Make sure the required packages are installed and up-to-date:

npm install

Start the testing process for all browsers:

npm test

Start the testing process in one browser only:

npm test -- -g <Firefox|Chromium>

In order to run other test subsets, please check [Mocha's documentation] (https://mochajs.org/#-grep-regexp-g-regexp) on -g option.

By default it downloads (and caches) and runs the tests against the oldest compatible version and the latest release version of each browser. In order to run the tests against a different version set the CHROMIUM_BINARY or FIREFOX_BINARY environment variables. Following values are accepted:

  • installed
    • Uses the version installed on the system.
  • path:<path>
    • Uses the binary located at the given path.
  • download:<version>
    • Downloads the given version (for Firefox the version must be in the form <major>.<minor>, for Chromium this must be the revision number).

Filter tests subset uses ABP Test pages. In order to run those tests on a different version of the test pages, set the TEST_PAGES_URL environment variable. Additionally, in order to accept insecure https certificates set the TEST_PAGES_INSECURE environment variable to "true".

Linting

You can lint the code using ESLint.

You will need to setup first. This will install our configuration eslint-config-eyeo and everything needed after you run:

npm install

Then you can run to lint the code:

npm run lint

adblockpluschrome's People

Contributors

snoack avatar ttjoseph avatar kzar avatar thomasgreiner avatar trlucas avatar fhd avatar hfiguiere avatar tonifeliu avatar manvel avatar shoniko avatar doomb0t avatar g3o314 avatar aeurielesn avatar wvspee-eyeo avatar bobwallis avatar andreynovikov avatar mathiasbynens avatar rob--w avatar ross-abp avatar evilpie avatar drsaudi avatar taylorchu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.