mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
691543ee89
Automatic changes by ESLint, except for manual corrections for .xml files. Differential Revision: https://phabricator.services.mozilla.com/D4439 --HG-- extra : moz-landing-system : lando
44 lines
1.6 KiB
JavaScript
44 lines
1.6 KiB
JavaScript
/* -*- 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/. */
|
|
|
|
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm", this);
|
|
ChromeUtils.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() {},
|
|
classID: Components.ID("{e43b0010-04ba-4da6-b523-1f92580bc150}"),
|
|
QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]),
|
|
};
|
|
|
|
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([UpdateServiceStub]);
|