Commit Graph

32 Commits

Author SHA1 Message Date
Raymond Hill 22022f636f
Modularize codebase with export/import
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1664

The changes are enough to fulfill the related issue.

A new platform has been added in order to allow for building
a NodeJS package. From the root of the project:

    ./tools/make-nodejs

This will create new uBlock0.nodejs directory in the
./dist/build directory, which is a valid NodeJS package.

From the root of the package, you can try:

    node test

This will instantiate a static network filtering engine,
populated by easylist and easyprivacy, which can be used
to match network requests by filling the appropriate
filtering context object.

The test.js file contains code which is typical example
of usage of the package.

Limitations: the NodeJS package can't execute the WASM
versions of the code since the WASM module requires the
use of fetch(), which is not available in NodeJS.

This is a first pass at modularizing the codebase, and
while at it a number of opportunistic small rewrites
have also been made.

This commit requires the minimum supported version for
Chromium and Firefox be raised to 61 and 60 respectively.
2021-07-27 17:26:04 -04:00
Raymond Hill a4aced69dc
Reorganize platform directory to avoid Chromium-centric appearance
Though Firefox shares a lot of WebExtensions code with Chromium,
these platforms have their own specific code paths, for various
reasons.

The reorganization here makes it clear that Chromium platform is
just one flavor of WebExtensions, and as such all Chromium-specific
code paths should no longer be automatically pulled by other
platforms where these code paths are not needed.

Given that the filepath of many files changed, here is the
parent commit to quickly browse back to the previous directory
layout:

ec7db30b2f
2021-07-16 10:06:58 -04:00
Raymond Hill 5c68867b92
Deprecate pseudo user styles code
The pseudo user styles code served only browsers based
on Chromium 65 and earlier -- Chromium 66 supports
native user styles and was first released more than two
years ago.

In Chromium-based browsers, the pseudo user styles code
is being unconditionally injected in every page/frame
just in case the browser is version 65 or earlier.

Removing pseudo user styles reduce uBO's main content
script in Chromium-based browsers by more than 20K.

Related thread:
- https://github.com/NanoAdblocker/NanoCore/issues/348#issuecomment-653646507
2020-07-22 10:21:16 -04:00
Raymond Hill 152cea2dfe
Refactor management of injectable resources
This is a first step, the ultimate goal is to remove
the need for resources.txt, or at least to reduce to
only hotfixes or for trivial resources targeting very
specific websites.

Most resources will become immutable, i.e. they will
be part of uBO's code base. Advantages include easier
code maintenance (jshint, syntax highlight), and to
make scriptlets more easy to code review by external
parties (for example extension store reviewers).

TODO:

- More scriptlets need to be imported before next
  release.
- Need to make legacy versions of uBO use a legacy
  version of resources.txt, as all the now obsolete
  scriptlets will have to be removed once uBO's
  next release become widespread.
- Possibly need to add code to load binary
  resources so that they can be injected as
  data: URI. So far it's unclear whether this is
  really needed. For example, this would be needed
  if a xmlhttprequest is redirected to an image
  resource.
2019-07-03 09:47:56 -04:00
Raymond Hill d528f3811a
Use version number in the filename of packages 2018-12-23 10:16:08 -05:00
Raymond Hill 89fd76ac39
use image data instead of paths for browser icons
When using paths, platform implementations of setIcon typically
will fetch the resource then convert to image data internally.
It is preferable for uBO to do this conversion itself as it can
be done only once at launch time.

With chromium-based browsers, using image data eliminate the
incessant network traffic to fetch browser icons as reported
in the extension's dev tool, meaning a good chunk of overhead
is eliminated.

Also, use optimal icon sizes, as of now both chromium and firefox
prefers 16px instead of 19px, and 32px instead of 38px.
2018-05-07 19:03:50 -04:00
Raymond Hill e5f2e9701d
better manage platform-specific code for user-stylesheet support 2018-04-26 11:36:22 -04:00
Raymond Hill efcab14597
Squashed commit of the following:
commit ab2b328cf1360a751fa1c58b8521f907eeb1ec50
Author: Raymond Hill <rhill@raymondhill.net>
Date:   Thu Apr 12 12:08:30 2018 -0400

    fix #3588

