toolkit/components/crashes/CrashService.js

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 "use strict";
michael@0 6
michael@0 7 const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
michael@0 8
michael@0 9 Cu.import("resource://gre/modules/Services.jsm", this);
michael@0 10 Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
michael@0 11
michael@0 12 /**
michael@0 13 * This component makes crash data available throughout the application.
michael@0 14 *
michael@0 15 * It is a service because some background activity will eventually occur.
michael@0 16 */
michael@0 17 this.CrashService = function () {};
michael@0 18
michael@0 19 CrashService.prototype = Object.freeze({
michael@0 20 classID: Components.ID("{92668367-1b17-4190-86b2-1061b2179744}"),
michael@0 21 QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
michael@0 22
michael@0 23 observe: function (subject, topic, data) {
michael@0 24 switch (topic) {
michael@0 25 case "profile-after-change":
michael@0 26 // Side-effect is the singleton is instantiated.
michael@0 27 let m = Services.crashmanager;
michael@0 28 break;
michael@0 29 }
michael@0 30 },
michael@0 31 });
michael@0 32
michael@0 33 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([CrashService]);

mercurial