JSActionsでFirefox再起動
QuickRestartという拡張機能があるけど、拡張機能を削減するため、JSActionsで代替。
使用メモリを減らせるかどうかは分からない。
function Reload () { // Code taken from chrome://toolkit/content/mozapps/extensions/extensions.js const nsIAppStartup = Components.interfaces.nsIAppStartup; // Notify all windows that an application quit has been requested. //全ウィンドウにアプリケーション終了がリクエストされたことを知らせる var os = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService); var cancelQuit = Components.classes["@mozilla.org/supports-PRBool;1"].createInstance(Components.interfaces.nsISupportsPRBool); os.notifyObservers(cancelQuit, "quit-application-requested", null); // Something aborted the quit process. //終了プロセスが邪魔されたときは中止 if (cancelQuit.data) return; // Notify all windows that an application quit has been granted.アプリ終了が許可された os.notifyObservers(null, "quit-application-granted", null); // Enumerate all windows and call shutdown handlers //全ウィンドウを一覧表示し、シャットダウンハンドラを呼び出す var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator); var windows = wm.getEnumerator(null); while (windows.hasMoreElements()) { var win = windows.getNext(); if (("tryToClose" in win) && !win.tryToClose()) return; } Components.classes["@mozilla.org/toolkit/app-startup;1"].getService(nsIAppStartup).quit(nsIAppStartup.eRestart | nsIAppStartup.eAttemptQuit); } Reload();
このコードをglobalメニューに保存すると、右クリックメニューから再起動できるし、Keyconfigに登録してショートカットキーでも実行できる。