uBlock/Makefile
Raymond Hill cbfd2ad942
Create a MVP version of uBOLite for Firefox
What does not work at the time of commit:

Cosmetic filtering does not work:

The content scripts responsible for cosmetic filtering fail when
trying to inject the stylesheets through document.adoptedStyleSheets,
with the following error message:

  XrayWrapper denied access to property Symbol.iterator
  (reason: object is not safely Xrayable).
  See https://developer.mozilla.org/en-US/docs/Xray_vision for more
  information. ... css-declarative.js:106:8

A possible solution is to inject those content scripts in the
MAIN world. However Firefox scripting API does not support MAIN
world injection at the moment.

Scriptlet-filtering does not work:

Because scriptlet code needs to be injected in the MAIN world,
and this is currently not supported by Firefox's scripting API,
see https://bugzilla.mozilla.org/show_bug.cgi?id=1736575

There is no count badge on the toolbar icon in Firefox, as it
currently does not support the `DNR.setExtensionActionOptions`
method.

Other than the above issues, it does appear uBO is blocking
properly with no error reported in the dev console.

The adoptedStyleSheets issue though is worrisome, as the
cosmetic filtering content scripts were designed with ISOLATED
world injection in mind. Being forced to inject in MAIN world
(when available) make things a bit more complicated as uBO
has to ensure it's global variables do not leak into the page.
2023-04-07 10:19:43 -04:00

91 lines
2.2 KiB
Makefile

# https://stackoverflow.com/a/6273809
run_options := $(filter-out $@,$(MAKECMDGOALS))
.PHONY: all clean test lint chromium opera firefox npm dig mv3 mv3-quick \
compare maxcost medcost mincost modifiers record wasm
sources := $(wildcard assets/* assets/*/* dist/version src/* src/*/* src/*/*/* src/*/*/*/*)
platform := $(wildcard platform/* platform/*/* platform/*/*/* platform/*/*/*/* platform/*/*/*/*/*)
assets := dist/build/uAssets
all: chromium firefox npm
dist/build/uBlock0.chromium: tools/make-chromium.sh $(sources) $(platform) $(assets)
tools/make-chromium.sh
# Build the extension for Chromium.
chromium: dist/build/uBlock0.chromium
dist/build/uBlock0.opera: tools/make-opera.sh $(sources) $(platform) $(assets)
tools/make-opera.sh
# Build the extension for Opera.
opera: dist/build/uBlock0.opera
dist/build/uBlock0.firefox: tools/make-firefox.sh $(sources) $(platform) $(assets)
tools/make-firefox.sh all
# Build the extension for Firefox.
firefox: dist/build/uBlock0.firefox
dist/build/uBlock0.npm: tools/make-nodejs.sh $(sources) $(platform) $(assets)
tools/make-npm.sh
# Build the Node.js package.
npm: dist/build/uBlock0.npm
lint: npm
cd dist/build/uBlock0.npm && npm run lint
test: npm
cd dist/build/uBlock0.npm && npm run test
test-full-battery: npm
cd dist/build/uBlock0.npm && npm run test-full-battery
check-leaks: npm
cd dist/build/uBlock0.npm && npm run check-leaks
dist/build/uBlock0.dig: tools/make-nodejs.sh $(sources) $(platform) $(assets)
tools/make-dig.sh
dig: dist/build/uBlock0.dig
cd dist/build/uBlock0.dig && npm install
dig-snfe: dig
cd dist/build/uBlock0.dig && npm run snfe $(run_options)
mv3-chromium: tools/make-mv3.sh $(sources) $(platform)
tools/make-mv3.sh chromium
mv3-firefox: tools/make-mv3.sh $(sources) $(platform)
tools/make-mv3.sh firefox
mv3-quick: tools/make-mv3.sh $(sources) $(platform)
tools/make-mv3.sh quick
mv3-full: tools/make-mv3.sh $(sources) $(platform)
tools/make-mv3.sh full
dist/build/uAssets:
tools/pull-assets.sh
clean:
rm -rf dist/build tmp/node_modules
# Not real targets, just convenient for auto-completion at shell prompt
compare:
@echo
maxcost:
@echo
medcost:
@echo
mincost:
@echo
modifiers:
@echo
record:
@echo
wasm:
@echo