I\'m doing some automation with Firefox and although I can open Firefox window from shell, I\'m not able to terminate it properly. If I kill Firefox process with
As @skybert indicated in the comment, you can
set
browser.sessionstore.resume_from_crashtofalse.
in about:config, which
will rid you of the "Ups, something went wrong ..." message.
To get rid of the safe-mode message, you can set the config
toolkit.startup.max_resumed_crashesto-1
or (just set) the environment variable MOZ_DISABLE_AUTO_SAFE_MODE.
In lack of a better solution, you can remove sessionstore.js from the profile folder after the killall.
This is no more "gentle" than your solution, but it fixes the "Safe Mode" message:
Source: https://support.mozilla.org/en-US/questions/817752