michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: "use strict"; michael@0: michael@0: const {classes: Cc, interfaces: Ci, utils: Cu} = Components; michael@0: michael@0: Cu.import("resource://gre/modules/Services.jsm", this); michael@0: Cu.import("resource://gre/modules/XPCOMUtils.jsm", this); michael@0: michael@0: /** michael@0: * This component makes crash data available throughout the application. michael@0: * michael@0: * It is a service because some background activity will eventually occur. michael@0: */ michael@0: this.CrashService = function () {}; michael@0: michael@0: CrashService.prototype = Object.freeze({ michael@0: classID: Components.ID("{92668367-1b17-4190-86b2-1061b2179744}"), michael@0: QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]), michael@0: michael@0: observe: function (subject, topic, data) { michael@0: switch (topic) { michael@0: case "profile-after-change": michael@0: // Side-effect is the singleton is instantiated. michael@0: let m = Services.crashmanager; michael@0: break; michael@0: } michael@0: }, michael@0: }); michael@0: michael@0: this.NSGetFactory = XPCOMUtils.generateNSGetFactory([CrashService]);