If you just want the goodies: open about:config and toggle browser.quitShortcut.disabled to true. CTRL+q (or CMD+q on macOS) will no longer quit the browser.

Firefox’s CTRL+q keyboard shortcut by default closes Firefox entirely. The q is, of course, right next to the w which is constantly used in CTRL+w to close a tab. I lost count of how many times I have accidentally closed Firefox while just wanting to close a tab. There used to be some about:config setting that gave a warning if you tried to close Firefox, but in some completely daft decision making, I recall them deciding not to show the warning if you also had Firefox save your tabs on exit. Never mind that you lose most of the state of individual pages when you accidentally close Firefox.

For ages the nerds that be saw this as some “wontfix - you are wrong” thing and you had to make do with addons (which came with its own problems when Firefox went the way of “break all the addons”). Now it seems someone finally did see the light. Since Firefox v87 (I believe that’s the right version), there is an about:config setting that is actually honoured: Set browser.quitShortcut.disabled to true and you are good to go.

The relevant bugreport.

If I appear salty in this post, it is because I am.