I've been using Firefox on a late 2016 MacBook Pro, running macOS 10.12.2. Every time the laptop wakes from sleep, Firefox has crashed. To remedy this situation, I've created a Hammerspoon script to kill Firefox when the system goes to sleep, and start it upon waking. In Firefox Preferences -> General, you can configure a setting called "When Firefox starts". Set this to "Show my windows and tabs from last time". Then install Hammerspoon, create the folder .hammerspoon in your home directory and create the file init.lua in that new folder. Then paste the following code and in Hammerspoon, reload the configuration.
local log = hs.logger.new('mywatcher','debug')
function callback(eventType) if (eventType == hs.caffeinate.watcher.systemWillSleep) then local firefox = hs.application.find('Firefox') if not (firefox == nil) then firefox:kill() end elseif (eventType == hs.caffeinate.watcher.systemDidWake) then local firefox = hs.application.find('Firefox') if (firefox == nil) then firefox = hs.application.open("/Applications/Firefox.app") end end end
local mywatcher = hs.caffeinate.watcher.new(callback) mywatcher:start() log.i("Started")