Skip to content

Instantly share code, notes, and snippets.

@TheBrokenRail
Last active March 25, 2023 10:05
Embed
What would you like to do?
Jailbreak Firefox!

Jailbreak-Firefox

This script allows you to install unsigned extensions (ones that aren't approved by Mozilla) on normal Firefox builds and the official Snap! That's right, no "Firefox Developer Edition" nonsense required!

⚠️ Disclaimer ⚠️

This script is not well tested, like at all. This script might break things, possibly important things. You should probably take a backup of your Firefox profile before using it. You have been warned.

Dependencies

sudo apt install -y curl unzip zip
# Only needed when jailbreaking the Snap
sudo apt install -y squashfs-tools

Instructions

  1. Close Firefox.
  2. Run the script!
    # Jailbreak System Firefox
    curl -L 'https://gist.github.com/TheBrokenRail/c43bf0f07f4860adac2631a1bd9e4136/raw/jailbreak-firefox-system.sh' | sh
    # Jailbreak Firefox Snap
    curl -L 'https://gist.github.com/TheBrokenRail/c43bf0f07f4860adac2631a1bd9e4136/raw/jailbreak-firefox-snap.sh' | sh
  3. Open Firefox.
  4. Navigate to about:config.
  5. Set xpinstall.signatures.required to false.
  6. Navigate to about:support.
  7. Click Clear startup cache... then Restart.
  8. Done!

Limitations

  • This script must be rerun every time Firefox updates.
  • A Firefox update may break this completely without warning.

FAQ

What are unsigned extensions?

Unsigned extensions are extensions that haven't been approved by Mozilla. Only allowing signed extensions means that Mozilla has total control over what extensions can be installed on Firefox.

What was your motivation for this?

A significant amount of spite that Mozilla was trying to control what I run on my own web browser.

Why did you name this "Jailbreak-Firefox"?

Just like jailbreaking on iOS allows you to escape Apple's walled-garden, this allows you to escape Mozilla's walled-garden.

#!/bin/sh
set -e
## Prepare
echo '**** Preparing... ****'
# Get Revision Of Firefox Snap
REV="$(snap list | grep firefox | awk '{print $3}')"
# Get Snap File
FILE="/var/lib/snapd/snaps/firefox_${REV}.snap"
# Unmount Snap
sudo systemctl stop "snap-firefox-${REV}.mount"
sudo /usr/lib/snapd/snap-discard-ns firefox
# Create Workdir
rm -rf /tmp/jailbreak-firefox-snap-workdir
mkdir /tmp/jailbreak-firefox-snap-workdir
cd /tmp/jailbreak-firefox-snap-workdir
## Modify
echo '**** Modifying... ****'
# Extract Snap
sudo chmod o+r "${FILE}"
unsquashfs -d snap "${FILE}"
# Extract omni.ja
mkdir omni
unzip -q snap/usr/lib/firefox/omni.ja -d omni || : # Ignore Errors
# Patch AppConstants.jsm
sed -i 's/MOZ_REQUIRE_SIGNING:.*/MOZ_REQUIRE_SIGNING: false, _old_require_signing:/' omni/modules/AppConstants.sys.mjs
# Repackage omni.ja
rm -f snap/usr/lib/firefox/omni.ja
cd omni
zip -0DXqr ../snap/usr/lib/firefox/omni.ja . # Source: https://stackoverflow.com/a/68379534
cd ../
# Rebuild Snap
sudo rm -f "${FILE}"
sudo mksquashfs snap "${FILE}" -noappend -comp lzo -no-fragments
## Finalize
echo '**** Finalizing... ****'
# Mount Snap
sudo systemctl start "snap-firefox-${REV}.mount"
# Clean Up
rm -rf /tmp/jailbreak-firefox-snap-workdir
## Done
echo '**** Done! ****'
#!/bin/sh
set -e
## Prepare
echo '**** Preparing... ****'
# Create Workdir
rm -rf /tmp/jailbreak-firefox-system-workdir
mkdir /tmp/jailbreak-firefox-system-workdir
cd /tmp/jailbreak-firefox-system-workdir
## Modify
echo '**** Modifying... ****'
# Extract omni.ja
mkdir omni
unzip -q /usr/lib/firefox/omni.ja -d omni || : # Ignore Errors
# Patch AppConstants.jsm
sed -i 's/MOZ_REQUIRE_SIGNING:.*/MOZ_REQUIRE_SIGNING: false, _old_require_signing:/' omni/modules/AppConstants.sys.mjs
# Repackage omni.ja
sudo rm -f /usr/lib/firefox/omni.ja
cd omni
sudo zip -0DXqr /usr/lib/firefox/omni.ja . # Source: https://stackoverflow.com/a/68379534
cd ../
## Finalize
echo '**** Finalizing... ****'
# Clean Up
rm -rf /tmp/jailbreak-firefox-system-workdir
## Done
echo '**** Done! ****'
@IphoneHater
Copy link

Hey Man. I have never got an iPhone, but I'm gonna buy it (iPhone SE 3) is it possible to jailbreak it? Or what is the last model of normal phone is possible to break? Thank you in advance 🍗🍗

@TheBrokenRail
Copy link
Author

Hey Man. I have never got an iPhone, but I'm gonna buy it (iPhone SE 3) is it possible to jailbreak it? Or what is the last model of normal phone is possible to break? Thank you in advance 🍗🍗

I don't know. This project/gist is about Firefox on Linux.

@RunningDroid
Copy link

Heads up, Firefox 108 renames AppConstants.jsm to AppConstants.sys.mjs but the contents and formatting appear to be the same.

@TheBrokenRail
Copy link
Author

Thanks! It's fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment