diff --git a/content/liberator.js b/content/liberator.js index 4dcdd6d0..5ac60f3e 100644 --- a/content/liberator.js +++ b/content/liberator.js @@ -362,12 +362,12 @@ const liberator = (function () //{{{ liberator.commands.add(["q[uit]"], liberator.has("tabs") ? "Quit current tab" : "Quit application", - function () + function (args, special) { if (liberator.has("tabs")) liberator.tabs.remove(getBrowser().mCurrentTab, 1, false, 1); else - liberator.quit(false); + liberator.quit(false, special); }, { argCount: "0" }); @@ -963,14 +963,20 @@ const liberator = (function () //{{{ plugins: {}, // quit liberator, no matter how many tabs/windows are open - quit: function (saveSession) + quit: function (saveSession, force) { if (saveSession) liberator.options.setPref("browser.startup.page", 3); // start with saved session else liberator.options.setPref("browser.startup.page", 1); // start with default homepage session - goQuitApplication(); + const nsIAppStartup = Components.interfaces.nsIAppStartup; + if (force) + Components.classes["@mozilla.org/toolkit/app-startup;1"] + .getService(nsIAppStartup) + .quit(nsIAppStartup.eForceQuit); + else + goQuitApplication(); }, restart: function () diff --git a/content/tabs.js b/content/tabs.js index b84902f3..26896324 100644 --- a/content/tabs.js +++ b/content/tabs.js @@ -471,9 +471,9 @@ liberator.Tabs = function () //{{{ liberator.commands.add(["quita[ll]", "qa[ll]"], "Quit " + liberator.config.name, - function () + function (args, special) { - liberator.quit(false); + liberator.quit(false, special); }, { argCount: "0" }); @@ -743,11 +743,8 @@ liberator.Tabs = function () //{{{ // quitOnLastTab = 2: quit and save session remove: function (tab, count, focusLeftTab, quitOnLastTab) { - var removeOrBlankTab = (function () - { - if (liberator.config.hostApplication == "Firefox") - { - return function (tab) + var removeOrBlankTab = { + Firefox: function (tab) { if (getBrowser().mTabs.length > 1) getBrowser().removeTab(tab); @@ -762,20 +759,15 @@ liberator.Tabs = function () //{{{ else liberator.beep(); } - }; - } - else if (liberator.config.hostApplication == "Thunderbird") - { - return function (tab) + }, + Thunderbird: function (tab) { if (getBrowser().mTabs.length > 1) getBrowser().removeTab(tab); else liberator.beep(); - }; - } - return function () { return null; }; - })(); + } + }[liberator.config.hostApplication] || function () {}; if (typeof count != "number" || count < 1) count = 1;