commit c4ae7638dfa5a5c7ddec2f9dd2d2988450082542
Author: Raymond Hill <rhill@raymondhill.net>
Date:   Thu Apr 12 09:08:56 2018 -0400

    detect user stylesheets support from content scripts (#3588)
2018-04-12 12:17:38 -04:00
Raymond Hill 17930cc778
fix #3474, #2823 2018-02-15 17:25:38 -05:00
gorhill cfef3aeb2b
minor review of shell scripts 2017-11-10 11:36:55 -05:00
gorhill 23487a643a
prepend vapi-usercss.js to contentscript.js in extension package 2017-10-24 12:40:58 -04:00
gorhill a19efa4ebe
fix #3082 (use "dev build" in extension name) 2017-10-01 10:28:33 -04:00
Raymond Hill 3b9fd49c50 Assets management refactored (#2314)
* refactoring assets management code

* finalizing refactoring of assets management

* various code review of new assets management code

* fix #2281

* fix #1961

* fix #1293

* fix #1275

* fix update scheduler timing logic

* forward compatibility (to be removed once 1.11+ is widespread)

* more codereview; give admins ability to specify own assets.json

* "assetKey" is more accurate than "path"

* fix group count update when building dom incrementally

* reorganize content (order, added URLs, etc.)

* ability to customize updater through advanced settings

* better spinner icon
2017-01-18 13:17:47 -05:00
gorhill 8ee1f8812f fix #1661 as suggested 2016-06-09 12:32:00 -04:00
gorhill 909ef5303d prevent pushd/popd from polluting output 2016-04-03 18:06:19 -04:00
gorhill cad3c5f5cb update packaging scripts for https://github.com/uBlockOrigin/uAssets repo 2016-04-03 13:07:46 -04:00
Aaron Bieber 98b0967d69 allow scripts to run with bash in other locations 2016-01-31 12:17:04 -05:00
gorhill d9e56d1396 this completes the fix to #602 2015-11-24 20:53:02 -05:00
gorhill 892913d185 this fixes #832 2015-10-21 11:53:03 -04:00
gorhill 9fa05aa7c4 changed "make" scripts for #602
All the assets which are not selected by default out-of-the-box will
be converted into an empty file. This is a first step, the final step
will be to removed completely the files from the package once everybody
is using v1.1.0.0+.
2015-08-17 09:29:11 -04:00
gorhill fcfdfdf9c3 this fixes https://github.com/chrisaljoudi/uBlock/issues/1219 for Chromium 2015-04-09 07:29:07 -04:00
gorhill b83e0b46d5 move platform-specific images to their respective platform 2015-03-15 08:17:38 -04:00
gorhill 863aaa5401 this fixes #685 2015-02-06 10:30:22 -05:00
Chris b2ae524ed8 Fix cleanup in build script so rm won't complain during first build 2015-02-05 15:13:39 -07:00
Florian Walch 9e7909b62e Set up Travis releases. 2015-01-14 09:25:14 +01:00
Deathamns 4e271aebb3 Include LICENSE.txt into extension packages 2015-01-13 07:29:18 +01:00
gorhill b0b81bb8dc put back "nb" 2014-12-25 07:28:02 -05:00
gorhill 2c7d75c868 looks like Chrome store quietly changed `nb` to `no`... 2014-12-21 16:12:13 -05:00
Raymond Hill 2e4c0a2bfe remove depending on vapi-appinfo.js 2014-12-01 14:25:33 -02:00
Raymond Hill 6294dea81d "platform" is more accurate 2014-11-29 17:51:19 -02:00
Raymond Hill a430e526b6 use "platform" as suggested in #360 2014-11-24 14:49:11 -02:00
Raymond Hill 2ae09084e0 more accurately, it is for chromium 2014-11-24 13:01:39 -02:00