• This repository has been archived on 21/Feb/2021
  • Stars
    star
    546
  • Rank 81,375 (Top 2 %)
  • Language
    JavaScript
  • License
    GNU General Publi...
  • Created about 9 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Mirrored from https://gitlab.com/eyeo/adblockplus/adblockpluschrome

Adblock Plus for Chrome, Opera, Microsoft Edge and Firefox (DEPRECATED!)

IMPORTANT: Deprecation notice

This codebase is deprecated. As of Adblock Plus 3.11, Adblock Plus for Chrome, Firefox, Microsoft Edge and Opera is based on the adblockplusui repository.

Development of the core ad blocking integration for web extensions has moved to the webext-sdk repository.


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.

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.

Updating the dependencies

Clone the external repositories:

git submodule update --init --recursive

Note: when building from a source archive, this step must be skipped.

Install the required npm packages:

npm install

Rerun the above commands when the dependencies might have changed, e.g. after checking out a new revison.

Building the extension

Run the following command in the project directory:

npx gulp build -t {chrome|firefox} [-c development]

This will create a build with a name in the form adblockpluschrome-n.n.n.zip or adblockplusfirefox-n.n.n.xpi. These builds are unsigned. They can be submitted as-is to the extension stores, or if unpacked loaded in development mode for testing (same as devenv builds below).

Development environment

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

npx gulp devenv -t {chrome|firefox}

This will create a devenv.* directory in the project directory. You can load the directory as an unpacked extension under chrome://extensions in Chromium-based browsers, 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.

Customization

If you wish to create an extension based on our code and use the same build tools, we offer some customization options.

This can be done by:

  • Specifying a path to a new configuration file relative to gulpfile.mjs (it should match the structure found in build/config/).

     npx gulp {build|devenv} -t {chrome|firefox} --config config.mjs
    
  • Specifying a path to a new manifest.json file relative to gulpfile.mjs. You should check build/manifest.json and build/tasks/manifest.mjs to see how we modify it.

     npx gulp {build|devenv} -t {chrome|firefox} -m manifest.json
    

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|Edge>

In order to run other test subsets, please check -g option on Mocha's documentation.

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, FIREFOX_BINARY or EDGE_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). This option is not available for Edge.

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".

Edge Chromium needs to be installed before running the Edge tests.

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

More Repositories

1

adblockplus-legacy

DEPRECATED: Adblock Plus extension for Firefox and other Gecko-based browsers
JavaScript
360
star
2

adblockplusandroid

Adblock Plus app for Android
Java
236
star
3

backup-adblockplus

Adblock Plus extension for Firefox and other Gecko-based browsers
JavaScript
231
star
4

libadblockplus-android

Android JNI bindings for libadblockplus
Java
224
star
5

backup-adblockpluschrome

Adblock Plus extension for Google Chrome
JavaScript
224
star
6

adblockplussafariios

Adblock Plus Safari iOS source code
Objective-C
151
star
7

libadblockplus

A C++ wrapper library around the core functionality of Adblock Plus
C++
132
star
8

adblockpluscore

Mirrored from https://gitlab.com/eyeo/adblockplus/adblockpluscore
JavaScript
115
star
9

abp2blocklist

Code to convert Adblock Plus filter lists to WebKit content blocker lists
JavaScript
91
star
10

adblockplussbrowser

Adblock Plus for Samsung Browser source code
Java
33
star
11

python-abp

Adblock Plus utilities for Python
Python
32
star
12

abpcrawler

Website crawler for Adblock Plus
Python
26
star
13

adblockplus

Shared Adblock Plus UI code
JavaScript
26
star
14

gyp

Fork of https://chromium.googlesource.com/external/gyp.git
Python
23
star
15

infrastructure

Puppet-based configuration definitions for various servers used by the Adblock Plus project.
Puppet
17
star
16

adblockplusie

Adblock Plus for Internet Explorer
C++
16
star
17

buildtools

Build tools for Adblock Plus and related extensions
Python
12
star
18

elemhidehelper

DEPRECATED: Element Hiding Helper extension for Adblock Plus
JavaScript
10
star
19

sitescripts

Various scripts used on adblockplus.org, mirrored from https://gitlab.com/eyeo/devops/legacy/sitescripts
Python
8
star
20

web.adblockplus.org

AdblockPlus.org website content
JavaScript
6
star
21

cms

CMS used for adblockplus.org [mirrored from https://gitlab.com/eyeo/websites/cms]
Python
6
star
22

adblockbrowserios

Swift
5
star
23

libadblockplus-binaries

Binaries created from libadblockplus repository (for faster Android builds)
C++
4
star
24

abpcustomization

DEPRECATED: Customizations for Adblock Plus extension
Python
4
star
25

jshydra

JSHydra, a static analysis tool for JavaScript (forked from http://hg.mozilla.org/users/Pidgeot18_gmail.com/jshydra)
JavaScript
4
star
26

web.acceptableads.org

Source files for the acceptableads.org web content
HTML
3
star
27

abpwatcher

DEPRECATED: Diagnostics for Adblock Plus extension
JavaScript
2
star
28

yajl-dynamic

YAJL 2.1.0 dynamic framework for iOS
C
2
star
29

web.adblockbrowser.org

Source files for the adblockbrowser.org web content
CSS
2
star
30

adblockbrowserios-core

Swift
2
star
31

adblockbrowser

Adblock Browser for Android source code
2
star
32

adblockplustests

DEPRECATED: Firefox extension running Adblock Plus unit tests
JavaScript
2
star
33

easylist.adblockplus.org

Source files for the easylist.adblockplus.org web content
1
star
34

needs-translation

Configurable translations diff and exclusion tool for XLIFF 1.2 designed for Xcode localization exports
JavaScript
1
star
35

chromium-src-build

Fork of https://chromium.googlesource.com/chromium/src/build
Python
1
star
36

subscribe.adblockplus.org

Source files for the subscribe.adblockplus.org web content
1
star
37

youtube.adblockplus.me

Source files for the youtube.adblockplus.me web content
HTML
1
star
38

share.adblockplus.org

Source files for the share.adblockplus.org web content
HTML
1
star
39

chromium-trace_event-common

Fork of https://chromium.googlesource.com/chromium/src/base/trace_event/common
C++
1
star
40

codingtools

Various tools to aid working on Adblock Plus code
Python
1
star