blob: 7d97f374dafdcc64263df6b23cfe741b9ac5ec39 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
/* 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/. */
'use strict';
const { Cc, Ci } = require("chrome");
exports.restart = function restart() {
let canceled = Cc["@mozilla.org/supports-PRBool;1"]
.createInstance(Ci.nsISupportsPRBool);
Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService)
.notifyObservers(canceled, "quit-application-requested", "restart");
if (canceled.data) return false; // somebody canceled our quit request
// restart
Cc['@mozilla.org/toolkit/app-startup;1'].getService(Ci.nsIAppStartup)
.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
return true;
}
|