diff --git a/.github/workflows/src/alpha-build.sh b/.github/workflows/src/alpha-build.sh index fe7b9fdfc..b4a9ccd46 100644 --- a/.github/workflows/src/alpha-build.sh +++ b/.github/workflows/src/alpha-build.sh @@ -1,7 +1,5 @@ set -ex -export ZEN_RELEASE=1 - if command -v apt-get &> /dev/null then sudo apt-get update @@ -19,10 +17,12 @@ then export LLVM_PROFDATA=$HOME/.mozbuild/clang/bin/llvm-profdata export DISPLAY=:2 fi + export ZEN_RELEASE=1 pnpm build else echo "Xvfb could not be found, running without it" echo "ASSUMING YOU ARE RUNNING THIS ON MACOS" set -v + export ZEN_RELEASE=1 pnpm build fi diff --git a/.github/workflows/src/windows_mozconfig b/.github/workflows/src/windows_mozconfig index 9a93568ef..a74a0976a 100644 --- a/.github/workflows/src/windows_mozconfig +++ b/.github/workflows/src/windows_mozconfig @@ -32,7 +32,7 @@ ac_add_options --disable-bits-download # ac_add_options --enable-profile-generate=cross # ac_add_options --without-wasm-sandboxed-libraries # else -# ac_add_options --disable-profiling +ac_add_options --disable-profiling # ac_add_options --enable-profile-use=cross # ac_add_options --with-pgo-profile-path=$(echo ~)/artifact/merged.profdata # ac_add_options --with-pgo-jarlog=$(echo ~)/artifact/en-US.log diff --git a/configs/common/mozconfig b/configs/common/mozconfig index 48efcf7e1..c26989b7b 100644 --- a/configs/common/mozconfig +++ b/configs/common/mozconfig @@ -48,12 +48,12 @@ if test "$ZEN_RELEASE"; then ac_add_options --enable-proxy-bypass-protection ac_add_options --enable-hardening - ac_add_options --enable-sandbox ac_add_options --disable-crashreporter ac_add_options --disable-dmd ac_add_options --disable-geckodriver ac_add_options --disable-rust-tests + ac_add_options --disable-default-browser-agent export MOZ_LTO=thin ac_add_options MOZ_LTO=thin @@ -77,6 +77,9 @@ if test "$ZEN_RELEASE"; then ac_add_options OPT_LEVEL="3" export RUSTC_OPT_LEVEL="3" ac_add_options RUSTC_OPT_LEVEL="3" + + mk_add_options AUTOCLOBBER=1 + export AUTOCLOBBER=1 fi ac_add_options --enable-unverified-updates @@ -88,9 +91,16 @@ ac_add_options --enable-jxl ac_add_options --enable-av1 ac_add_options --enable-eme=widevine +ac_add_options --with-unsigned-addon-scopes=app,system + export MOZ_REQUIRE_SIGNING= export MOZ_TELEMETRY_REPORTING= +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 + if test "$ZEN_CROSS_COMPILING"; then ac_add_options --target=x86_64-pc-linux-gnu fi diff --git a/configs/linux/mozconfig b/configs/linux/mozconfig index bbe5c7f2d..f90b2e9e6 100644 --- a/configs/linux/mozconfig +++ b/configs/linux/mozconfig @@ -12,6 +12,7 @@ if ! test "$ZEN_CROSS_COMPILING"; then fi ac_add_options --enable-linker=lld + ac_add_options --disable-elf-hack fi if test "$ZEN_RELEASE"; then diff --git a/src/browser/app/profile/fast-fox.js b/src/browser/app/profile/fast-fox.js new file mode 100644 index 000000000..2311ce6bb --- /dev/null +++ b/src/browser/app/profile/fast-fox.js @@ -0,0 +1,640 @@ + +/**************************************************************************************** + * Fastfox * + * "Non ducor duco" * + * priority: speedy browsing * + * version: 128 * + * url: https://github.com/yokoffing/Betterfox * + ***************************************************************************************/ + +/**************************************************************************** + * SECTION: GENERAL * +****************************************************************************/ + +// PREF: initial paint delay +// How long FF will wait before rendering the page (in ms) +// [NOTE] You may prefer using 250. +// [NOTE] Dark Reader users may want to use 1000 [3]. +// [1] https://bugzilla.mozilla.org/show_bug.cgi?id=1283302 +// [2] https://docs.google.com/document/d/1BvCoZzk2_rNZx3u9ESPoFjSADRI0zIPeJRXFLwWXx_4/edit#heading=h.28ki6m8dg30z +// [3] https://old.reddit.com/r/firefox/comments/o0xl1q/reducing_cpu_usage_of_dark_reader_extension/ +// [4] https://reddit.com/r/browsers/s/wvNB7UVCpx +//pref("nglayout.initialpaint.delay", 5); // DEFAULT; formerly 250 + //pref("nglayout.initialpaint.delay_in_oopif", 5); // DEFAULT + +// PREF: page reflow timer +// Rather than wait until a page has completely downloaded to display it to the user, +// web browsers will periodically render what has been received to that point. +// Because reflowing the page every time additional data is received slows down +// total page load time, a timer was added so that the page would not reflow too often. +// This preference specfies whether that timer is active. +// [1] https://kb.mozillazine.org/Content.notify.ontimer +// true = do not reflow pages at an interval any higher than that specified by content.notify.interval (default) +// false = reflow pages whenever new data is received +//pref("content.notify.ontimer", true); // DEFAULT + +// PREF: notification interval (in microseconds) to avoid layout thrashing +// When Firefox is loading a page, it periodically reformats +// or "reflows" the page as it loads. The page displays new elements +// every 0.12 seconds by default. These redraws increase the total page load time. +// The default value provides good incremental display of content +// without causing an increase in page load time. +// [NOTE] Lowering the interval will increase responsiveness +// but also increase the total load time. +// [WARNING] If this value is set below 1/10 of a second, it starts +// to impact page load performance. +// [EXAMPLE] 100000 = .10s = 100 reflows/second +// [1] https://searchfox.org/mozilla-central/rev/c1180ea13e73eb985a49b15c0d90e977a1aa919c/modules/libpref/init/StaticPrefList.yaml#1824-1834 +// [2] https://dev.opera.com/articles/efficient-javascript/?page=3#reflow +// [3] https://dev.opera.com/articles/efficient-javascript/?page=3#smoothspeed +pref("content.notify.interval", 100000); // (.10s); default=120000 (.12s) + +// PREF: new tab preload +// [WARNING] Disabling this may cause a delay when opening a new tab in Firefox. +// [1] https://wiki.mozilla.org/Tiles/Technical_Documentation#Ping +// [2] https://github.com/arkenfox/user.js/issues/1556 +//pref("browser.newtab.preload", true); // DEFAULT + +// PREF: disable EcoQoS [WINDOWS] +// Background tab processes use efficiency mode on Windows 11 to limit resource use. +// [WARNING] Leave this alone, unless you're on Desktop and you rely on +// background tabs to have maximum performance. +// [1] https://devblogs.microsoft.com/performance-diagnostics/introducing-ecoqos/ +// [2] https://bugzilla.mozilla.org/show_bug.cgi?id=1796525 +// [3] https://bugzilla.mozilla.org/show_bug.cgi?id=1800412 +// [4] https://reddit.com/r/firefox/comments/107fj69/how_can_i_disable_the_efficiency_mode_on_firefox/ +//pref("dom.ipc.processPriorityManager.backgroundUsesEcoQoS", false); + +// PREF: control how tabs are loaded when a session is restored +// true=Tabs are not loaded until they are selected (default) +// false=Tabs begin to load immediately. +//pref("browser.sessionstore.restore_on_demand", true); // DEFAULT + //pref("browser.sessionstore.restore_pinned_tabs_on_demand", true); +//pref("browser.sessionstore.restore_tabs_lazily", true); // DEFAULT + +// PREF: disable preSkeletonUI on startup [WINDOWS] +//pref("browser.startup.preXulSkeletonUI", false); + +// PREF: lazy load iframes +//pref("dom.iframe_lazy_loading.enabled", true); // DEFAULT [FF121+] + +/**************************************************************************** + * SECTION: GFX RENDERING TWEAKS * +****************************************************************************/ + +// PREF: Webrender tweaks +// [1] https://searchfox.org/mozilla-central/rev/6e6332bbd3dd6926acce3ce6d32664eab4f837e5/modules/libpref/init/StaticPrefList.yaml#6202-6219 +// [2] https://hacks.mozilla.org/2017/10/the-whole-web-at-maximum-fps-how-webrender-gets-rid-of-jank/ +// [3] https://www.reddit.com/r/firefox/comments/tbphok/is_setting_gfxwebrenderprecacheshaders_to_true/i0bxs2r/ +// [4] https://www.reddit.com/r/firefox/comments/z5auzi/comment/ixw65gb?context=3 +// [5] https://gist.github.com/RubenKelevra/fd66c2f856d703260ecdf0379c4f59db?permalink_comment_id=4532937#gistcomment-4532937 +//pref("gfx.webrender.all", true); // enables WR + additional features +//pref("gfx.webrender.precache-shaders", true); // longer initial startup time +//pref("gfx.webrender.compositor", true); // DEFAULT WINDOWS macOS + //pref("gfx.webrender.compositor.force-enabled", true); // enforce + +// PREF: if your hardware doesn't support Webrender, you can fallback to Webrender's software renderer +// [1] https://www.ghacks.net/2020/12/14/how-to-find-out-if-webrender-is-enabled-in-firefox-and-how-to-enable-it-if-it-is-not/ +//pref("gfx.webrender.software", true); // Software Webrender uses CPU instead of GPU + //pref("gfx.webrender.software.opengl", true); // LINUX + +// PREF: GPU-accelerated Canvas2D +// Use gpu-canvas instead of to skia-canvas. +// [WARNING] May cause issues on some Windows machines using integrated GPUs [2] [3] +// Add to your overrides if you have a dedicated GPU. +// [NOTE] Higher values will use more memory. +// [1] https://bugzilla.mozilla.org/show_bug.cgi?id=1741501 +// [2] https://github.com/yokoffing/Betterfox/issues/153 +// [3] https://github.com/yokoffing/Betterfox/issues/198 +//pref("gfx.canvas.accelerated", true); // DEFAULT macOS LINUX [FF110]; not compatible with WINDOWS integrated GPUs + pref("gfx.canvas.accelerated.cache-items", 4096); // default=2048; alt=8192 + pref("gfx.canvas.accelerated.cache-size", 512); // default=256; alt=1024 + pref("gfx.content.skia-font-cache-size", 20); // default=5; Chrome=20 + // [1] https://bugzilla.mozilla.org/show_bug.cgi?id=1239151#c2 + +// PREF: prefer GPU over CPU +// At best, the prefs do nothing on Linux/macOS. +// At worst, it'll result in crashes if the sandboxing is a WIP. +// [1] https://firefox-source-docs.mozilla.org/dom/ipc/process_model.html#gpu-process +//pref("layers.gpu-process.enabled", true); // DEFAULT WINDOWS + //pref("layers.gpu-process.force-enabled", true); // enforce + //pref("layers.mlgpu.enabled", true); // LINUX +//pref("media.hardware-video-decoding.enabled", true); // DEFAULT WINDOWS macOS + //pref("media.hardware-video-decoding.force-enabled", true); // enforce +//pref("media.gpu-process-decoder", true); // DEFAULT WINDOWS +//pref("media.ffmpeg.vaapi.enabled", true); // LINUX + +// PREF: disable AV1 for hardware decodeable videos +// Firefox sometimes uses AV1 video decoding even to GPUs which do not support it. +// [1] https://www.reddit.com/r/AV1/comments/s5xyph/youtube_av1_codec_have_worse_quality_than_old_vp9 +//pref("media.av1.enabled", false); + +// PREF: hardware and software decoded video overlay [FF116+] +// [1] https://bugzilla.mozilla.org/show_bug.cgi?id=1829063 +// [2] https://phabricator.services.mozilla.com/D175993 +//pref("gfx.webrender.dcomp-video-hw-overlay-win", true); // DEFAULT + //pref("gfx.webrender.dcomp-video-hw-overlay-win-force-enabled", true); // enforce +//pref("gfx.webrender.dcomp-video-sw-overlay-win", true); // DEFAULT + //pref("gfx.webrender.dcomp-video-sw-overlay-win-force-enabled", true); // enforce + +/**************************************************************************** + * SECTION: DISK CACHE * +****************************************************************************/ + +// PREF: disk cache +// [NOTE] If you think it helps performance, then feel free to override this. +// [SETTINGS] See about:cache +// More efficient to keep the browser cache instead of having to +// re-download objects for the websites you visit frequently. +// [1] https://www.janbambas.cz/new-firefox-http-cache-enabled/ +//pref("browser.cache.disk.enable", true); // DEFAULT + +// PREF: disk cache size +// [1] https://bugzilla.mozilla.org/buglist.cgi?bug_id=913808,968106,968101 +// [2] https://rockridge.hatenablog.com/entry/2014/09/15/165501 +// [3] https://www.reddit.com/r/firefox/comments/17oqhw3/firefox_and_ssd_disk_consumption/ +//pref("browser.cache.disk.smart_size.enabled", false); // force a fixed max cache size on disk +//pref("browser.cache.disk.capacity", 512000); // default=256000; size of disk cache; 1024000=1GB, 2048000=2GB +//pref("browser.cache.disk.max_entry_size", 51200); // DEFAULT (50 MB); maximum size of an object in disk cache + +// PREF: Race Cache With Network (RCWN) [FF59+] +// [ABOUT] about:networking#rcwn +// Firefox concurrently sends requests for cached resources to both the +// local disk cache and the network server. The browser uses whichever +// result arrives first and cancels the other request. This approach sometimes +// loads pages faster because the network can be quicker than accessing the cache +// on a hard drive. When RCWN is enabled, the request might be served from +// the server even if you have valid entry in the cache. Set to false if your +// intention is to increase cache usage and reduce network usage. +// [1] https://slides.com/valentingosu/race-cache-with-network-2017 +// [2] https://simonhearne.com/2020/network-faster-than-cache/ +// [3] https://support.mozilla.org/en-US/questions/1267945 +// [4] https://askubuntu.com/questions/1214862/36-syns-in-a-row-how-to-limit-firefox-connections-to-one-website +// [5] https://bugzilla.mozilla.org/show_bug.cgi?id=1622859 +//pref("network.http.rcwn.enabled", true); // DEFAULT + +// PREF: attempt to RCWN only if a resource is smaller than this size +//pref("network.http.rcwn.small_resource_size_kb", 256); // DEFAULT + +// PREF: cache memory pool +// Cache v2 provides a memory pool that stores metadata (such as response headers) +// for recently read cache entries [1]. It is managed by a cache thread, and caches with +// metadata in the pool appear to be reused immediately. +// [1] https://bugzilla.mozilla.org/buglist.cgi?bug_id=986179 +//pref("browser.cache.disk.metadata_memory_limit", 500); // default=250 (0.25 MB); limit of recent metadata we keep in memory for faster access + +// PREF: number of chunks we preload ahead of read +// Large content such as images will load faster. +// [1] https://bugzilla.mozilla.org/buglist.cgi?bug_id=913819,988318 +// [2] http://www.janbambas.cz/new-firefox-http-cache-enabled/ +//pref("browser.cache.disk.preload_chunk_count", 4); // DEFAULT + +// PREF: the time period used to re-compute the frecency value of cache entries +// The frequency algorithm is used to select entries, and entries that are recently +// saved or frequently reused are retained. The frecency value determines how +// frequently a page has been accessed and is used by Firefox's cache algorithm. +// The frequency algorithm is used to select entries, and entries that are recently +// saved or frequently reused are retained. The frecency value determines how +// often a page has been accessed and is used by Firefox's cache algorithm. +// When the memory pool becomes full, the oldest data is purged. By default, +// data older than 6 hours is treated as old. +// [1] https://bugzilla.mozilla.org/buglist.cgi?bug_id=942835,1012327 +// [2] https://bugzilla.mozilla.org/buglist.cgi?bug_id=913808,968101 +//pref("browser.cache.frecency_half_life_hours", 6); // DEFAULT + +// PREF: memory limit (in kB) for new cache data not yet written to disk +// Writes to the cache are buffered and written to disk on background with low priority. +// With a slow persistent storage, these buffers may grow when data is coming +// fast from the network. When the amount of unwritten data is exceeded, new +// writes will simply fail. We have two buckets, one for important data +// (priority) like html, css, fonts and js, and one for other data like images, video, etc. +//pref("browser.cache.disk.max_chunks_memory_usage", 40960); // DEFAULT (40 MB) +//pref("browser.cache.disk.max_priority_chunks_memory_usage", 40960); // DEFAULT (40 MB) + +// PREF: how often to validate document in cache +// [1] https://searchfox.org/mozilla-release/source/modules/libpref/init/StaticPrefList.yaml#1092-1096 +// 0 = once-per-session +// 3 = when-appropriate/automatically (default) +//pref("browser.cache.check_doc_frequency", 3); // DEFAULT + +// PREF: enforce free space checks +// When smartsizing is disabled, we could potentially fill all disk space by +// cache data when the disk capacity is not set correctly. To avoid that, we +// check the free space every time we write some data to the cache. The free +// space is checked against two limits. Once the soft limit is reached we start +// evicting the least useful entries, when we reach the hard limit writing to +// the entry fails. +//pref("browser.cache.disk.free_space_soft_limit", 10240); // default=5120 (5 MB) +//pref("browser.cache.disk.free_space_hard_limit", 2048); // default=1024 (1 MB) + +// PREF: compression level for cached JavaScript bytecode [FF102+] +// [1] https://github.com/yokoffing/Betterfox/issues/247 +// 0 = do not compress (default) +// 1 = minimal compression +// 9 = maximal compression +pref("browser.cache.jsbc_compression_level", 3); + +// PREF: strategy to use for when the bytecode should be encoded and saved [TESTING ONLY] +// -1 makes page load times marginally longer when a page is being loaded for the first time. +// Subsequent reload of websites will be much much faster. +// [1] https://searchfox.org/mozilla-release/source/modules/libpref/init/StaticPrefList.yaml#3461-3488 +// [2] https://www.reddit.com/r/firefox/comments/12786yv/improving_performance_in_firefox_android_part_ii/ +// -1 = saved as soon as the script is seen for the first time, independently of the size or last access time +// 0 = saved in order to minimize the page-load time (default) +//pref("dom.script_loader.bytecode_cache.enabled", true); // DEFAULT +//pref("dom.script_loader.bytecode_cache.strategy", 0); // DEFAULT + +/**************************************************************************** + * SECTION: MEMORY CACHE * +****************************************************************************/ + +// PREF: memory cache +// The "automatic" size selection (default) is based on a decade-old table +// that only contains settings for systems at or below 8GB of system memory [1]. +// Waterfox G6 allows it to go above 8GB machines [3]. +// Value can be up to the max size of an unsigned 64-bit integer. +// -1=Automatically decide the maximum memory to use to cache decoded images, +// messages, and chrome based on the total amount of RAM +// [1] https://kb.mozillazine.org/Browser.cache.memory.capacity#-1 +// [2] https://searchfox.org/mozilla-central/source/netwerk/cache2/CacheObserver.cpp#94-125 +// [3] https://github.com/WaterfoxCo/Waterfox/commit/3fed16932c80a2f6b37d126fe10aed66c7f1c214 +//pref("browser.cache.memory.capacity", -1); // DEFAULT; 256000=256 MB; 512000=500 MB; 1048576=1GB, 2097152=2GB +//pref("browser.cache.memory.max_entry_size", 10240); // (10 MB); default=5120 (5 MB) + +// PREF: amount of Back/Forward cached pages stored in memory for each tab +// Pages that were recently visited are stored in memory in such a way +// that they don't have to be re-parsed. This improves performance +// when pressing Back and Forward. This pref limits the maximum +// number of pages stored in memory. If you are not using the Back +// and Forward buttons that much, but rather using tabs, then there +// is no reason for Firefox to keep memory for this. +// -1=determine automatically (8 pages) +// [1] https://kb.mozillazine.org/Browser.sessionhistory.max_total_viewers#Possible_values_and_their_effects +//pref("browser.sessionhistory.max_total_viewers", 4); + +/**************************************************************************** + * SECTION: MEDIA CACHE * +****************************************************************************/ + +// PREF: media disk cache +//pref("media.cache_size", 512000); // DEFAULT + +// PREF: media memory cache +// [1] https://hg.mozilla.org/mozilla-central/file/tip/modules/libpref/init/StaticPrefList.yaml#l9652 +// [2] https://github.com/arkenfox/user.js/pull/941 +pref("media.memory_cache_max_size", 65536); // default=8192; AF=65536; alt=131072 +//pref("media.memory_caches_combined_limit_kb", 524288); // DEFAULT; alt=1048576 +//pref("media.memory_caches_combined_limit_pc_sysmem", 5); // DEFAULT; alt=10; the percentage of system memory that Firefox can use for media caches + +// PREF: Media Source Extensions (MSE) web standard +// Disabling MSE allows videos to fully buffer, but you're limited to 720p. +// [WARNING] Disabling MSE may break certain videos. +// false=Firefox plays the old WebM format +// true=Firefox plays the new WebM format (default) +// [1] https://support.mozilla.org/en-US/questions/1008271 +//pref("media.mediasource.enabled", true); // DEFAULT + +// PREF: adjust video buffering periods when not using MSE (in seconds) +// [NOTE] Does not affect videos over 720p since they use DASH playback [1] +// [1] https://lifehacker.com/preload-entire-youtube-videos-by-disabling-dash-playbac-1186454034 +pref("media.cache_readahead_limit", 7200); // 120 min; default=60; stop reading ahead when our buffered data is this many seconds ahead of the current playback +pref("media.cache_resume_threshold", 3600); // 60 min; default=30; when a network connection is suspended, don't resume it until the amount of buffered data falls below this threshold + +/**************************************************************************** + * SECTION: IMAGE CACHE * +****************************************************************************/ + +// PREF: image cache +//pref("image.cache.size", 5242880); // DEFAULT; in MiB; alt=10485760 (cache images up to 10MiB in size) +pref("image.mem.decode_bytes_at_a_time", 32768); // default=16384; alt=65536; chunk size for calls to the image decoders + +// PREF: set minimum timeout to unmap shared surfaces since they have been last used +// This is only used on 32-bit builds of Firefox where there is meaningful +// virtual address space pressure. +// [1] https://phabricator.services.mozilla.com/D109440 +// [2] https://bugzilla.mozilla.org/show_bug.cgi?id=1699224 +//pref("image.mem.shared.unmap.min_expiration_ms", 120000); // default=60000; minimum timeout to unmap shared surfaces since they have been last used + +/**************************************************************************** + * SECTION: NETWORK * +****************************************************************************/ + +// PREF: use bigger packets +// [WARNING] Cannot open HTML files bigger than 4MB if changed [2]. +// Reduce Firefox's CPU usage by requiring fewer application-to-driver data transfers. +// However, it does not affect the actual packet sizes transmitted over the network. +// [1] https://www.mail-archive.com/support-seamonkey@lists.mozilla.org/msg74561.html +// [2] https://github.com/yokoffing/Betterfox/issues/279 +//pref("network.buffer.cache.size", 262144); // 256 kb; default=32768 (32 kb) +//pref("network.buffer.cache.count", 128); // default=24 + +// PREF: increase the absolute number of HTTP connections +// [1] https://kb.mozillazine.org/Network.http.max-connections +// [2] https://kb.mozillazine.org/Network.http.max-persistent-connections-per-server +// [3] https://www.reddit.com/r/firefox/comments/11m2yuh/how_do_i_make_firefox_use_more_of_my_900_megabit/jbfmru6/ +pref("network.http.max-connections", 1800); // default=900 +pref("network.http.max-persistent-connections-per-server", 10); // default=6; download connections; anything above 10 is excessive + pref("network.http.max-urgent-start-excessive-connections-per-host", 5); // default=3 + //pref("network.http.max-persistent-connections-per-proxy", 48); // default=32 +//pref("network.websocket.max-connections", 200); // DEFAULT + +// PREF: pacing requests [FF23+] +// Controls how many HTTP requests are sent at a time. +// Pacing HTTP requests can have some benefits, such as reducing network congestion, +// improving web page loading speed, and avoiding server overload. +// Pacing requests adds a slight delay between requests to throttle them. +// If you have a fast machine and internet connection, disabling pacing +// may provide a small speed boost when loading pages with lots of requests. +// false=Firefox will send as many requests as possible without pacing +// true=Firefox will pace requests (default) +pref("network.http.pacing.requests.enabled", false); + //pref("network.http.pacing.requests.min-parallelism", 10); // default=6 + //pref("network.http.pacing.requests.burst", 14); // default=10 + +// PREF: increase DNS cache +// [1] https://developer.mozilla.org/en-US/docs/Web/Performance/Understanding_latency +//pref("network.dnsCacheEntries", 1000); // default=400 + +// PREF: adjust DNS expiration time +// [ABOUT] about:networking#dns +// [NOTE] These prefs will be ignored by DNS resolver if using DoH/TRR. +pref("network.dnsCacheExpiration", 3600); // keep entries for 1 hour + //pref("network.dnsCacheExpirationGracePeriod", 240); // default=60; cache DNS entries for 4 minutes after they expire + +// PREF: the number of threads for DNS +//pref("network.dns.max_high_priority_threads", 40); // DEFAULT [FF 123?] +//pref("network.dns.max_any_priority_threads", 24); // DEFAULT [FF 123?] + +// PREF: increase TLS token caching +pref("network.ssl_tokens_cache_capacity", 10240); // default=2048; more TLS token caching (fast reconnects) + +/**************************************************************************** + * SECTION: SPECULATIVE LOADING * +****************************************************************************/ + +// These are connections that are not explicitly asked for (e.g., clicked on). +// [1] https://developer.mozilla.org/en-US/docs/Web/Performance/Speculative_loading + +// [NOTE] FF85+ partitions (isolates) pooled connections, prefetch connections, +// pre-connect connections, speculative connections, TLS session identifiers, +// and other connections. We can take advantage of the speed of pre-connections +// while preserving privacy. Users may relax hardening to maximize their preference. +// For more information, see SecureFox: "PREF: State Paritioning" and "PREF: Network Partitioning". +// [NOTE] To activate and increase network predictions, go to settings in uBlock Origin and uncheck: +// - "Disable pre-fetching (to prevent any connection for blocked network requests)" +// [NOTE] Add prefs to "MY OVERRIDES" section and uncomment to enable them in your user.js. + +// PREF: link-mouseover opening connection to linked server +// When accessing content online, devices use sockets as endpoints. +// The global limit on half-open sockets controls how many speculative +// connection attempts can occur at once when starting new connections [3]. +// If the user follows through, pages can load faster since some +// work was done in advance. Firefox opens predictive connections +// to sites when hovering over New Tab thumbnails or starting a +// URL Bar search [1] and hyperlinks within a page [2]. +// [NOTE] DNS (if enabled), TCP, and SSL handshakes are set up in advance, +// but page contents are not downloaded until a click on the link is registered. +// [1] https://support.mozilla.org/en-US/kb/how-stop-firefox-making-automatic-connections?redirectslug=how-stop-firefox-automatically-making-connections&redirectlocale=en-US#:~:text=Speculative%20pre%2Dconnections +// [2] https://news.slashdot.org/story/15/08/14/2321202/how-to-quash-firefoxs-silent-requests +// [3] https://searchfox.org/mozilla-central/rev/028c68d5f32df54bca4cf96376f79e48dfafdf08/modules/libpref/init/all.js#1280-1282 +// [4] https://www.keycdn.com/blog/resource-hints#prefetch +// [5] https://3perf.com/blog/link-rels/#prefetch +//pref("network.http.speculative-parallel-limit", 20); // DEFAULT (FF127+?) + +// PREF: DNS prefetching for HTMLLinkElement +// Used for cross-origin connections to provide small performance improvements. +// You can enable rel=dns-prefetch for the HTTPS document without prefetching +// DNS for anchors, whereas the latter makes more specualtive requests [5]. +// [1] https://bitsup.blogspot.com/2008/11/dns-prefetching-for-firefox.html +// [2] https://css-tricks.com/prefetching-preloading-prebrowsing/#dns-prefetching +// [3] https://www.keycdn.com/blog/resource-hints#2-dns-prefetching +// [4] http://www.mecs-press.org/ijieeb/ijieeb-v7-n5/IJIEEB-V7-N5-2.pdf +// [5] https://bugzilla.mozilla.org/show_bug.cgi?id=1596935#c28 +pref("network.dns.disablePrefetch", true); + pref("network.dns.disablePrefetchFromHTTPS", true); // [FF127+ false] + +// PREF: DNS prefetch for HTMLAnchorElement (speculative DNS) +// Disable speculative DNS calls to prevent Firefox from resolving +// hostnames for other domains linked on a page. This may eliminate +// unnecessary DNS lookups, but can increase latency when following external links. +// [1] https://bugzilla.mozilla.org/show_bug.cgi?id=1596935#c28 +// [2] https://github.com/arkenfox/user.js/issues/1870#issuecomment-2220773972 +//pref("dom.prefetch_dns_for_anchor_http_document", false); // [FF128+] +//pref("dom.prefetch_dns_for_anchor_https_document", false); // DEFAULT [FF128+] + +// PREF: enable tag and Link: rel=preconnect response header handling +//pref("network.preconnect", true); // DEFAULT + +// PREF: preconnect to the autocomplete URL in the address bar +// Whether to warm up network connections for autofill or search results. +// Firefox preloads URLs that autocomplete when a user types into the address bar. +// Connects to destination server ahead of time, to avoid TCP handshake latency. +// [NOTE] Firefox will perform DNS lookup (if enabled) and TCP and TLS handshake, +// but will not start sending or receiving HTTP data. +// [1] https://www.ghacks.net/2017/07/24/disable-preloading-firefox-autocomplete-urls/ +//pref("browser.urlbar.speculativeConnect.enabled", false); + +// PREF: mousedown speculative connections on bookmarks and history [FF98+] +// Whether to warm up network connections for places:menus and places:toolbar. +//pref("browser.places.speculativeConnect.enabled", false); + +// PREF: network module preload [FF115+] +// High-priority loading of current page JavaScript modules. +// Used to preload high-priority JavaScript modules for strategic performance improvements. +// Module preloading allows developers to fetch JavaScript modules and dependencies +// earlier to accelerate page loads. The browser downloads, parses, and compiles modules +// referenced by links with this attribute in parallel with other resources, rather +// than sequentially waiting to process each. Preloading reduces overall download times. +// Browsers may also automatically preload dependencies without firing extra events. +// Unlike other pre-connection tags (except rel=preload), this tag is mandatory for the browser. +// [1] https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/modulepreload +//pref("network.modulepreload", true); // DEFAULT + +// PREF: link prefetching +// Pre-populates the HTTP cache by prefetching same-site future navigation +// resources or subresources used on those pages. +// Enabling link prefetching allows Firefox to preload pages tagged as important. +// The browser prefetches links with the prefetch-link tag, fetching resources +// likely needed for the next navigation at low priority. When clicking a link +// or loading a new page, prefetching stops and discards hints. Prefetching +// downloads resources without executing them. +// [NOTE] Since link prefetch uses the HTTP cache, it has a number of issues +// with document prefetches, such as being potentially blocked by Cache-Control headers +// (e.g. cache partitioning). +// [1] https://developer.mozilla.org/en-US/docs/Glossary/Prefetch +// [2] http://www.mecs-press.org/ijieeb/ijieeb-v7-n5/IJIEEB-V7-N5-2.pdf +// [3] https://timkadlec.com/remembers/2020-06-17-prefetching-at-this-age/ +// [4] https://3perf.com/blog/link-rels/#prefetch +// [5] https://developer.mozilla.org/docs/Web/HTTP/Link_prefetching_FAQ +pref("network.prefetch-next", false); + +// PREF: Fetch Priority API [FF119+] +// Indicates whether the `fetchpriority` attribute for elements which support it. +// [1] https://web.dev/articles/fetch-priority +// [2] https://nitropack.io/blog/post/priority-hints +// [2] https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/fetchPriority +// [3] https://developer.mozilla.org/en-US/docs/Web/API/HTMLLinkElement/fetchPriority +//pref("network.fetchpriority.enabled", true); + +// PREF: early hints [FF120+] +// [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/103 +// [2] https://developer.chrome.com/blog/early-hints/ +// [3] https://blog.cloudflare.com/early-hints/ +// [4] https://blog.cloudflare.com/early-hints-performance/ +//pref("network.early-hints.enabled", true); + +// PREF: `Link: rel=preconnect` in 103 Early Hint response [FF120+] +// Used to warm most critical cross-origin connections to provide +// performance improvements when connecting to them. +// [NOTE] When 0, this is limited by "network.http.speculative-parallel-limit". +//pref("network.early-hints.preconnect.enabled", true); +//pref("network.early-hints.preconnect.max_connections", 10); // DEFAULT + +// PREF: Network Predictor (NP) +// When enabled, it trains and uses Firefox's algorithm to preload page resource +// by tracking past page resources. It uses a local file (history) of needed images, +// scripts, etc. to request them preemptively when navigating. +// [NOTE] By default, it only preconnects, doing DNS, TCP, and SSL handshakes. +// No data sends until clicking. With "network.predictor.enable-prefetch" enabled, +// it also performs prefetches. +// [1] https://wiki.mozilla.org/Privacy/Reviews/Necko +// [2] https://www.ghacks.net/2014/05/11/seer-disable-firefox/ +// [3] https://github.com/dillbyrne/random-agent-spoofer/issues/238#issuecomment-110214518 +// [4] https://www.igvita.com/posa/high-performance-networking-in-google-chrome/#predictor +pref("network.predictor.enabled", false); + +// PREF: Network Predictor fetch for resources ahead of time +// Prefetch page resources based on past user behavior. +//pref("network.predictor.enable-prefetch", false); // DEFAULT + +// PREF: make Network Predictor active when hovering over links +// When hovering over links, Network Predictor uses past resource history to +// preemptively request what will likely be needed instead of waiting for the document. +// Predictive connections automatically open when hovering over links to speed up +// loading, starting some work in advance. +//pref("network.predictor.enable-hover-on-ssl", false); // DEFAULT + +// PREF: assign Network Predictor confidence levels +// [NOTE] Keep in mind that Network Predictor must LEARN your browsing habits. +// Editing these lower will cause more speculative connections to occur, +// which reduces accuracy over time and has privacy implications. +//pref("network.predictor.preresolve-min-confidence", 60); // DEFAULT +//pref("network.predictor.preconnect-min-confidence", 90); // DEFAULT +//pref("network.predictor.prefetch-min-confidence", 100); // DEFAULT + +// PREF: other Network Predictor values +// [NOTE] Keep in mmind that Network Predictor must LEARN your browsing habits. +//pref("network.predictor.prefetch-force-valid-for", 10); // DEFAULT; how long prefetched resources are considered valid and usable (in seconds) for the prediction modeling +//pref("network.predictor.prefetch-rolling-load-count", 10); // DEFAULT; the maximum number of resources that Firefox will prefetch in memory at one time based on prediction modeling +//pref("network.predictor.max-resources-per-entry", 250); // default=100 +//pref("network.predictor.max-uri-length", 1000); // default=500 + +/**************************************************************************** + * SECTION: EXPERIMENTAL * +****************************************************************************/ + +// PREF: CSS Masonry Layout [NIGHTLY] +// [1] https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout/Masonry_Layout +pref("layout.css.grid-template-masonry-value.enabled", true); + +// PREF: Prioritized Task Scheduling API [NIGHTLY] +// [1] https://blog.mozilla.org/performance/2022/06/02/prioritized-task-scheduling-api-is-prototyped-in-nightly/ +// [2] https://medium.com/airbnb-engineering/building-a-faster-web-experience-with-the-posttask-scheduler-276b83454e91 +pref("dom.enable_web_task_scheduling", true); + +// PREF: HTML Sanitizer API [NIGHTLY] +// [1] https://developer.mozilla.org/en-US/docs/Web/API/Sanitizer +// [2] https://caniuse.com/mdn-api_sanitizer +pref("dom.security.sanitizer.enabled", true); + +// PREF: WebGPU [HIGHLY EXPERIMENTAL!] +// [WARNING] Do not enable unless you are a web developer! +// [1] https://bugzilla.mozilla.org/show_bug.cgi?id=1746245 +// [2] https://developer.chrome.com/docs/web-platform/webgpu/ +// [3] https://github.com/gpuweb/gpuweb/wiki/Implementation-Status +// [4] https://hacks.mozilla.org/2020/04/experimental-webgpu-in-firefox/ +//pref("dom.webgpu.enabled", true); + //pref("gfx.webgpu.force-enabled", true); // enforce +// enable WebGPU indirect draws/dispatches: +//pref("dom.webgpu.indirect-dispatch.enabled", true); + +/**************************************************************************** + * SECTION: TAB UNLOAD * +****************************************************************************/ + +// PREF: unload tabs on low memory +// [ABOUT] about:unloads +// Firefox will detect if your computer’s memory is running low (less than 200MB) +// and suspend tabs that you have not used in awhile. +// [1] https://support.mozilla.org/en-US/kb/unload-inactive-tabs-save-system-memory-firefox +// [2] https://hacks.mozilla.org/2021/10/tab-unloading-in-firefox-93/ +//pref("browser.tabs.unloadOnLowMemory", true); // DEFAULT + +// PREF: determine when tabs unload [WINDOWS] [LINUX] +// Notify TabUnloader or send the memory pressure if the memory resource +// notification is signaled AND the available commit space is lower than +// this value. +// Set this to some high value, e.g. 2/3 of total memory available in your system: +// 4GB=2640, 8GB=5280, 16GB=10560, 32GB=21120, 64GB=42240 +// [1] https://dev.to/msugakov/taking-firefox-memory-usage-under-control-on-linux-4b02 +//pref("browser.low_commit_space_threshold_mb", 2640); // default=200; WINDOWS LINUX + +// PREF: determine when tabs unload [LINUX] +// On Linux, Firefox checks available memory in comparison to total memory, +// and use this percent value (out of 100) to determine if Firefox is in a +// low memory scenario. +// [1] https://dev.to/msugakov/taking-firefox-memory-usage-under-control-on-linux-4b02 +//pref("browser.low_commit_space_threshold_percent", 33); // default=5; LINUX + +// PREF: determine how long (in ms) tabs are inactive before they unload +// 60000=1min; 300000=5min; 600000=10min (default) +//pref("browser.tabs.min_inactive_duration_before_unload", 300000); // 5min; default=600000 + +/**************************************************************************** + * SECTION: PROCESS COUNT * +****************************************************************************/ + +// PREF: process count +// [ABOUT] View in about:processes. +// With Firefox Quantum (2017), CPU cores = processCount. However, since the +// introduction of Fission [2], the number of website processes is controlled +// by processCount.webIsolated. Disabling fission.autostart or changing +// fission.webContentIsolationStrategy reverts control back to processCount. +// [1] https://www.reddit.com/r/firefox/comments/r69j52/firefox_content_process_limit_is_gone/ +// [2] https://firefox-source-docs.mozilla.org/dom/ipc/process_model.html#web-content-processes +//pref("dom.ipc.processCount", 8); // DEFAULT; Shared Web Content +//pref("dom.ipc.processCount.webIsolated", 1); // default=4; Isolated Web Content + +// PREF: use one process for process preallocation cache +//pref("dom.ipc.processPrelaunch.fission.number", 1); // default=3; Process Preallocation Cache + +// PREF: configure process isolation +// [1] https://hg.mozilla.org/mozilla-central/file/tip/dom/ipc/ProcessIsolation.cpp#l53 +// [2] https://www.reddit.com/r/firefox/comments/r69j52/firefox_content_process_limit_is_gone/ + +// OPTION 1: isolate all websites +// Web content is always isolated into its own `webIsolated` content process +// based on site-origin, and will only load in a shared `web` content process +// if site-origin could not be determined. +//pref("fission.webContentIsolationStrategy", 1); // DEFAULT +//pref("browser.preferences.defaultPerformanceSettings.enabled", true); // DEFAULT + //pref("dom.ipc.processCount.webIsolated", 1); // one process per site origin + +// OPTION 2: isolate only "high value" websites +// Only isolates web content loaded by sites which are considered "high +// value". A site is considered high value if it has been granted a +// `highValue*` permission by the permission manager, which is done in +// response to certain actions. +//pref("fission.webContentIsolationStrategy", 2); +//pref("browser.preferences.defaultPerformanceSettings.enabled", false); + //pref("dom.ipc.processCount.webIsolated", 1); // one process per site origin (high value) + //pref("dom.ipc.processCount", 8); // determine by number of CPU cores/processors + +// OPTION 3: do not isolate websites +// All web content is loaded into a shared `web` content process. This is +// similar to the non-Fission behavior; however, remote subframes may still +// be used for sites with special isolation behavior, such as extension or +// mozillaweb content processes. +//pref("fission.webContentIsolationStrategy", 0); +//pref("browser.preferences.defaultPerformanceSettings.enabled", false); + //pref("dom.ipc.processCount", 8); // determine by number of CPU cores/processors \ No newline at end of file diff --git a/src/browser/app/profile/zen-browser.js b/src/browser/app/profile/zen-browser.js index 628512cde..fadc5b30a 100644 --- a/src/browser/app/profile/zen-browser.js +++ b/src/browser/app/profile/zen-browser.js @@ -69,8 +69,6 @@ pref('zen.view.compact', false); pref('zen.view.sidebar-expanded', false); pref('zen.view.sidebar-expanded.show-button', true); -pref('layers.acceleration.force-enabled', true); - // Pref to enable the new profiles (TODO: Check this out!) //pref("browser.profiles.enabled", true); @@ -95,4 +93,9 @@ user_pref('general.smoothScroll', true); // DEFAULT // Privacy pref('dom.private-attribution.submission.enabled', false); +// From Librewolf +pref('media.eme.enabled', true); +pref('webgl.disabled', false); + +#include fast-fox.js #include better-fox.js diff --git a/src/browser/base/content/ZenWorkspaces.mjs b/src/browser/base/content/ZenWorkspaces.mjs index a58939c40..cf7735beb 100644 --- a/src/browser/base/content/ZenWorkspaces.mjs +++ b/src/browser/base/content/ZenWorkspaces.mjs @@ -138,7 +138,7 @@ var ZenWorkspaces = { }, getWorkspaceIcon(workspace) { - if (workspace.icon) { + if (typeof workspace.icon !== "undefined") { return workspace.icon; } return workspace.name[0].toUpperCase(); @@ -188,8 +188,11 @@ var ZenWorkspaces = { workspaceList.innerHTML = ""; workspaceList.parentNode.style.display = "flex"; if (workspaces.workspaces.length - 1 <= 0) { - workspaceList.parentNode.style.display = "none"; - } + workspaceList.innerHTML = "No workspaces available"; + workspaceList.setAttribute("empty", "true"); + } else { + workspaceList.removeAttribute("empty"); + } if (activeWorkspace) { let currentWorkspace = createWorkspaceElement(activeWorkspace); currentContainer.appendChild(currentWorkspace); @@ -242,13 +245,16 @@ var ZenWorkspaces = { let activeWorkspace = (await this._workspaces()).workspaces.find(workspace => workspace.used); if (activeWorkspace) { button.innerHTML = ` -
+
${this.getWorkspaceIcon(activeWorkspace)}
${activeWorkspace.name}
`; + if (typeof activeWorkspace.icon === "undefined") { + button.querySelector(".zen-workspace-sidebar-icon").setAttribute("no-icon", "true"); + } } }, @@ -298,6 +304,7 @@ var ZenWorkspaces = { } this._workspaceInput.value = ""; let icon = document.querySelector("#PanelUI-zen-workspaces-create-icons-container [selected]"); + icon?.removeAttribute("selected"); await this.createAndSaveWorkspace(workspaceName, false, icon?.label); document.getElementById("PanelUI-zen-workspaces").hidePopup(true); }, diff --git a/src/browser/base/content/zenThemeModifier.js b/src/browser/base/content/zenThemeModifier.js index 964da2537..d1dd012bc 100644 --- a/src/browser/base/content/zenThemeModifier.js +++ b/src/browser/base/content/zenThemeModifier.js @@ -38,7 +38,6 @@ var ZenThemeModifier = { }, listenForEvents() { - addEventListener("LightweightTheme:Set", this); Services.prefs.addObserver(kZenThemeAccentColorPref, this.handleEvent.bind(this)); }, diff --git a/src/browser/themes/shared/zen-browser-shared.css b/src/browser/themes/shared/zen-browser-shared.css index a4ac4a38c..56ac0c9fb 100644 --- a/src/browser/themes/shared/zen-browser-shared.css +++ b/src/browser/themes/shared/zen-browser-shared.css @@ -652,6 +652,14 @@ panelmultiview { display: block; } + #zen-workspaces-button .zen-workspace-sidebar-icon[no-icon="true"] { + display: none; + } + + #zen-workspaces-button .zen-workspace-sidebar-icon[no-icon="true"] + .zen-workspace-sidebar-name { + margin-left: 0; + } + #navigator-toolbox { min-width: 150px; align-items: start; diff --git a/src/browser/themes/shared/zen-panel-ui.css b/src/browser/themes/shared/zen-panel-ui.css index e06276164..20086a73e 100644 --- a/src/browser/themes/shared/zen-panel-ui.css +++ b/src/browser/themes/shared/zen-panel-ui.css @@ -302,6 +302,14 @@ flex-direction: column; } +#PanelUI-zen-workspaces-list[empty="true"] { + font-weight: 600; + padding: 10px; + width: 100%; + text-align: start; + opacity: 0.5; +} + #PanelUI-zen-workspaces-current-info toolbarbutton:last-child { margin-bottom: 0 !important; }