Repository navigation
Add LibreWolf as supported browser - #13309
TheBananaPancake wants to merge 1 commit into
Conversation
Automated AI review
Verified: the LibreWolf plumbing is correct at The policy step overwrites LibreWolf's own
|
8c347d8 to
f2d4b9f
Compare
Automated AI review
Outcome: At Earlier findings:
The new LibreWolf policy file is unusedLibreWolf 156.0.1's loader reads Suggested change: put the prefs as Reproducer (fails at f2d4b9f)Reproducer: LibreWolf never reads the policies.json this PR installsReviewed head: At this head Source (Firefox 156.0.1, the base of LibreWolf 156.0.1-1, the current Arch
Test (PR's test style)Save as #!/bin/bash
# LibreWolf uses Firefox's enterprise policy loader unchanged. On Linux that
# loader reads /etc/<app name>/policies/policies.json when the file exists and
# otherwise the policies.json in the install's distribution directory, never
# both (JSONPoliciesProvider._getLocalConfigurationFile). For LibreWolf the
# first path is /etc/librewolf/policies/policies.json and the second is the
# /usr/lib/librewolf/distribution/policies.json its package ships. Default
# preferences are also read from /etc/librewolf/defaults/pref/*.js.
#
# This runs omarchy-install-browser librewolf with sudo moved into a temporary
# root, then checks that Omarchy's preferences reach a file LibreWolf reads and
# that LibreWolf still reads the policies its package ships.
set -euo pipefail
source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh"
(( EUID != 0 )) || fail "run this test unprivileged; it must not write the real /etc"
test_tmp=$(mktemp -d)
trap 'rm -rf "$test_tmp"' EXIT
fake_root=$test_tmp/root
mock_bin=$test_tmp/bin
mkdir -p "$mock_bin" "$test_tmp/home" "$fake_root/usr/lib/librewolf/distribution"
# Stand-in for the policies.json the librewolf package ships.
printf '%s\n' '{"policies":{"DisableTelemetry":true,"ExtensionSettings":{"uBlock0@raymondhill.net":{"installation_mode":"force_installed"}}}}' \
>"$fake_root/usr/lib/librewolf/distribution/policies.json"
# sudo runs the command unprivileged, with system paths moved under the fake root.
cat >"$mock_bin/sudo" <<'SH'
#!/bin/bash
args=()
skip=0
for arg in "$@"; do
if (( skip )); then
skip=0
continue
fi
case $arg in
-o|-g) skip=1 ;;
/etc/*|/usr/lib/*|/opt/*) args+=("$FAKE_ROOT$arg") ;;
*) args+=("$arg") ;;
esac
done
exec "${args[@]}"
SH
printf '#!/bin/bash\nexit 0\n' >"$mock_bin/omarchy-pkg-add"
chmod +x "$mock_bin"/*
FAKE_ROOT=$fake_root HOME=$test_tmp/home OMARCHY_PATH=$ROOT PATH="$mock_bin:$ROOT/bin:$PATH" \
"$ROOT/bin/omarchy-install-browser" librewolf >/dev/null
policies=$fake_root/etc/librewolf/policies/policies.json
[[ -f $policies ]] || policies=$fake_root/usr/lib/librewolf/distribution/policies.json
written=$(cd "$fake_root" && { find etc -type f 2>/dev/null || true; } | sort | tr '\n' ' ')
prefs_read=false
if grep -q 'widget.wayland.fractional-scale.enabled' "$policies"; then
prefs_read=true
fi
for pref_file in "$fake_root"/etc/librewolf/defaults/pref/*.js; do
if [[ -f $pref_file ]] && grep -q 'widget.wayland.fractional-scale.enabled' "$pref_file"; then
prefs_read=true
fi
done
$prefs_read ||
fail "LibreWolf reads Omarchy's preferences" "LibreWolf reads ${policies#"$fake_root"}; Omarchy wrote: $written"
grep -q 'uBlock0@raymondhill.net' "$policies" ||
fail "LibreWolf keeps the policies its package ships" "LibreWolf reads ${policies#"$fake_root"}; Omarchy wrote: $written"
pass "LibreWolf reads Omarchy's preferences and keeps its own policies"Actual output at f2d4b9f (exit 1)Controls (same test, disposable copies of the head)A. Only moving the file into --- a/bin/omarchy-install-browser
+++ b/bin/omarchy-install-browser
@@ -87,7 +87,7 @@
echo "Installing LibreWolf..."
omarchy-pkg-add librewolf || exit 1
- browser_policy_setup_firefox_distribution /etc/librewolf
+ browser_policy_setup_firefox_distribution /etc/librewolf/policies
setup_firefox_wayland
announce_browser_installed "LibreWolf"
;;B. A LibreWolf-specific file in --- a/bin/omarchy-install-browser
+++ b/bin/omarchy-install-browser
@@ -87,7 +87,7 @@
echo "Installing LibreWolf..."
omarchy-pkg-add librewolf || exit 1
- browser_policy_setup_firefox_distribution /etc/librewolf
+ browser_policy_setup_firefox_distribution /etc/librewolf/policies "$OMARCHY_PATH/default/firefox/librewolf-policies.json"
setup_firefox_wayland
announce_browser_installed "LibreWolf"
;;C. Omarchy's five preferences as a system default-preferences file, --- a/bin/omarchy-install-browser
+++ b/bin/omarchy-install-browser
@@ -87,7 +87,10 @@
echo "Installing LibreWolf..."
omarchy-pkg-add librewolf || exit 1
- browser_policy_setup_firefox_distribution /etc/librewolf
+ browser_policy_setup_parent /etc/librewolf
+ browser_policy_setup_parent /etc/librewolf/defaults
+ browser_policy_setup_parent /etc/librewolf/defaults/pref
+ as_root install -m 644 -o root -g root -T "$OMARCHY_PATH/default/firefox/librewolf-omarchy.js" /etc/librewolf/defaults/pref/omarchy.js
setup_firefox_wayland
announce_browser_installed "LibreWolf"
;;
pref("apz.overscroll.enabled", true);
pref("media.ffmpeg.vaapi.enabled", true);
pref("media.hardware-video-decoding.force-enabled", true);
pref("widget.disable-swipe-tracker", false);
pref("widget.wayland.fractional-scale.enabled", true);The test checks files against the loader's lookup rules taken from the source above. LibreWolf itself was not installed or launched, so B and C are verified against those rules, not in a running browser. The PR's existing DetailsLoader source (Firefox 156.0.1): Optional notes:
Verified:
Earlier findings still present
Reproducer:
|
f2d4b9f to
59c698c
Compare
|
Used the merged-policies option: /etc/librewolf/defaults/pref/ is never read, so I checked the packaged build's EnterprisePoliciesParent.sys.mjs; /etc/librewolf is only consulted for policies/policies.json, and default pref files load from the app dir only. default/librewolf/policies.json is the packaged file plus Omarchy's Preferences, installed to /etc/librewolf/policies/policies.json, with a note to re-copy it when the package changes it. Confirmed in about:policies that both sets apply. Glyph moved to U+E911 since E90F and E910 are both claimed by open PRs (#12137). |
|
| librewolf) | ||
| echo "Removing LibreWolf..." | ||
| set_fallback_default_browser librewolf.desktop | ||
| omarchy-pkg-drop librewolf |
There was a problem hiding this comment.
Removal leaves installed policy
The installer writes an Omarchy-managed file under /etc/librewolf/policies, but this branch only removes the package. If the package transaction does not remove that file, removing LibreWolf leaves the system policy behind. Clean up the file created by the installer during removal.
Knowledge Base Used: Packages, apps, and optional services
|
Thanks for tracking down the policy loader. One maintenance concern: sudo mkdir -p /etc/librewolf/policies
jq -s '.[0] * .[1]' \
/usr/lib/librewolf/distribution/policies.json \
"$OMARCHY_PATH/default/librewolf/policies.json" | # only {"policies": {"Preferences": {...}}}
sudo tee /etc/librewolf/policies/policies.json >/dev/nullWhether LibreWolf joins the supported-browser list at all is a maintainer call. |
Signed-off-by: TheBananaPancake <256630335+TheBananaPancake@users.noreply.github.com>
59c698c to
680fbdc
Compare
|
Thanks for spotting that. The implementation differs from your snippet in two ways, both to reuse the existing policy helpers:
Totally fine if the PR doesn't get merged; it's just more convenience for LibreWolf users like me :) |
|
Thanks, merging over the packaged file at install time means LibreWolf's own policy updates carry through now. Going through |
Signed-off-by: TheBananaPancake 256630335+TheBananaPancake@users.noreply.github.com