WebP is a CANCER on Productive Society
In order to help combat FORCED webp adoption, I have developed a method for compiling the PaleMoon web browser WITHOUT any webp support at all. This means webp images will simply download as files so they can be converted to real formats outside of the browser. Why do this? Well even with addons such as “don’t accept webp” certain websites will still serve you webp files but they will come disguised as a real image format.
These fake files are just webp files and they will still be decoded as webps and when saved will just be webps with a fake extension, leading to more confusion. I have been working on an article/video for a while now that will specifically go over why webp SUX. For now this is my current solution to the problem.
I ASSUME this process is similar for other browsers such as modern firefox and its forks (Libre wolf). However due to the forced use of rust and the sheer bloat of modern firefox I make no guarantees it will work. I would rather have a rust free (Stainless) and easy to compile browser FIRST before trying to remove webp, PaleMoon fits this requirement perfectly. This could also be done in chromeium, but again BLOAT.
I hope this article makes it to someone with a little more knowledge of the architecture of the PaleMoon browser, someone who could help develop a simple ac_add_option flag such as “--disable-webp” so this entire process could be done with one config line. If you do know more about this stuff and you want to correct something or add to this guide then contact me.
Compilation Requirements
To begin I will explain the basics of compiling PaleMoon. The version I am using is 33 (tee hee). Below is a list of required packages I’ve found, these are for debian based systems so your package names may be different and I am not sure all of these will be TRULY required. For example since PaleMoon is using gtk3 I don’t know if you REALLY need libgtk2.0-dev. Most of these will already be installed if you are using a gtk based desktop like mate or xfce.
apt install git build-essential libgtk2.0-dev libdbus-glib-1-dev autoconf2.13 yasm libegl1-mesa-dev libasound2-dev libxt-dev zlib1g-dev libssl-dev libsqlite3-dev libbz2-dev libpulse-dev libgconf2-dev libx11-xcb-dev zip cmake libglib2.0-0 libgtk-3-dev (these boxes can scroll in case you didn't notice)
PaleMoon needs Python2.7 to build. This is a problem because debian based systems no longer provide a method for installing Python2.7 so you are going to have to download and compile it yourself. This is easy just download the archive and extract it. Next open a terminal in the extracted directory, run [./configure] then run [make], and install using [sudo make install]. Python2.7 will now be installed on your system.
Download and Configure PaleMoon
Now it is time to download the PaleMoon source code using git. First you should probably make a folder for this stuff like so:
mkdir ~/git && cd ~/git
Clone the PaleMoon repo:
git clone https://repo.palemoon.org/MoonchildProductions/Pale-Moon.git
You need to do more git stuff but first enter the newly downloaded Pale-Moon directory.
cd Pale-Moon git submodule init && git submodule update git checkout release && git submodule update
Next you will want to create and modify the [.mozconfig] file. This file lives in the “root” PaleMoon source directory [~/git/Pale-Moon/.mozconfig] . I would SERIOUSLY RECOMMEND that you copy the example .mozconfig file from the PaleMoon build guide as my .mozconfig file below is intended for 32bit linux systems.
_GTK_VERSION=3 ac_add_options --target=i686-linux-gnu # Standard build options for Pale Moon ac_add_options --enable-application=palemoon ac_add_options --enable-optimize="-O2 -w" ac_add_options --enable-default-toolkit=cairo-gtk$_GTK_VERSION ac_add_options --enable-jemalloc ac_add_options --enable-strip ac_add_options --enable-devtools ac_add_options --disable-av1 ac_add_options --disable-jxl ac_add_options --disable-webrtc ac_add_options --disable-gamepad ac_add_options --disable-tests ac_add_options --disable-debug ac_add_options --disable-necko-wifi ac_add_options --disable-updater ac_add_options --disable-crashreporter ac_add_options --with-pthreads ac_add_options --enable-official-branding export MOZILLA_OFFICIAL=1 ac_add_options --x-libraries=/usr/lib export MOZ_PKG_SPECIAL=gtk$_GTK_VERSION mk_add_options MOZ_CRASHREPORTER=0 mk_add_options MOZ_DATA_REPORTING=0 mk_add_options MOZ_SERVICES_HEALTHREPORT=0 mk_add_options MOZ_TELEMETRY_REPORTING=0
You will notice I have quite a lot of changes compared to the example .mozconfig, first the removal of the _BUILD_64=1 line, the inclusion of the i686 target, setting av1 and jpegXL support to DISABLED, disabling crash reporter, and a few other options at the bottom which may or may not actually do anything. There are probably more options you can enable but this is the bare minimum I need for my old 32bit systems. I would recommend keeping jpegxl and av1 disabled but this is not required.
Remove The Parasite
Now begins the fun part, physically REMOVING webp from the browser entirely. This is being done in a DESTRUCTIVE way and I might be missing certain things so be warned! Start off by deleting the libwebp folder and a few supporting files:
delete platfrom/media/libwebp platfrom/image/decoders/nsWebPDecoder.cpp platfrom/image/decoders/nsWebPDecoder.h
Next open and edit each of these files accordingly:
edit platform/config/external/moz.build remove the reference to libwebp on line 36. edit platfrom/image/decoders/moz.build remove the reference to nsWebPDecoder.cpp on line 28. edit platfrom/image/DecoderFactory.cpp remove the include on line 21. Around line 77 remove the webp entry, be careful make sure you do not remove the cury bracket in front of the else if statement on line 79. Delete everything after that bracket up to line 81. Remove the webp case entry on lines 125-127. Remove the webp entry on line 208, but make sure you fix line 207 by removing the || at the end and replacing it with ); edit platfrom/image/DecoderFactory.h Remove the webp entry on line 40. edit platfrom/layout/media/symbols.def.in Remove lines 305-318. edit palemoon/components/BrowserComponents.manifest Remove line 39. edit palemoon/components/feeds/WebContentConverter.js Remove the webp entry on line 37. edit platform/uriloader/exthandler/nsExternalHelperAppService.cpp Remove the webp entry on line 511.
I believe this is the minimal required to remove webp support from the browser, however that doesn’t mean we are totally cured of the cancer that is webp…
Dormant Illnesses
There are still plenty of instances of webp across multiple files in the browser. I do not think you NEED to do the following steps but they are here for reference. For starters JPEGXL has webp as a dependency so it can “benchmark” against it. This may or may not be configured to compile if you have jpegxl enabled but could cause errors if it is. Here are some of the files I’ve found that contain references to webp:
delete platform/media/libjxl/src/tools/benchmark/benchmark_codec_webp.cc platform/media/libjxl/src/tools/benchmark/benchmark_codec_webp.h edit and remove all references to webp in the following files: platform/media/libjxl/src/tools/benchmark/benchmark_codec.cc platform/media/libjxl/src/tools/benchmark/benchmark_args.cc platform/media/libjxl/src/tools/benchmark/metrics/plots.py platform/media/libjxl/src/debian/control platform/media/libjxl/src/docker/scripts/jpegxl_builder.sh platform/media/libjxl/src/ci.sh
There may be more files here that I am missing, let me know. I am not providing line numbers for these just ctrl-f webp then remove the references in the correct way.
(you should know how to do this right?)
The next big webp tumor is inside of SKIA, a graphics library that is owned by google and is used in both chrome and firefox based browsers. Skia seems to include its own webp decoder.
delete platform/gfx/skia/skia/src/codec/SkWebpCodec.cpp platform/gfx/skia/skia/src/codec/SkWebpCodec.h platform/gfx/skia/skia/src/codec/SkWebpAdapterCodec.cpp platform/gfx/skia/skia/src/codec/SkWebpAdapterCodec.h platform/gfx/skia/skia/src/images/SkWEBPImageEncoder.cpp
Then edit and remove all references to webp in these files, I may be missing some and this could break stuff.
platform/gfx/skia/skia/src/codec/SkCodec.cpp replace WEBP_VP8_HEADER_SIZE with 30 as defined in the SkWebpCodec.h file then remove all other references to webp platform/gfx/skia/skia/src/images/SkForceLinking.cpp platform/gfx/skia/skia/src/codec/SkAndroidCodec.cpp platform/gfx/skia/skia/src/android/SkBitmapRegionDecoder.cpp platform/gfx/skia/skia/include/core/SkImageEncoder.h platform/gfx/skia/skia/include/codec/SkEncodedFormat.h
And once again there is probably more in the Skia folder I am missing, these were just the ones I could find quickly. In fact this is not the end of webp at all, there are still more references in other libs and things in PaleMoon such as:
platfrom/media/webrtc/trunk/build/all.gyp platfrom/media/openmax_il/il112/OMX_ImageExt.h and a TON of files in platform/media/ffvpx/ folder.
The First Victory in a Defensive War
I am sure the list of files containing references to webp goes on but for now this guide should at least put the cancer that is webp into remission, although it will take a lot more work to fully rid the source code of webp, or at least let users have a choice.
I would also like to put forth the possibility of creating a fake dynamic linked webp library which can be used in place of the typical libwebp so when software on your computer tries to access it the fake lib just does nothing. This will help solve the problem on software you are not or cannot compile from source.
If you want my 32 bit linux build of palemoon 33 without webp support then you can download that HERE!
I hope you found this guide somewhat helpful in ridding your life from the fake image format known as webp. Once again if you have anything to add to this hit me up. I will try and make a video to go along with this article in the future.