如何从代码重新启动firefox?

如何从代码重新启动firefox?,firefox,application-restart,Firefox,Application Restart,如何从代码中正确地重新启动firefox(没有任何“恢复会话”功能,并且使用与以前相同的窗口) 我知道bash脚本过程中“firefoxbin”的pid,我已经将自定义插件加载到其中 Services.prefs.setBoolPref("browser.sessionstore.resume_session_once", true); const nsIAppStartup = Components.interfaces.nsIAppStartup; Components.classes["@

如何从代码中正确地重新启动firefox(没有任何“恢复会话”功能,并且使用与以前相同的窗口)

我知道bash脚本过程中“firefoxbin”的pid,我已经将自定义插件加载到其中

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);
请注意,这适用于Firefox4,因此早期版本的代码可能略有不同