summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/update/nsUpdateServiceStub.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /toolkit/mozapps/update/nsUpdateServiceStub.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'toolkit/mozapps/update/nsUpdateServiceStub.js')
-rw-r--r--toolkit/mozapps/update/nsUpdateServiceStub.js45
1 files changed, 45 insertions, 0 deletions
diff --git a/toolkit/mozapps/update/nsUpdateServiceStub.js b/toolkit/mozapps/update/nsUpdateServiceStub.js
new file mode 100644
index 000000000..dbb841b84
--- /dev/null
+++ b/toolkit/mozapps/update/nsUpdateServiceStub.js
@@ -0,0 +1,45 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* 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/. */
+
+const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
+
+Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
+Cu.import("resource://gre/modules/FileUtils.jsm", this);
+
+const DIR_UPDATES = "updates";
+const FILE_UPDATE_STATUS = "update.status";
+
+const KEY_UPDROOT = "UpdRootD";
+
+/**
+ * Gets the specified directory at the specified hierarchy under the update root
+ * directory without creating it if it doesn't exist.
+ * @param pathArray
+ * An array of path components to locate beneath the directory
+ * specified by |key|
+ * @return nsIFile object for the location specified.
+ */
+function getUpdateDirNoCreate(pathArray) {
+ return FileUtils.getDir(KEY_UPDROOT, pathArray, false);
+}
+
+function UpdateServiceStub() {
+ let statusFile = getUpdateDirNoCreate([DIR_UPDATES, "0"]);
+ statusFile.append(FILE_UPDATE_STATUS);
+ // If the update.status file exists then initiate post update processing.
+ if (statusFile.exists()) {
+ let aus = Cc["@mozilla.org/updates/update-service;1"].
+ getService(Ci.nsIApplicationUpdateService).
+ QueryInterface(Ci.nsIObserver);
+ aus.observe(null, "post-update-processing", "");
+ }
+}
+UpdateServiceStub.prototype = {
+ observe: function() {},
+ classID: Components.ID("{e43b0010-04ba-4da6-b523-1f92580bc150}"),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver])
+};
+
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([UpdateServiceStub]);