Question

How to correctly restart firefox (without any "restore session" things and with the same windows as before) from code?

I know pid of "firefox-bin" in a bash script process and I have my custom plugin loaded into it.

Was it helpful?

Solution

Services.prefs.setBoolPref("browser.sessionstore.resume_session_once", true);
const nsIAppStartup = Components.interfaces.nsIAppStartup;
Components.classes["@mozilla.org/toolkit/app-startup;1"]
          .getService(nsIAppStartup)
          .quit(nsIAppStartup.eRestart | nsIAppStartup.eAttemptQuit);

Note that this applies to Firefox 4 so the code might be slightly different for earlier versions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top