Firefox
Firefox is Mozilla's web browser.
Do not confuse the Firefox browser with Firefox OS, which is a discontinued operating system. There was an "unbranded" version of Mozilla's Firefox called "Aurora".
Installation
USE flags
USE flags for www-client/firefox Firefox Web Browser
X
|
Add support for X11 |
clang
|
Use Clang compiler instead of GCC |
dbus
|
Enable dbus support for anything that needs it (gpsd, gnomemeeting, etc) |
debug
|
Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces |
eme-free
|
Disable EME (DRM plugin) capability at build time |
geckodriver
|
Enable WebDriver support |
gmp-autoupdate
|
Allow Gecko Media Plugins (binary blobs) to be automatically downloaded and kept up-to-date in user profiles |
hardened
|
Activate default security enhancements for toolchain (gcc, glibc, binutils) |
hwaccel
|
Force-enable hardware-accelerated rendering (Mozilla bug 594876) |
jack
|
Add support for the JACK Audio Connection Kit |
libproxy
|
Enable libproxy support |
lto
|
Enable Link Time Optimization (LTO) |
openh264
|
Use media-libs/openh264 for H264 support instead of downloading binary blob from Mozilla at runtime |
pgo
|
Add support for profile-guided optimization for faster binariesthis option will double the compile time |
pulseaudio
|
Add support for PulseAudio sound server |
screencast
|
Enable support for remote desktop and screen cast using PipeWire |
selinux
|
!!internal use only!! Security Enhanced Linux support, this must be set by the selinux profile or breakage will occur |
sndio
|
Enable support for the media-sound/sndio backend |
system-av1
|
Use the system-wide media-libs/dav1d and media-libs/libaom library instead of bundled |
system-harfbuzz
|
Use the system-wide media-libs/harfbuzz and media-gfx/graphite2 instead of bundled |
system-icu
|
Use the system-wide dev-libs/icu instead of bundled |
system-jpeg
|
Use the system-wide media-libs/libjpeg-turbo instead of bundled |
system-libevent
|
Use the system-wide dev-libs/libevent instead of bundled |
system-libvpx
|
Use the system-wide media-libs/libvpx instead of bundled |
system-png
|
Use the system-wide media-libs/libpng instead of bundled (requires APNG patches) |
system-python-libs
|
Use system's python site instead of bundled python libraries |
system-webp
|
Use the system-wide media-libs/libwebp instead of bundled |
wayland
|
Enable dev-libs/wayland backend |
wifi
|
Enable wireless network functions |
The above list of USE flag is not comprehensive. Use equery (part of app-portage/gentoolkit) for a full list:
user $
equery uses www-client/firefox
Emerge
Firefox takes a relatively long time to compile. Unless there is a specific reason not to (such as the need for non default USE flags), use the "-bin" version to save time!
Binary package (firefox-bin)
Emerging the source version of Firefox can be a long process, so there is a pre-compiled (binary) version in the Gentoo ebuild repository. To emerge the Firefox binary:
root #
emerge --ask www-client/firefox-bin
Using the pre-compiled www-client/firefox-bin package means that almost all of the USE flags in the list above cannot be set: setting these flags while using this package will not alter the binary. When using the pre-built package, note this message.
From source
To install Firefox from source:
root #
emerge --ask www-client/firefox
This will install Firefox Extended Support Release (ESR) on a stable branch Gentoo system (or Firefox "Rapid release" if ~amd64 keyword is selected).
For information about Firefox releases, see choosing a Firefox update channel.
Specify a slot
This will explain how to select a Firefox package from a specific slot.
To select a release irrespective of keywords, subscribe to a slot:
root #
emerge --ask www-client/firefox:esr
Or:
root #
emerge --ask www-client/firefox:rapid
This will add the package from a specific slot to the selected set (/var/lib/portage/world). Read more about the motivation of slotting.
If a slot for Firefox has been previously selected, start by using
--deselect
to remove the entry from the world file:
root #
emerge --deselect www-client/firefox:esr
root #
emerge -av www-client/firefox:rapid
Configuration
Running under Wayland
In www-client/firefox and www-client/firefox-bin, Wayland will be enabled by default if the
wayland
USE flag is set. These instructions are kept in case that still fails. Since Firefox 65, it is possible to run Firefox natively under Wayland by launching it with the GDK_BACKEND=wayland
environment variable set after having emerged Firefox with the USE flag wayland
enabled. From a terminal:
user $
GDK_BACKEND="wayland" firefox
Also, make sure that the generic Wayland environment variables XDG_RUNTIME_DIR, WAYLAND_DISPLAY, and XDG_SESSION_TYPE are exported correctly to ensure that GDK can communicate with the compositor.
To set Firefox to always open using the Wayland backend, set the following environment variable in the user's shell. Bash is the default user shell on Gentoo systems:
~/.bash_profile
# Enable Wayland support for Mozilla Firefox export MOZ_ENABLE_WAYLAND=1
Enabling multitouch
Xinput2 scrolling
This brings touch scrolling and multitouch support for Firefox:
MOZ_USE_XINPUT2 environment variable has to be set to a value of 1
in /etc/env.d/80firefox, or just before launching firefox in a shell. for example:
user $
MOZ_USE_XINPUT2="1" firefox
This also eliminates the predefined scroll step size for touchpad scrolling! All scrolling will be really smooth.
Wacom tablets/touchscreens may need extra configuration so they emit true touch events for X.
Multitouch zoom
This only works when the multitouch events reach Firefox, therefore the Xinput2
activation above has to be done first.
Description | about:config option | Value |
---|---|---|
Multitouch activation | gestures.enable_single_finger_input
|
False
|
Zoom in | browser.gesture.pinch.in
|
cmd_fullZoomReduce
|
Zoom out | browser.gesture.pinch.out
|
cmd_fullZoomEnlarge
|
Middle mouse scroll (autoscroll)
Traditionally in Linux, the middle mouse button is used to paste the currently selected (highlighted) text into a text field. On Windows systems, the middle mouse button in Firefox is used for click-and-drag scrolling up and down the page. This functionality can be enabled in Firefox by opening about:config
and setting the following value[1]:
general.autoScroll = true
Middle click-and-drag scrolling should now be enabled.
Although not necessary, sometimes it is desirable to disable all other middle-click functionality within Firefox when using click-and-drap scrolling. Open about:config
and set the following values to disable middle-click functionality:
middlemouse.contentLoadURL = false
middlemouse.openNewWindow = false
middlemouse.paste = false
Bigger scrolling regions for Up/Down
PageUp/PageDown scroll for a page, Up/Down scroll for a line, many will benefit if Up/Down would scroll for a few lines:
Description | about:config option | Value |
---|---|---|
Vertical scroll distance, not for mouse (default is 3) | toolkit.scrollbox.verticalScrollDistance
|
30
|
To increase scrolling size for a mouse also:
Description | about:config option | Value |
---|---|---|
Vertical scroll distance, for mouse and keyboard (default is 1) | mousewheel.min_line_scroll_amount
|
N
|
Threads
Firefox >= 54 has 4 threads enabled by default. Threads can be adjusted by modifying the following in the about:config
interface:
Description | about:config option | Value |
---|---|---|
Increase the threads | dom.ipc.processCount
|
N
|
Where N
is an integer number.
Audio backend
Firefox's cubeb audio library supports a number of different backends[2][3].
Description | about:config option | Value |
---|---|---|
JACK | media.cubeb.backend
|
jack
|
Disabling percent-encoding
Normally, URLs that are copied from the address bar get percent-encoded. This may cause an annoyance when certain non-Latin symbols (such as Cyrillic) get encoded, as they become unreadable to humans.
To disable percent-encoding when copying from the address bar, set the about:config
option network.standard-url.escape-utf8
to false
.
Unfortunately Firefox does not support non-Latin symbols in anchors, those remain encoded (not percent-encoded, though).
Disable enforced digital signatures verification in Firefox >=48
This concerns mandatory add-ons signature in Firefox and can lead to security issues.
Method 1
Create this file:
/usr/lib/firefox/config.js
// try { Components.utils.import("resource://gre/modules/addons/XPIProvider.jsm", {}) .eval("SIGNED_TYPES.clear()"); } catch(ex) {} END
Then insert this:
/usr/lib/firefox/defaults/pref/channel-prefs.js
pref("general.config.obscure_value", 0); pref("general.config.filename", "config.js");
Method 2
https://gist.github.com/anonymous/a661949550a26b9522f79095f8ae2d94
Method 3
This patch works for both firefox 49 and firefox 51, and seems to be robust to changes.
/etc/portage/patches/www-client/firefox/no-signature-force-check.patch
--- a/build/mozconfig.common.override 2017-02-06 14:26:05.891721140 +0900 +++ b/build/mozconfig.common.override 2017-02-06 14:25:41.115763755 +0900 @@ -9,3 +9,4 @@ # to override anything done previously. # # The common expected usage is for try builds with nondefault options. +MOZ_REQUIRE_SIGNING=0
The following patch also works for firefox 49.
/etc/portage/patches/www-client/firefox-49.0/no-signature-force-check.patch
diff --git a/browser/confvars.sh.old b/browser/confvars.sh index 7637236..2264bf5 100755 --- a/browser/confvars.sh.old +++ b/browser/confvars.sh @@ -27,7 +27,16 @@ fi # Enable building ./signmar and running libmar signature tests MOZ_ENABLE_SIGNMAR=1 -MOZ_SAFE_BROWSING=1 +# Disable 'safe' browsing +MOZ_SAFE_BROWSING=0 +# Disable checking that add-ons are signed by the trusted root +# https://github.com/mozilla/positron/blob/master/build/mozconfig.common +MOZ_ADDON_SIGNING=0 +# Disable enforcing that add-ons are signed by the trusted root +MOZ_REQUIRE_SIGNING=0 +# https://dxr.mozilla.org/mozilla-central/rev/5cf4d2f7f2f2b3df2f1edd31b8bdce7882f3875c/browser/confvars.sh +# https://dxr.mozilla.org/mozilla-central/source/browser/confvars.sh + MOZ_APP_VERSION=$FIREFOX_VERSION MOZ_APP_VERSION_DISPLAY=$FIREFOX_VERSION_DISPLAY MOZ_EXTENSIONS_DEFAULT=" gio"
Then set xpinstall.signatures.required
to false.
Special URLs
Firefox includes a few dozen special URLs that can be helpful in determining more information about various Firefox settings. These URLs can be entered into the Super Bar (via copy and paste) to view the special pages. A few of the more significant ones include:
about:addons
- Page for managing extensions.about:buildconfig
- Page containing build information about the currently running version of Firefox. Use this page to check what compiler flags were set during Firefox's build.about:cache
- Information about the Network Cache Storage Service.about:config
- Modify internal browser settings and preferences.about:memory
- Measure and show memory reports, free memory, etc.about:networking
- Analyze current network information such as HTTP, socket, and DNS connections.about:plugins
- List installed plugins such as Widevine Content Decryption Module (DRM software).about:support
- A page containing technical information that might be useful when trying to solve a problem. Includes information on WebGL, Window Protocol (X11 or Wayland), and compositing graphics backends.about:telemetry
Finally, about:about
will display the whole list of Firefox' “about” pages. A description for each page is available at Firefox and the "about" protocol.
See also Firefox chrome:// document URLs.
XDG integration
In order to make Firefox use XDG file associations set Content Type's Action to /usr/bin/xdg-open
To ensure Firefox is being used by other applications for handling HTTP and HTTPS links, run the following command:
user $
xdg-mime default firefox.desktop x-scheme-handler/http x-scheme-handler/https text/html
Running under KDE
Firefox is built with GTK, and by default will use the GTK file picker. To enable the KDE file picker, install kde-plasma/xdg-desktop-portal-kde, which is installed by default if kde-plasma/plasma-meta is installed. After that set widget.use-xdg-desktop-portal
to true
in about:config
.
Enabling color management
See the dedicated Color management section.
Security
Running in sandbox
Please see Simple sandbox for suggestions on sandboxing Firefox.
SSL/TLS security enhancements
Some about:config
SSL/TLS security options which are not defaults (as of Firefox 52.2.0) that increase the security of HTTPS connections are listed below. Two of them rarely break access to websites.
Description | about:config option | Value |
---|---|---|
Minimal TLS version set to 1.1. Default is 1 meaning TLS 1.0, unsecure. May break access to some badly configured websites.
|
security.tls.version.min
|
2
|
Avoiding old SSL/TLS version. May break access to some badly configured websites. | security.ssl.require_safe_negotiation
|
true
|
Inform user about insecure SSL/TLS negociation (broken padlock). | security.ssl.treat_unsafe_negotiation_as_broken
|
true
|
Require Online Certificate Status Protocol. Introduces some latency. | security.OCSP.require
|
true
|
Strict Certificate Pinning. | security.cert_pinning.enforcement_level
|
2
|
Don't use DES. | security.ssl3.rsa_des_ede3_sha
|
false
|
Don't use RC4. | security.ssl3.rsa_rc4_128_md5 (if present)
|
false
|
Don't use RC4. | security.ssl3.rsa_rc4_128_sha (if present)
|
false
|
No Google SSL False Start. | security.ssl.enable_false_start
|
false
|
Safer browsing with add-ons
Many users are concerned about their privacy (tracking, bubbling, targeting, etc) while web browsing. Installing Add-ons can aid in adding an extra level of privacy to their browsing.
The add-on menu can be accessed by navigating the following menus: Hamburger button (top right under the X) → Add-ons
Occasionally certain add-ons will use key press event listeners for input from the user. FireFox's "Search for text when I start typing" feature can conflict with key press event listeners used by add-ons. This feature can be disabled by navigating to Hamburger button (top right under the X) → Preferences → Browsing and unchecking the "Search for text when I start typing" option.
uBlock Origin
An ad blocker with lower resource usage, using same lists as Adblock.
Mozilla Add-ons page: https://addons.mozilla.org/en/firefox/addon/ublock-origin/
GitHub: https://github.com/gorhill/uBlock
Wikipedia: https://en.wikipedia.org/wiki/UBlock
NoScript
NoScript blocks JavaScript that is normally enabled by default. It can keep users safe and speed up web browsing.
Mozilla Add-ons page: https://addons.mozilla.org/en-US/firefox/addon/noscript/
Homepage: https://noscript.net/
uMatrix
Point and click to forbid/allow any class of requests made by the browser. Use it to block scripts, iframes, ads, Facebook, etc. uMatrix can also be used for spoofing HTTP referrer, spoofing User Agent strings, blocking hyperlink auditing and forcing strict HTTPS. Note, uMatrix can break many websites and most websites need configuration changes to work correctly.
Mozilla Add-ons page: https://addons.mozilla.org/en-US/firefox/addon/umatrix/
GitHub: https://github.com/gorhill/uMatrix
Video speed controller
Using an HTML5 video speed controller can be helpful in accelerating the playback rate of HTML 5 video. This is useful when binging video content on sites that do not offer increases in video playback speed (such as Amazon Prime Video or Netflix).
Mozilla Add-ons page: https://addons.mozilla.org/en-US/firefox/addon/videospeed/
GitHub: https://github.com/codebicycle/videospeed
Troubleshooting
gtk+:3 pulls in DBUS
Since version ≥53.0, Firefox has dropped gtk+:2 support urging Larry to use gtk+:3. This, however, by default, pulls-in annoyances like DBUS. This can be avoided by using a patch from BSD available in bug #669234 or the mv overlay.
Please note that, when running Firefox under native Wayland (i.e. not using XWayland), Firefox will implicitly try to use DBus to enable its remote control feature and crash, likely with a segfault, due to the lack of DBus. Thus, it is necessary to invoke Firefox with the --no-remote
command-line argument or MOZ_NO_REMOTE
environment variable set (to anything).
Crashes
If Firefox crashes for no apparent reason every few minutes with an error message like ABORT: X_GLXDestroyContext: GLXBadContext; 15 requests ago
it might help to add the Firefox user(s) to the video group:
root #
gpasswd -a <username> video
Lack of sound (www-client/firefox-bin)
www-client/firefox-bin expects PulseAudio. ALSA-only systems might work around this limitation by using media-sound/apulse. For this to work, modify Firefox sandbox settings by going to about:config
and adding /dev/snd/ (note the trailing slash) to the security.sandbox.content.write_path_whitelist
option.
If storing ALSA settings in $HOME, also, be sure to add $HOME/.asoundrc to the security.sandbox.content.write_path_whitelist
option. Whitelist path could be separated by comma.
Since around Firefox 58 there is additional modification needed to work around seccomp sandbox: security.sandbox.content.syscall_whitelist = 16
It is now possible to go ahead and create alias for running Firefox through apulse:
user $
alias firefox='apulse firefox-bin'
Lack of sound when using PipeWire (www-client/firefox)
Problem: System sound is working properly, but Firefox itself is unable to provide sound playback.
Cause: The www-client/firefox package has support for two audio backends: ALSA and PulseAudio. With PipeWire becoming the standard audio backend on Linux, support for ALSA (via the alsa
USE flag) or PulseAudio (via the pulseaudio
USE flag) may not be enabled by the target desktop profile. The default audio backend for Firefox can be checked under about:support#media
under Audio Backend:
Solution: Enable either the alsa
or pulseaudio
USE flags for Firefox and then recompile Firefox. Be sure to follow the steps detailed in the PipeWire article to setup either pipewire-alsa or audio backend.
Screen tearing / stuttering smooth scrolling
Build www-client/firefox with the hwaccel
USE flag , then check the Compositing value of the about:support#graphics
table for WebRender.
This solution does not work with www-client/firefox-bin because the USE flag is not available.
Systems with Wayland support should not have issues with screen tearing.
If WebRender is enabled, then the problem could be with the video drivers. For example about Intel.
Green video screen (youtube)
If disabling (graphics) acceleration in settings does not work, disabling the equivalent options under about:config
like layers.acceleration.force-enabled
(85.0) might.
Windows decorations missing in Fluxbox since FF-91.3.0
- https://forums.gentoo.org/viewtopic-t-1141870.html Solved in 91.9.0esr and back with 102.3.0esr (64-bit)
Determine if Firefox is running the Wayland protocol backend
To determine if Firefox is running with the Wayland protocol as a backend, check about:support#graphics
table for the Window Protocol value. "wayland" will be displayed when running on the Wayland protocol. Other possible values include Xwayland and x11.
KDE Plasma Integration: failed to connect to the native host
If using www-client/firefox-bin, plasma integration might not work with default install due to org.kde.plasma.browser_integration.json
installed in an unexpected directory (/usr/lib64/mozilla instead of /usr/lib/mozilla). See bug bug #687736 for details.
As a work around, creating a symlink will work:
root #
ln -s /usr/lib64/mozilla /usr/lib/mozilla
See also
- Thunderbird — Mozilla's solution to the e-mail client.
External resources
- The official Firefox wiki (out-of-date)
- Firefox on Mozilla's Forums
- Firefox on Mozilla's Buglist
- Change the interface language (L10N)
- Creating a new profile
- Firefox about:config privacy enhancements