2019-07-10 22:12:07 +03:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2018-04-04 03:19:26 +03:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
/* globals ExtensionAPI */
|
|
|
|
|
2019-01-17 21:18:31 +03:00
|
|
|
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
2018-04-04 03:19:26 +03:00
|
|
|
|
|
|
|
this.quitter = class extends ExtensionAPI {
|
|
|
|
getAPI(context) {
|
|
|
|
return {
|
|
|
|
quitter: {
|
2019-05-24 14:58:43 +03:00
|
|
|
async quit() {
|
|
|
|
let browserWindow = Services.wm.getMostRecentWindow(
|
|
|
|
"navigator:browser"
|
|
|
|
);
|
|
|
|
if (browserWindow && browserWindow.gBrowserInit) {
|
|
|
|
await browserWindow.gBrowserInit.idleTasksFinishedPromise;
|
|
|
|
}
|
2018-04-04 03:19:26 +03:00
|
|
|
Services.startup.quit(Ci.nsIAppStartup.eForceQuit);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|