I want to quit Firefox from the command line, without "forcing" it. I just want to cause the same as clicking Quit in the menu in Firefox would.
Seems I need to call "goQuitApplication" somehow, based on the following.
I tried making a xul file and running that, but I got an error in it. I tried running the file from this Mozillazine post, but Firefox said in the console that "TypeError: Components.classes is undefined".
The following is the code of that xul file:
Remote XUL Manager by Jorge Villalobos
https://addons.mozilla.org/firefox/addon/235281/
Domains with remote XUL permission: <Local files>
Loads the specified chrome:
firefox -chrome example.xul
-->
<window onload="load()"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript">
<![CDATA[
function load() {
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].
getService(Components.interfaces.nsIWindowMediator);
var win = wm.getMostRecentWindow("navigator:browser");
win.setTimeout("goQuitApplication()", 250);
window.close();
}
]]>
</script>
</window>
I've tried simply calling "goQuitApplication" inside the load function, (which seemingly works if called inside the browser console) but then I got the error "ReferenceError: goQuitApplication is not defined".
Does anyone know of a good way to quit Firefox from the command line, without force killing the process or closing individual windows?