This method uses a relatively hidden feature of Firefox, called autoconfig, or more commonly userChrome.js. From what I understand it's primarily intended for enterprises to set certain preferences, disable changing certain preferences, hide UI elements etc. it's all documented here: https://support.mozilla.org/en-US/kb/customizing-firefox-using-autoconfig.
It can however, also be used to our advantage to run JavaScript code at startup, that can change the user interface, like the tab bar or context menu, and in this case, add keybinds and custom commands!
To set it up you first need to create a file, with the name autoconfig.js in either C:\Program Files\Mozilla Firefox\defaults\pref\ or /Applications/Firefox.app/Contents/Resources/defaults/pref/, depending on your operating system.
Contents:
pref("general.config.filename", "firefox.cfg");
pref("general.config.obscure_value", 0);